git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 00/12] add --ff option to cherry-pick

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 1, 2010, 08:48 UTC
Message-ID
<7v635g4ec2.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201003010800.13996.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
Show 14 quoted lines
> On Monday 01 March 2010 04:49:12 Junio C Hamano wrote:
>> Thanks, but this seems to conflict with too many things in flight (it
>> applies cleanly on top of 'pu' but not on top of 'next').
>> 
>> Given that "rebase--interactive", which is the sole in-tree user of
>> cherry-pick, has its own fast-forwarding logic to skip call to it, it
>> seems to take too much time out of me to deal with the code churn for
>> dubious benefit---the series does not seem to solve any real problem.
>> 
>> After other topics have either graduated to 'master' or dropped out of
>> 'pu', things might look differently, though.
>  
> Ok I will wait for something like a week, and then rebase on top of next and 
> resend.

Actually, waiting, rebasing and resending, without any simplification, would be the worst thing you could do. Perhaps the "waiting" time can be used to think how this can be simplified not to be such a big churn.

For example, why wouldn't the core of a "cherry-pick --ff" be something like the attached patch, which obviously does not have "fast_forward_to" yet, but whose implementation should be obvious (the code should already be in "merge --ff" fast forward codepath, although I didn't look)?

 builtin-revert.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/builtin-revert.c b/builtin-revert.c
index eff5268..50a40d3 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -284,8 +284,6 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 	}
 	discard_cache();
 
-	index_fd = hold_locked_index(&index_lock, 1);
-
 	if (!commit->parents) {
 		if (action == REVERT)
 			die ("Cannot revert a root commit");
@@ -314,6 +312,16 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 	else
 		parent = commit->parents->item;
 
+	if (action == CHERRY_PICK && user_asked_fast_forward &&
+	    !no_commit &&
+	    !edit &&
+	    !no_replay
+	    parent &&
+	    !hashcmp(parent->object.sha1, head))
+		return fast_forward_to(parent);
+
+	index_fd = hold_locked_index(&index_lock, 1);
+
 	if (!(message = commit->buffer))
 		die ("Cannot get commit message for %s",
 				sha1_to_hex(commit->object.sha1));
Previous: Christian CouderNext: Christian Couder
Message 17 of 24 in “add --ff option to cherry-pick”
  1. 00/12 add --ff option to cherry-pickChristian Couder, Feb 28, 2010
  2. 01/12 revert: libify cherry-pick and revert functionnalityChristian Couder, Feb 28, 2010
  3. 02/12 pick: refactor checking parent in a check_parent functionChristian Couder, Feb 28, 2010
  4. 03/12 pick: make check_parent function externChristian Couder, Feb 28, 2010
  5. 04/12 pick: move calling check_parent() ouside pick_commit()Christian Couder, Feb 28, 2010
  6. 05/12 reset: refactor updating heads into a static functionChristian Couder, Feb 28, 2010
  7. 06/12 reset: refactor reseting in its own functionChristian Couder, Feb 28, 2010
  8. 07/12 reset: make reset function non static and declare it in "reset.h"Christian Couder, Feb 28, 2010
  9. 08/12 revert: add --ff option to allow fast forward when cherry-pickingChristian Couder, Feb 28, 2010
  10. 09/12 cherry-pick: add tests for new --ff optionChristian Couder, Feb 28, 2010
  11. 10/12 Documentation: describe new cherry-pick --ff optionChristian Couder, Feb 28, 2010
  12. 11/12 cherry-pick: add a no-op --no-ff option to future proof scriptsChristian Couder, Feb 28, 2010
  13. 12/12 rebase -i: use new --ff cherry-pick optionChristian Couder, Feb 28, 2010
  14. Junio C HamanoMar 1, 2010
  15. Daniel BarkalowMar 1, 2010
  16. Christian CouderMar 1, 2010
  17. Junio C HamanoMar 1, 2010
  18. Christian CouderMar 4, 2010
  19. Junio C HamanoMar 4, 2010
  20. Christian CouderMar 4, 2010
  21. Junio C HamanoMar 4, 2010
  22. Jonathan NiederMar 21, 2010
  23. Johannes SixtMar 1, 2010
  24. Paolo BonziniMar 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.