Skip to content

Commit

Permalink
Merge branch 'rr/revert-cherry-pick-continue'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Oct 5, 2011
2 parents 821b315 + fb3198c commit cd4093b
Show file tree
Hide file tree
Showing 14 changed files with 960 additions and 171 deletions.
6 changes: 6 additions & 0 deletions Documentation/git-cherry-pick.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ SYNOPSIS
--------
[verse]
'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...
'git cherry-pick' --reset
'git cherry-pick' --continue

DESCRIPTION
-----------
Expand Down Expand Up @@ -110,6 +112,10 @@ 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`::
Expand Down
6 changes: 6 additions & 0 deletions Documentation/git-revert.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ SYNOPSIS
--------
[verse]
'git revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>...
'git revert' --reset
'git revert' --continue

DESCRIPTION
-----------
Expand Down Expand Up @@ -91,6 +93,10 @@ 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`::
Expand Down
9 changes: 9 additions & 0 deletions Documentation/sequencer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--reset::
Forget about the current operation in progress. Can be used
to clear the sequencer state after a failed cherry-pick or
revert.

--continue::
Continue the operation in progress using the information in
'.git/sequencer'. Can be used to continue after resolving
conflicts in a failed cherry-pick or revert.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ LIB_H += rerere.h
LIB_H += resolve-undo.h
LIB_H += revision.h
LIB_H += run-command.h
LIB_H += sequencer.h
LIB_H += sha1-array.h
LIB_H += sha1-lookup.h
LIB_H += sideband.h
Expand Down Expand Up @@ -664,6 +665,7 @@ LIB_OBJS += revision.o
LIB_OBJS += run-command.o
LIB_OBJS += server-info.o
LIB_OBJS += setup.o
LIB_OBJS += sequencer.o
LIB_OBJS += sha1-array.o
LIB_OBJS += sha1-lookup.o
LIB_OBJS += sha1_file.o
Expand Down
31 changes: 24 additions & 7 deletions advice.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ static struct {
{ "detachedhead", &advice_detached_head },
};

void advise(const char *advice, ...)
{
va_list params;

va_start(params, advice);
vreportf("hint: ", advice, params);
va_end(params);
}

int git_default_advice_config(const char *var, const char *value)
{
const char *k = skip_prefix(var, "advice.");
Expand All @@ -34,16 +43,24 @@ int git_default_advice_config(const char *var, const char *value)
return 0;
}

void NORETURN die_resolve_conflict(const char *me)
int error_resolve_conflict(const char *me)
{
if (advice_resolve_conflict)
error("'%s' is not possible because you have unmerged files.", me);
if (advice_resolve_conflict) {
/*
* Message used both when 'git commit' fails and when
* other commands doing a merge do.
*/
die("'%s' is not possible because you have unmerged files.\n"
"Please, fix them up in the work tree, and then use 'git add/rm <file>' as\n"
"appropriate to mark resolution and make a commit, or use 'git commit -a'.", me);
else
die("'%s' is not possible because you have unmerged files.", me);
advise("Fix them up in the work tree,");
advise("and then use 'git add/rm <file>' as");
advise("appropriate to mark resolution and make a commit,");
advise("or use 'git commit -a'.");
}
return -1;
}

void NORETURN die_resolve_conflict(const char *me)
{
error_resolve_conflict(me);
die("Exiting because of an unresolved conflict.");
}
3 changes: 2 additions & 1 deletion advice.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ extern int advice_implicit_identity;
extern int advice_detached_head;

int git_default_advice_config(const char *var, const char *value);

void advise(const char *advice, ...);
int error_resolve_conflict(const char *me);
extern void NORETURN die_resolve_conflict(const char *me);

#endif /* ADVICE_H */
2 changes: 2 additions & 0 deletions branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "refs.h"
#include "remote.h"
#include "commit.h"
#include "sequencer.h"

struct tracking {
struct refspec spec;
Expand Down Expand Up @@ -245,4 +246,5 @@ void remove_branch_state(void)
unlink(git_path("MERGE_MSG"));
unlink(git_path("MERGE_MODE"));
unlink(git_path("SQUASH_MSG"));
remove_sequencer_state(0);
}
Loading

0 comments on commit cd4093b

Please sign in to comment.