summary refs log tree commit diff
path: root/add-patch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-10-27 15:09:50 -0700
committerJunio C Hamano <gitster@pobox.com>2020-10-27 15:09:51 -0700
commitf3cfeb3078ce4af0ac764515795f7e0849a88931 (patch)
tree2c50c6975c647cfe709b5051a14145a93ae9726d /add-patch.c
parent40696c67274305d6258539de5a36649cf833f712 (diff)
parent35166b1fb54d6c3ca0d9150fd766598a2d3d17b2 (diff)
Merge branch 'dl/checkout-p-merge-base'
"git checkout -p A...B [-- <path>]" did not work, even though the
same command without "-p" correctly used the merge-base between
commits A and B.

* dl/checkout-p-merge-base:
  t2016: add a NEEDSWORK about the PERL prerequisite
  add-patch: add NEEDSWORK about comparing commits
  Doc: document "A...B" form for <tree-ish> in checkout and switch
  builtin/checkout: fix `git checkout -p HEAD...` bug
Diffstat (limited to 'add-patch.c')
-rw-r--r--add-patch.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/add-patch.c b/add-patch.c
index bd94bd3a7c..be4cf6e9e5 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1695,6 +1695,14 @@ int run_add_p(struct repository *r, enum add_p_mode mode,
 	if (mode == ADD_P_STASH)
 		s.mode = &patch_mode_stash;
 	else if (mode == ADD_P_RESET) {
+		/*
+		 * NEEDSWORK: Instead of comparing to the literal "HEAD",
+		 * compare the commit objects instead so that other ways of
+		 * saying the same thing (such as "@") are also handled
+		 * appropriately.
+		 *
+		 * This applies to the cases below too.
+		 */
 		if (!revision || !strcmp(revision, "HEAD"))
 			s.mode = &patch_mode_reset_head;
 		else