Commit graph

62 commits

Author SHA1 Message Date
Linus Torvalds 81b50f3ce4 Move 'builtin-*' into a 'builtin/' subdirectory
This shrinks the top-level directory a bit, and makes it much more
pleasant to use auto-completion on the thing. Instead of

	[torvalds@nehalem git]$ em buil<tab>
	Display all 180 possibilities? (y or n)
	[torvalds@nehalem git]$ em builtin-sh
	builtin-shortlog.c     builtin-show-branch.c  builtin-show-ref.c
	builtin-shortlog.o     builtin-show-branch.o  builtin-show-ref.o
	[torvalds@nehalem git]$ em builtin-shor<tab>
	builtin-shortlog.c  builtin-shortlog.o
	[torvalds@nehalem git]$ em builtin-shortlog.c

you get

	[torvalds@nehalem git]$ em buil<tab>		[type]
	builtin/   builtin.h
	[torvalds@nehalem git]$ em builtin		[auto-completes to]
	[torvalds@nehalem git]$ em builtin/sh<tab>	[type]
	shortlog.c     shortlog.o     show-branch.c  show-branch.o  show-ref.c     show-ref.o
	[torvalds@nehalem git]$ em builtin/sho		[auto-completes to]
	[torvalds@nehalem git]$ em builtin/shor<tab>	[type]
	shortlog.c  shortlog.o
	[torvalds@nehalem git]$ em builtin/shortlog.c

which doesn't seem all that different, but not having that annoying
break in "Display all 180 possibilities?" is quite a relief.

NOTE! If you do this in a clean tree (no object files etc), or using an
editor that has auto-completion rules that ignores '*.o' files, you
won't see that annoying 'Display all 180 possibilities?' message - it
will just show the choices instead.  I think bash has some cut-off
around 100 choices or something.

So the reason I see this is that I'm using an odd editory, and thus
don't have the rules to cut down on auto-completion.  But you can
simulate that by using 'ls' instead, or something similar.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-22 14:29:41 -08:00
Jeff King 4d128884fb cherry-pick: prettify the advice message
It's hard to see the "how to commit" part of this message,
which users may want to cut and paste. On top of that,
having it in paragraph form means that a really long commit
name may cause ugly wrapping. Let's make it prettier, like:

  Automatic cherry-pick failed.  After resolving the conflicts,
  mark the corrected paths with 'git add <paths>' or 'git rm <paths>'
  and commit the result with:

          git commit -c HEAD~23

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-11 22:11:12 -08:00
Jeff King 97915544f8 cherry-pick: show commit name instead of sha1
When we have a conflict, we advise the user to do:

  git commit -c $sha1

This works fine, but is unnecessarily confusing and annoying
for the user to type, when:

  git commit -c $the_thing_you_called_cherry_pick_with

works just as well.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-11 22:11:04 -08:00
Jeff King 08565bdb4b cherry-pick: format help message as strbuf
This gets rid of the fixed-size buffer and an unchecked
sprintf. That sprintf is actually OK as the only
variable-sized thing put in it is an abbreviated sha1, which
is bounded at 40 characters. However, the next patch will
change that to something unbounded.

Note that this function now returns an allocated buffer
instead of a static one; however, it doesn't matter as the
only caller exits immediately.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-11 22:11:03 -08:00
Jeff King dd9314cc2a cherry-pick: refactor commit parsing code
These lines are really just lookup_commit_reference
re-implemented.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-11 22:11:01 -08:00
Jeff King 6e359978e9 cherry-pick: rewrap advice message
The current message overflows on an 80-character terminal.
While we're at it, fix the spelling of 'committing'.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-11 22:10:57 -08:00
Junio C Hamano 71b3ef11fa Merge branch 'mm/conflict-advice'
* mm/conflict-advice:
  Be more user-friendly when refusing to do something because of conflict.

Conflicts:
	Documentation/config.txt
	advice.c
	advice.h
2010-01-20 14:42:59 -08:00
Matthieu Moy d38a30df7d Be more user-friendly when refusing to do something because of conflict.
Various commands refuse to run in the presence of conflicts (commit,
merge, pull, cherry-pick/revert). They all used to provide rough, and
inconsistant error messages.

A new variable advice.resolveconflict is introduced, and allows more
verbose messages, pointing the user to the appropriate solution.

For commit, the error message used to look like this:

$ git commit
foo.txt: needs merge
foo.txt: unmerged (c34a92682e0394bc0d6f4d4a67a8e2d32395c169)
foo.txt: unmerged (3afcd75de8de0bb5076942fcb17446be50451030)
foo.txt: unmerged (c9785d77b76dfe4fb038bf927ee518f6ae45ede4)
error: Error building trees

The "need merge" line is given by refresh_cache. We add the IN_PORCELAIN
option to make the output more consistant with the other porcelain
commands, and catch the error in return, to stop with a clean error
message. The next lines were displayed by a call to cache_tree_update(),
which is not reached anymore if we noticed the conflict.

The new output looks like:

U       foo.txt
fatal: 'commit' is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>' as
appropriate to mark resolution and make a commit, or use 'git commit -a'.

Pull is slightly modified to abort immediately if $GIT_DIR/MERGE_HEAD
exists instead of waiting for merge to complain.

The behavior of merge and the test-case are slightly modified to reflect
the usual flow: start with conflicts, fix them, and afterwards get rid of
MERGE_HEAD, with different error messages at each stage.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-12 13:17:08 -08:00
Junio C Hamano cb6020bb01 Teach --[no-]rerere-autoupdate option to merge, revert and friends
Introduce a command line option to override rerere.autoupdate configuration
variable to make it more useful.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-04 00:20:48 -08:00
Thomas Rast 0721c314a5 Use die_errno() instead of die() when checking syscalls
Lots of die() calls did not actually report the kind of error, which
can leave the user confused as to the real problem.  Use die_errno()
where we check a system/library call that sets errno on failure, or
one of the following that wrap such calls:

  Function              Passes on error from
  --------              --------------------
  odb_pack_keep         open
  read_ancestry         fopen
  read_in_full          xread
  strbuf_read           xread
  strbuf_read_file      open or strbuf_read_file
  strbuf_readlink       readlink
  write_in_full         xwrite

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 11:14:53 -07:00
Junio C Hamano f9275c68af Merge branch 'sb/opt-filename'
* sb/opt-filename:
  parse-opts: add OPT_FILENAME and transition builtins
  parse-opts: prepare for OPT_FILENAME

Conflicts:
	builtin-log.c
2009-05-31 16:57:42 -07:00
Stephen Boyd 3778292017 parse-opts: prepare for OPT_FILENAME
To give OPT_FILENAME the prefix, we pass the prefix to parse_options()
which passes the prefix to parse_options_start() which sets the prefix
member of parse_opts_ctx accordingly. If there isn't a prefix in the
calling context, passing NULL will suffice.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 01:07:25 -07:00
Brandon Casey 330db18c02 Use 'UTF-8' rather than 'utf-8' everywhere for backward compatibility
Some ancient platforms (Solaris 7, IRIX 6.5) do not understand 'utf-8', but
all tested implementations understand 'UTF-8'.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-18 20:53:12 -07:00
Junio C Hamano 9a6682bab5 Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  builtin-revert.c: release index lock when cherry-picking an empty commit
2009-03-07 21:00:27 -08:00
Chris Johnsen 0d66e95903 builtin-revert.c: release index lock when cherry-picking an empty commit
When a cherry-pick of an empty commit is done, release the lock
held on the index.

The fix is the same as was applied to similar code in 4271666046.

Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07 12:21:45 -08:00
Stephan Beyer 75f3ff2eea Generalize and libify index_is_dirty() to index_differs_from(...)
index_is_dirty() in builtin-revert.c checks if the index is dirty.
This patch generalizes this function to check if the index differs
from a revision, i.e. the former index_is_dirty() behavior can now be
achieved by index_differs_from("HEAD", 0).

The second argument "diff_flags" allows to set further diff option
flags like DIFF_OPT_IGNORE_SUBMODULES. See DIFF_OPT_* macros in diff.h
for a list.

index_differs_from() seems to be useful for more than builtin-revert.c,
so it is moved into diff-lib.c and also used in builtin-commit.c.

Yet to mention:

 - "rev.abbrev = 0;" can be safely removed.
   This has no impact on performance or functioning of neither
   setup_revisions() nor run_diff_index().

 - rev.pending.objects is free()d because this fixes a leak.
   (Also see 295dd2ad "Fix memory leak in traverse_commit_list")

Mentored-by: Daniel Barkalow <barkalow@iabervon.org>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-10 22:25:39 -08:00
Robin Rosenberg d5be89d8ad git-revert: record the parent against which a revert was made
As described in Documentation/howto/revert-a-faulty-merge.txt, re-merging
from a previously reverted a merge of a side branch may need a revert of
the revert beforehand.  Record against which parent the revert was made in
the commit, so that later the user can figure out what went on.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-21 18:32:04 -08:00
Junio C Hamano a1a846a19e Merge branch 'ar/mksnpath'
* ar/mksnpath:
  Use git_pathdup instead of xstrdup(git_path(...))
  git_pathdup: returns xstrdup-ed copy of the formatted path
  Fix potentially dangerous use of git_path in ref.c
  Add git_snpath: a .git path formatting routine with output buffer
  Fix potentially dangerous uses of mkpath and git_path
  Fix potentially dangerous uses of mkpath and git_path
  Fix mkpath abuse in dwim_ref and dwim_log of sha1_name.c
  Add mksnpath which allows you to specify the output buffer

Conflicts:
	builtin-revert.c
2008-11-05 11:35:53 -08:00
Junio C Hamano 933bb3ae5e Merge branch 'maint'
* maint:
  git-svn: change dashed git-commit-tree to git commit-tree
  Documentation: clarify information about 'ident' attribute
  bash completion: add doubledash to "git show"
  Use test-chmtime -v instead of perl in t5000 to get mtime of a file
  Add --verbose|-v to test-chmtime
  asciidoc: add minor workaround to add an empty line after code blocks
  Plug a memleak in builtin-revert
  Add file delete/create info when we overflow rename_limit
  Install git-cvsserver in $(bindir)
  Install git-shell in bindir, too
2008-10-31 01:42:58 -07:00
Junio C Hamano 98b35e2c74 Merge branch 'ar/maint-mksnpath' into ar/mksnpath
* ar/maint-mksnpath:
  Use git_pathdup instead of xstrdup(git_path(...))
  git_pathdup: returns xstrdup-ed copy of the formatted path
  Fix potentially dangerous use of git_path in ref.c
  Add git_snpath: a .git path formatting routine with output buffer

Conflicts:
	builtin-revert.c
	refs.c
	rerere.c
2008-10-30 18:08:58 -07:00
Alex Riesen a4f34cbb4c Use git_pathdup instead of xstrdup(git_path(...))
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-30 17:52:24 -07:00
Alex Riesen d258b25887 Plug a memleak in builtin-revert
Probably happened when working around git_path's problem with returned
buffer being reused.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-30 14:01:00 -07:00
Junio C Hamano a157400c97 Merge branch 'jc/maint-co-track'
* jc/maint-co-track:
  Enhance hold_lock_file_for_{update,append}() API
  demonstrate breakage of detached checkout with symbolic link HEAD
  Fix "checkout --track -b newbranch" on detached HEAD

Conflicts:
	builtin-commit.c
2008-10-21 17:58:11 -07:00
Junio C Hamano acd3b9eca8 Enhance hold_lock_file_for_{update,append}() API
This changes the "die_on_error" boolean parameter to a mere "flags", and
changes the existing callers of hold_lock_file_for_update/append()
functions to pass LOCK_DIE_ON_ERROR.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-19 12:35:37 -07:00
Miklos Vajna 6eb1b43793 cherry-pick/revert: make direct internal call to merge_tree()
Refactored merge-recursive interface may still not be ideal but it already
allows us to make a direct call to merge_tree().

One regression is that the status message is lost as there is no way to
flush them from outside the refactored library code yet.

[jc: initial version by Miklos, with moderate amount of fixup by me]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-02 17:03:01 -07:00
Abhijit Menon-Sen aa1a0111cc Make cherry-pick use rerere for conflict resolution.
Cherry-picking can be helped by reusing previous confliction
resolution by invoking rerere automatically.

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 16:42:49 -07:00
Junio C Hamano 2b603260f3 Merge branch 'maint' 2008-08-01 23:55:51 -07:00
Stephan Beyer 1e5f7add98 builtin-revert.c: typofix
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-01 21:10:40 -07:00
Junio C Hamano 588c038ac6 Merge branch 'sb/dashless'
* sb/dashless:
  Make usage strings dash-less
  t/: Use "test_must_fail git" instead of "! git"
  t/test-lib.sh: exit with small negagive int is ok with test_must_fail

Conflicts:
	builtin-blame.c
	builtin-mailinfo.c
	builtin-mailsplit.c
	builtin-shortlog.c
	git-am.sh
	t/t4150-am.sh
	t/t4200-rerere.sh
2008-07-16 17:22:50 -07:00
Stephan Beyer 1b1dd23f2d Make usage strings dash-less
When you misuse a git command, you are shown the usage string.
But this is currently shown in the dashed form.  So if you just
copy what you see, it will not work, when the dashed form
is no longer supported.

This patch makes git commands show the dash-less version.

For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
generates a dash-less usage string now.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 14:12:48 -07:00
Johannes Schindelin f95ebf7429 Allow cherry-picking root commits
A root commit couldn't be cherry-picked.  But its semantics can be
defined as simply merging two trees by overlaying disjoint parts
and merging overlapping files without any common ancestor.  You
should be able to rebase originally independent branches on top of
another branch by using this.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-07 13:23:42 -07:00
Johannes Schindelin ef90d6d420 Provide git_config with a callback-data parameter
git_config() only had a function parameter, but no callback data
parameter.  This assumes that all callback functions only modify
global variables.

With this patch, every callback gets a void * parameter, and it is hoped
that this will help the libification effort.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-14 12:34:44 -07:00
Dan McGee cfd9c27708 Allow cherry-pick (and revert) to add signoff line
I often find myself pulling patches off of other peoples trees using
cherry-pick, and following it with an immediate 'git commit --amend -s'
command.  Eliminate the need for a double commit by allowing signoff on a
cherry-pick or revert.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-26 14:06:17 -07:00
Junio C Hamano 6b48990354 Merge branch 'maint'
* maint:
  Update draft release notes for 1.5.4.4
  revert: actually check for a dirty index
  tests: introduce test_must_fail
  git-submodule: Fix typo 'url' which should be '$url'
  receive-pack: Initialize PATH to include exec-dir.

Conflicts:

	builtin-revert.c
2008-03-02 23:59:50 -08:00
Jeff King 0f2d4476c1 revert: actually check for a dirty index
The previous code mistakenly used wt_status_prepare to check whether the
index had anything commitable in it; however, that function is just an
init function, and will never report a dirty index.

The correct way with wt_status_* would be to call wt_status_print with the
output pointing to /dev/null or similar. However, that does extra work by
both examining the working tree and spewing status information to nowhere.

Instead, let's just implement the useful subset of wt_status_print as an
"is_index_dirty" function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-02 23:33:59 -08:00
Jim Meyering 8e0f70033b Avoid unnecessary "if-before-free" tests.
This change removes all obvious useless if-before-free tests.
E.g., it replaces code like this:

        if (some_expression)
                free (some_expression);

with the now-equivalent:

        free (some_expression);

It is equivalent not just because POSIX has required free(NULL)
to work for a long time, but simply because it has worked for
so long that no reasonable porting target fails the test.
Here's some evidence from nearly 1.5 years ago:

    http://www.winehq.org/pipermail/wine-patches/2006-October/031544.html

FYI, the change below was prepared by running the following:

  git ls-files -z | xargs -0 \
  perl -0x3b -pi -e \
    's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(free\s*\(\s*\1\s*\))/$2/s'

Note however, that it doesn't handle brace-enclosed blocks like
"if (x) { free (x); }".  But that's ok, since there were none like
that in git sources.

Beware: if you do use the above snippet, note that it can
produce syntactically invalid C code.  That happens when the
affected "if"-statement has a matching "else".
E.g., it would transform this

  if (x)
    free (x);
  else
    foo ();

into this:

  free (x);
  else
    foo ();

There were none of those here, either.

If you're interested in automating detection of the useless
tests, you might like the useless-if-before-free script in gnulib:
[it *does* detect brace-enclosed free statements, and has a --name=S
 option to make it detect free-like functions with different names]

  http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=build-aux/useless-if-before-free

Addendum:
  Remove one more (in imap-send.c), spotted by Jean-Luc Herren <jlh@gmx.ch>.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-22 14:14:40 -08:00
Junio C Hamano 45525bd022 Make error messages from cherry-pick/revert more sensible
The original "rewrite in C" did somewhat a sloppy job while
stealing code from git-write-tree.

The caller pretends as if the write_tree() function would return
an error code and being able to issue a sensible error message
itself, but write_tree() function just calls die() and never
returns an error.  Worse yet, the function claims that it was
running git-write-tree (which is no longer true after
cherry-pick stole it).

Tested-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-05 00:39:19 -08:00
Brandon Casey 4ed7cd3ab0 Improve use of lockfile API
Remove remaining double close(2)'s.  i.e. close() before
commit_locked_index() or commit_lock_file().

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-16 15:35:35 -08:00
David Symonds 0d8135891e Mention that git-rm can be an appropriate resolution as well as git-add.
Especially when using git-cherry-pick, removing files that are unmerged can be
a logical action. This patch merely changes the informative text to be less
confusing.

Signed-off-by: David Symonds <dsymonds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-30 14:15:08 -08:00
Wincent Colaiuta 804c7174c9 revert/cherry-pick: Allow overriding the help text by the calling Porcelain
A Porcelain command that uses cherry-pick or revert may make a commit
out of resolved index itself, in which case telling the user to commit
the result is not appropriate at all.  This allows GIT_CHERRY_PICK_HELP
environment variable to be set by the calling Porcelain in order to
override the built-in help text.

[jc: this is heavily modified from the original but should be equivalent
 in spirit]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-30 13:55:49 -08:00
Junio C Hamano 757f58ed38 revert/cherry-pick: do not mention the original ref
When you cherry-pick or revert a commit, naming it with an annotated
tag, we added a comment, attempting to repeat what we got from the end
user, to the message.

But this was inconsistent.  When we got "cherry-pick branch", we
recorded the object name (40-letter SHA-1) without saying anything like
"original was 'branch'".  There was no need to.  Also recent rewrite to
use parse-options made it impossible to parrot the original command line
without "unparsing".

This removes the code that implements the misguided "we dereferenced the
tag so record that in the commit message" behaviour.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-25 15:56:55 -08:00
Junio C Hamano fb5fd01148 Merge branch 'maint'
* maint:
  git-clean: honor core.excludesfile
  Documentation: Fix man page breakage with DocBook XSL v1.72
  git-remote.txt: fix typo
  core-tutorial.txt: Fix argument mistake in an example.
  replace reference to git-rm with git-reset in git-commit doc
  Grammar fixes for gitattributes documentation
  Don't allow fast-import tree delta chains to exceed maximum depth
  revert/cherry-pick: allow starting from dirty work tree.
  t/t3404: fix test for a bogus todo file.

Conflicts:

	fast-import.c
2007-11-14 03:37:18 -08:00
Junio C Hamano 71aa2b8f0e Resurrect git-revert.sh example and add comment to builtin-revert.c
I had to scratch my head for quite some time figuring out why we
cannot optimize out write_tree() we do when --no-commit option
is given, whose purpose seem to be only to check if the index is
unmerged, with a simple loop over the active_cache[].

So add a comment to describe why the write_tree() is there, and
resurrect the last scripted version as a reference material in
contrib/example directory with others.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-13 13:45:11 -08:00
Junio C Hamano 245de36f03 revert/cherry-pick: allow starting from dirty work tree.
There is no reason to forbid a dirty work tree when reverting or
cherry-picking a change, as long as the index is clean.

The scripted version used to allow it:

    case "$no_commit" in
    t)
    	# We do not intend to commit immediately.  We just want to
    	# merge the differences in.
    	head=$(git-write-tree) ||
    		die "Your index file is unmerged."
    	;;
    *)
    	head=$(git-rev-parse --verify HEAD) ||
    		die "You do not have a valid HEAD"
    	files=$(git-diff-index --cached --name-only $head) || exit
    	if [ "$files" ]; then
    		die "Dirty index: cannot $me (dirty: $files)"
    	fi
    	;;
    esac

but C rewrite tightened the check, probably by mistake.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-13 13:25:51 -08:00
Junio C Hamano 02273fdbd0 Merge branch 'jc/revert-merge'
* jc/revert-merge:
  cherry-pick/revert -m: add tests
  revert/cherry-pick: work on merge commits as well

Conflicts:

	builtin-revert.c
2007-11-04 01:26:02 -07:00
Junio C Hamano 3d66dc9657 Merge branch 'ph/parseopt'
* ph/parseopt: (24 commits)
  gc: use parse_options
  Fixed a command line option type for builtin-fsck.c
  Make builtin-pack-refs.c use parse_options.
  Make builtin-name-rev.c use parse_options.
  Make builtin-count-objects.c use parse_options.
  Make builtin-fsck.c use parse_options.
  Update manpages to reflect new short and long option aliases
  Make builtin-for-each-ref.c use parse-opts.
  Make builtin-symbolic-ref.c use parse_options.
  Make builtin-update-ref.c use parse_options
  Make builtin-revert.c use parse_options.
  Make builtin-describe.c use parse_options
  Make builtin-branch.c use parse_options.
  Make builtin-mv.c use parse-options
  Make builtin-rm.c use parse_options.
  Port builtin-add.c to use the new option parser.
  parse-options: allow callbacks to take no arguments at all.
  parse-options: Allow abbreviated options when unambiguous
  Add shortcuts for very often used options.
  parse-options: make some arguments optional, add callbacks.
  ...

Conflicts:

	Makefile
	builtin-add.c
2007-11-02 16:42:23 -07:00
Junio C Hamano 9c51414f8e Merge branch 'maint' into HEAD
* maint:
  Update GIT 1.5.3.5 Release Notes
  git-rebase--interactive.sh: Make 3-way merge strategies work for -p.
  git-rebase--interactive.sh: Don't pass a strategy to git-cherry-pick.
  Fix --strategy parsing in git-rebase--interactive.sh
  Make merge-recursive honor diff.renamelimit
  cherry-pick/revert: more compact user direction message
  core-tutorial: Use new syntax for git-merge.
  git-merge: document but discourage the historical syntax
  Prevent send-pack from segfaulting (backport from 'master')
  Documentation/git-cvsexportcommit.txt: s/mgs/msg/ in example

Conflicts:

	git-rebase--interactive.sh
2007-10-30 21:44:43 -07:00
Nicolas Pitre 04bd8e5fea cherry-pick/revert: more compact user direction message
A failed cherry-pick (and friend) currently says:

|Automatic cherry-pick failed.  After resolving the conflicts,
|mark the corrected paths with 'git-add <paths>'
|and commit the result.

This can obviously be displayed on two lines only.
While at it, change "git-add" to "git add".

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-30 16:49:27 -07:00
Pierre Habouzit f81037947c Make builtin-revert.c use parse_options.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-29 21:03:31 -07:00
Junio C Hamano 7791ecbc62 revert/cherry-pick: work on merge commits as well
Usually you cannot revert a merge because you do not know which
side of the merge should be considered the mainline (iow, what
change to reverse).

With this patch, cherry-pick and revert learn -m (--mainline)
option that lets you specify the parent number (starting from 1)
of the mainline, so that you can:

	git revert -m 1 $merge

to reverse the changes introduced by the $merge commit relative
to its first parent, and:

	git cherry-pick -m 2 $merge

to replay the changes introduced by the $merge commit relative
to its second parent.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-26 23:28:28 -07:00