summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87ca2ea)
raw | patch | inline | side by side (parent: 87ca2ea)
author | Thomas Rast <trast@student.ethz.ch> | |
Sat, 15 Aug 2009 13:56:39 +0000 (15:56 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 15 Aug 2009 17:36:59 +0000 (10:36 -0700) |
In 0392513 (add-interactive: refactor mode hunk handling, 2009-04-16),
we merged the interaction loops for mode changes and hunk staging.
This was fine at the time, because 0beee4c (git-add--interactive:
remove hunk coalescing, 2008-07-02) removed hunk coalescing.
However, in 7a26e65 (Revert "git-add--interactive: remove hunk
coalescing", 2009-05-16), we resurrected it. Since then, the code
would attempt in vain to merge mode changes with diff hunks,
corrupting both in the process.
We add a check to the coalescing loop to ensure it only looks at diff
hunks, thus skipping mode changes.
Noticed-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
we merged the interaction loops for mode changes and hunk staging.
This was fine at the time, because 0beee4c (git-add--interactive:
remove hunk coalescing, 2008-07-02) removed hunk coalescing.
However, in 7a26e65 (Revert "git-add--interactive: remove hunk
coalescing", 2009-05-16), we resurrected it. Since then, the code
would attempt in vain to merge mode changes with diff hunks,
corrupting both in the process.
We add a check to the coalescing loop to ensure it only looks at diff
hunks, thus skipping mode changes.
Noticed-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-add--interactive.perl | patch | blob | history | |
t/t3701-add-interactive.sh | patch | blob | history |
index a06172c69f59391a04b75a3866a3fbcb98a21ba0..e6f93c7c95019473bc9585fc97b20c356bb4b111 100755 (executable)
my ($last_o_ctx, $last_was_dirty);
for (grep { $_->{USE} } @in) {
+ if ($_->{TYPE} ne 'hunk') {
+ push @out, $_;
+ next;
+ }
my $text = $_->{TEXT};
my ($o_ofs) = parse_hunk_header($text->[0]);
if (defined $last_o_ctx &&
index b68141f48ab6ef5b9d2449dfe6750245c794a99d..63940b18934d8fe71110a5a9edc60a7ee09c5f91 100755 (executable)
'
-test_expect_failure FILEMODE 'stage mode and hunk' '
+test_expect_success FILEMODE 'stage mode and hunk' '
git reset --hard &&
echo content >>file &&
chmod +x file &&