Skip to content

Commit

Permalink
"git-merge": allow fast-forwarding in a stat-dirty tree
Browse files Browse the repository at this point in the history
We used to refresh the index to clear stat-dirtyness before a fast-forward
merge.  Recent C rewrite forgot to do this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Aug 20, 2008
1 parent 25b3d4d commit 9ca8f60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ static int checkout_fast_forward(unsigned char *head, unsigned char *remote)

if (read_cache_unmerged())
die("you need to resolve your current index first");
refresh_cache(REFRESH_QUIET);

fd = hold_locked_index(lock_file, 1);

Expand Down Expand Up @@ -936,7 +937,6 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
hex,
find_unique_abbrev(remoteheads->item->object.sha1,
DEFAULT_ABBREV));
refresh_cache(REFRESH_QUIET);
strbuf_init(&msg, 0);
strbuf_addstr(&msg, "Fast forward");
if (have_message)
Expand Down
10 changes: 10 additions & 0 deletions t/t7600-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -488,4 +488,14 @@ test_expect_success 'merge c1 with c1 and c2' '

test_debug 'gitk --all'

test_expect_success 'merge fast-forward in a dirty tree' '
git reset --hard c0 &&
mv file file1 &&
cat file1 >file &&
rm -f file1 &&
git merge c2
'

test_debug 'gitk --all'

test_done

0 comments on commit 9ca8f60

Please sign in to comment.