diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-06-02 07:48:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-06-02 07:48:44 -0700 |
commit | 456cb4cf3ef6e3dec637b7061b0c834b62eba0f5 (patch) | |
tree | 193fa9cb1011cc29e72e082e1d3d83cfe65ae841 | |
parent | Merge branch 'rs/maint-grep-word-regexp-fix' into maint (diff) | |
parent | Change xdl_merge to generate output even for null merges (diff) | |
download | tgif-456cb4cf3ef6e3dec637b7061b0c834b62eba0f5.tar.xz |
Merge branch 'cb/maint-1.6.0-xdl-merge-fix' into maint
* cb/maint-1.6.0-xdl-merge-fix:
Change xdl_merge to generate output even for null merges
t6023: merge-file fails to output anything for a degenerate merge
Conflicts:
xdiff/xmerge.c
-rwxr-xr-x | t/t6023-merge-file.sh | 6 | ||||
-rw-r--r-- | xdiff/xmerge.c | 31 |
2 files changed, 21 insertions, 16 deletions
diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index f8942bc890..7dcf391914 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -54,6 +54,12 @@ deduxit me super semitas jusitiae, EOF printf "propter nomen suum." >> new4.txt +test_expect_success 'merge with no changes' ' + cp orig.txt test.txt && + git merge-file test.txt orig.txt orig.txt && + test_cmp test.txt orig.txt +' + cp new1.txt test.txt test_expect_success "merge without conflict" \ "git merge-file test.txt orig.txt new2.txt" diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c index d9737f04c2..1cb65a9516 100644 --- a/xdiff/xmerge.c +++ b/xdiff/xmerge.c @@ -563,23 +563,22 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1, return -1; } status = 0; - if (xscr1 || xscr2) { - if (!xscr1) { - result->ptr = xdl_malloc(mf2->size); - memcpy(result->ptr, mf2->ptr, mf2->size); - result->size = mf2->size; - } else if (!xscr2) { - result->ptr = xdl_malloc(mf1->size); - memcpy(result->ptr, mf1->ptr, mf1->size); - result->size = mf1->size; - } else { - status = xdl_do_merge(&xe1, xscr1, name1, - &xe2, xscr2, name2, - flags, xpp, result); - } - xdl_free_script(xscr1); - xdl_free_script(xscr2); + if (!xscr1) { + result->ptr = xdl_malloc(mf2->size); + memcpy(result->ptr, mf2->ptr, mf2->size); + result->size = mf2->size; + } else if (!xscr2) { + result->ptr = xdl_malloc(mf1->size); + memcpy(result->ptr, mf1->ptr, mf1->size); + result->size = mf1->size; + } else { + status = xdl_do_merge(&xe1, xscr1, name1, + &xe2, xscr2, name2, + flags, xpp, result); } + xdl_free_script(xscr1); + xdl_free_script(xscr2); + xdl_free_env(&xe1); xdl_free_env(&xe2); |