login
Header Space

 
 

Re: Rebase/cherry-picking idea

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Wincent Colaiuta <win@...>
Cc: Benoit Sigoure <tsuna@...>, Git Mailing List <git@...>
Date: Monday, November 26, 2007 - 8:34 am

El 26/11/2007, a las 12:27, Wincent Colaiuta escribió:


How about something like this? It would obviously be nice if we could  
avoid adding another option to builtin-revert; perhaps when/if git- 
rebase becomes a builtin we can avoid that. The other alternative, and  
probably one I like I bit more, would be to auto-detect that a rebase  
is in progress by looking inside the GIT_DIR, although that would also  
alter the behaviour of manual invocations of git-revert and git-cherry- 
pick during an interactive rebase (do people actually do that?). What  
do you think?

diff --git a/builtin-revert.c b/builtin-revert.c
index a0586f9..36e36c3 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -30,7 +30,7 @@ static const char * const cherry_pick_usage[] = {
  	NULL
  };

-static int edit, no_replay, no_commit, mainline;
+static int edit, no_replay, no_commit, rebasing, mainline;
  static enum { REVERT, CHERRY_PICK } action;
  static struct commit *commit;

@@ -50,6 +50,7 @@ static void parse_args(int argc, const char **argv)
  		OPT_BOOLEAN('e', "edit", &edit, "edit the commit message"),
  		OPT_BOOLEAN('x', NULL, &no_replay, "append commit name when cherry- 
picking"),
  		OPT_BOOLEAN('r', NULL, &noop, "no-op (backward compatibility)"),
+		OPT_BOOLEAN(0, "rebasing", &rebasing, "use rebase mode"),
  		OPT_INTEGER('m', "mainline", &mainline, "parent number"),
  		OPT_END(),
  	};
@@ -352,11 +353,16 @@ static int revert_or_cherry_pick(int argc, const  
char **argv)
  		}
  		if (close(msg_fd) || commit_lock_file(&msg_file) < 0)
  			die ("Error wrapping up %s", defmsg);
+		if (rebasing)
+			message = "run 'git rebase --continue' "
+			    "or 'git rebase --abort'";
+		else
+			message = "commit the result";
  		fprintf(stderr, "Automatic %s failed.  "
  			"After resolving the conflicts,\n"
  			"mark the corrected paths with 'git add <paths>' "
-			"and commit the result.\n", me);
-		if (action == CHERRY_PICK) {
+			"and %s.\n", me, message);
+		if (action == CHERRY_PICK && !rebasing) {
  			fprintf(stderr, "When commiting, use the option "
  				"'-c %s' to retain authorship and message.\n",
  				find_unique_abbrev(commit->object.sha1,
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index bf44b6a..5afb843 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -117,7 +117,7 @@ pick_one () {
  		sha1=$(git rev-parse --short $sha1)
  		output warn Fast forward to $sha1
  	else
-		output git cherry-pick "$@"
+		output git cherry-pick --rebasing "$@"
  	fi
  }

@@ -187,7 +187,7 @@ pick_one_preserving_merges () {
  			fi
  			;;
  		*)
-			output git cherry-pick "$@" ||
+			output git cherry-pick --rebasing "$@" ||
  				die_with_patch $sha1 "Could not pick $sha1"
  			;;
  		esac




-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 5:02 am)
Re: Rebase/cherry-picking idea, Benoit Sigoure, (Mon Nov 26, 5:32 am)
Re: Rebase/cherry-picking idea, Johannes Schindelin, (Mon Nov 26, 9:26 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 7:27 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 8:34 am)
Re: Rebase/cherry-picking idea, Johannes Sixt, (Mon Nov 26, 8:51 am)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Mon Nov 26, 1:26 pm)
Re: Rebase/cherry-picking idea, Shawn O. Pearce, (Mon Nov 26, 9:08 pm)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Mon Nov 26, 9:25 pm)
Re: Rebase/cherry-picking idea, Marco Costalba, (Mon Nov 26, 3:12 pm)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 9:15 am)
Re: Rebase/cherry-picking idea, Johannes Schindelin, (Mon Nov 26, 9:41 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Mon Nov 26, 9:55 am)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Wed Nov 28, 4:06 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Wed Nov 28, 4:52 am)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Wed Nov 28, 5:47 am)
Re: Rebase/cherry-picking idea, Wincent Colaiuta, (Wed Nov 28, 6:04 am)
Re: Rebase/cherry-picking idea, Junio C Hamano, (Wed Nov 28, 2:44 pm)
[PATCH] Replace instances of export VAR=VAL with VAR=VAL; ex..., Johannes Schindelin, (Wed Nov 28, 9:57 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 10:29 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 3:03 pm)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 7:08 pm)
[PATCH v2] Replace instances of export VAR=VAL with VAR=VAL;..., Johannes Schindelin, (Wed Nov 28, 11:56 am)
Re: [PATCH v2] Replace instances of export VAR=VAL with VAR=..., Johannes Schindelin, (Wed Nov 28, 7:05 pm)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Nguyen Thai Ngoc Duy, (Wed Nov 28, 10:19 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 10:27 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Nguyen Thai Ngoc Duy, (Wed Nov 28, 10:27 am)
Re: [PATCH] Replace instances of export VAR=VAL with VAR=VAL..., Johannes Schindelin, (Wed Nov 28, 10:36 am)
Re: Rebase/cherry-picking idea, Benoit Sigoure, (Mon Nov 26, 8:39 am)
speck-geostationary