Skip to content

Commit f82a9e5

Browse files
Denton-Lgitster
authored andcommitted
add-patch: add NEEDSWORK about comparing commits
The two versions of add-patch has special-casing for the literal revision "HEAD". However, we want to handle other ways of saying "HEAD" in the same way.[0] Add a NEEDSWORK to the add-patch code that does this so that it can be addressed later. [0]: https://lore.kernel.org/git/[email protected]/ Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c693ef7 commit f82a9e5

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

add-patch.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,14 @@ int run_add_p(struct repository *r, enum add_p_mode mode,
16461646
if (mode == ADD_P_STASH)
16471647
s.mode = &patch_mode_stash;
16481648
else if (mode == ADD_P_RESET) {
1649+
/*
1650+
* NEEDSWORK: Instead of comparing to the literal "HEAD",
1651+
* compare the commit objects instead so that other ways of
1652+
* saying the same thing (such as "@") are also handled
1653+
* appropriately.
1654+
*
1655+
* This applies to the cases below too.
1656+
*/
16491657
if (!revision || !strcmp(revision, "HEAD"))
16501658
s.mode = &patch_mode_reset_head;
16511659
else

git-add--interactive.perl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,6 +1807,13 @@ sub process_args {
18071807
$arg = shift @ARGV or die __("missing --");
18081808
if ($arg ne '--') {
18091809
$patch_mode_revision = $arg;
1810+
1811+
# NEEDSWORK: Instead of comparing to the literal "HEAD",
1812+
# compare the commit objects instead so that other ways of
1813+
# saying the same thing (such as "@") are also handled
1814+
# appropriately.
1815+
#
1816+
# This applies to the cases below too.
18101817
$patch_mode = ($arg eq 'HEAD' ?
18111818
'reset_head' : 'reset_nothead');
18121819
$arg = shift @ARGV or die __("missing --");

0 commit comments

Comments
 (0)