summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--add-patch.c8
-rwxr-xr-xgit-add--interactive.perl7
2 files changed, 15 insertions, 0 deletions
diff --git a/add-patch.c b/add-patch.c
index f899389e2c..64ab7faa96 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1646,6 +1646,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
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index f36c0078ac..d5ef7fc2eb 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1807,6 +1807,13 @@ sub process_args {
$arg = shift @ARGV or die __("missing --");
if ($arg ne '--') {
$patch_mode_revision = $arg;
+
+ # 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.
$patch_mode = ($arg eq 'HEAD' ?
'reset_head' : 'reset_nothead');
$arg = shift @ARGV or die __("missing --");