From: Junio C Hamano Date: Wed, 5 Oct 2011 19:36:19 +0000 (-0700) Subject: Merge branch 'rr/revert-cherry-pick-continue' X-Git-Tag: v1.7.8-rc0~141 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cd4093b6036af696310b1867e9e916485d53ccf4;p=git.git Merge branch 'rr/revert-cherry-pick-continue' * rr/revert-cherry-pick-continue: builtin/revert.c: make commit_list_append() static revert: Propagate errors upwards from do_pick_commit revert: Introduce --continue to continue the operation revert: Don't implicitly stomp pending sequencer operation revert: Remove sequencer state when no commits are pending reset: Make reset remove the sequencer state revert: Introduce --reset to remove sequencer state revert: Make pick_commits functionally act on a commit list revert: Save command-line options for continuing operation revert: Save data for continuing after conflict resolution revert: Don't create invalid replay_opts in parse_args revert: Separate cmdline parsing from functional code revert: Introduce struct to keep command-line options revert: Eliminate global "commit" variable revert: Rename no_replay to record_origin revert: Don't check lone argument in get_encoding revert: Simplify and inline add_message_to_msg config: Introduce functions to write non-standard file advice: Introduce error_resolve_conflict --- cd4093b6036af696310b1867e9e916485d53ccf4 diff --cc Documentation/git-cherry-pick.txt index 7cfa3d92a,663186bda..2660a842f --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@@ -7,8 -7,9 +7,10 @@@ git-cherry-pick - Apply the changes int SYNOPSIS -------- +[verse] 'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] ... + 'git cherry-pick' --reset + 'git cherry-pick' --continue DESCRIPTION ----------- @@@ -110,9 -111,13 +112,13 @@@ effect to your index in a row Pass the merge strategy-specific option through to the merge strategy. See linkgit:git-merge[1] for details. + SEQUENCER SUBCOMMANDS + --------------------- + include::sequencer.txt[] + EXAMPLES -------- -git cherry-pick master:: +`git cherry-pick master`:: Apply the change introduced by the commit at the tip of the master branch and create a new commit with this change. diff --cc Documentation/git-revert.txt index b311d59c7,9be2fe2b2..f3519413e --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@@ -7,8 -7,9 +7,10 @@@ git-revert - Revert some existing commi SYNOPSIS -------- +[verse] 'git revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] ... + 'git revert' --reset + 'git revert' --continue DESCRIPTION ----------- @@@ -91,9 -92,13 +93,13 @@@ effect to your index in a row Pass the merge strategy-specific option through to the merge strategy. See linkgit:git-merge[1] for details. + SEQUENCER SUBCOMMANDS + --------------------- + include::sequencer.txt[] + EXAMPLES -------- -git revert HEAD~3:: +`git revert HEAD~3`:: Revert the changes specified by the fourth last commit in HEAD and create a new commit with the reverted changes. diff --cc builtin/revert.c index 3117776c2,8409f4c88..ba27cf15e --- a/builtin/revert.c +++ b/builtin/revert.c @@@ -258,28 -339,28 +339,23 @@@ static void write_message(struct strbu static struct tree *empty_tree(void) { - struct tree *tree = xcalloc(1, sizeof(struct tree)); - - tree->object.parsed = 1; - tree->object.type = OBJ_TREE; - pretend_sha1_file(NULL, 0, OBJ_TREE, tree->object.sha1); - return tree; + return lookup_tree((const unsigned char *)EMPTY_TREE_SHA1_BIN); } - static NORETURN void die_dirty_index(const char *me) + static int error_dirty_index(struct replay_opts *opts) { - if (read_cache_unmerged()) { - die_resolve_conflict(me); - } else { - if (advice_commit_before_merge) { - if (action == REVERT) - die(_("Your local changes would be overwritten by revert.\n" - "Please, commit your changes or stash them to proceed.")); - else - die(_("Your local changes would be overwritten by cherry-pick.\n" - "Please, commit your changes or stash them to proceed.")); - } else { - if (action == REVERT) - die(_("Your local changes would be overwritten by revert.\n")); - else - die(_("Your local changes would be overwritten by cherry-pick.\n")); - } - } + if (read_cache_unmerged()) + return error_resolve_conflict(action_name(opts)); + + /* Different translation strings for cherry-pick and revert */ + if (opts->action == CHERRY_PICK) + error(_("Your local changes would be overwritten by cherry-pick.")); + else + error(_("Your local changes would be overwritten by revert.")); + + if (advice_commit_before_merge) + advise(_("Commit your changes or stash them to proceed.")); + return -1; } static int fast_forward_to(const unsigned char *to, const unsigned char *from)