Remove uncontested renamed files during merge.
Johannes Schindelin
Acked-byHi,
Quoted 9 lines · Shawn Pearce
Quoted 8 lines · Johannes Schindelin
Quoted 8 lines
merge-recursive.c +0
-0@@ -873,7 +873,7 @@ static int process_renames(struct path_list *a_renames,struct diff_filespec src_other, dst_other;int try_merge, stage = a_renames == renames1 ?3 :2 ;
Quoted 6 lines
Quoted 4 lines
merge-recursive.c static int process_renames(struct path_list *a_renames, · line 876
Quoted 2 lines
merge-recursive.c +1
-1-remove_file (1 , ren1_src,1 ); +remove_file (1 , ren1_src,0 );I _think_ that the "0" should be "!index_only".
Err, actually "
index_only". Since that'sno_wd.
Oops. Correct. My memory starts failing me.
Quoted 2 lines
-->-- corrected patch follows --<--
Remove uncontested renamed files during merge.
Ciao,
Dscho
PATCH 1/1 Remove uncontested renamed files during merge.
Prior to 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae we deleted a file from the working directory during a merge if the file existed in the working directory before the merge started but was renamed by the branch which is being merged in. This broke in 65ac63 as git-merge-recursive did not actually update the working directory on this uncontested rename case.
---
The same repository that spawned my 'Bug in merge-recursive in virtual commit corner case' thread discovered this feature of git-merge-recursive today.
I'm not sure this is the right way to fix the issue, but it does appear to fix the problem and passes both the existing tests and this new one.
merge-recursive.c | 2 +- t/t6024-merge-rename2.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletions(-)
merge-recursive.c +1 -1
@@ -873,7 +873,7 @@ static int process_renames(struct path_list *a_renames,struct diff_filespec src_other, dst_other;int try_merge, stage = a_renames == renames1 ?3 :2 ; -remove_file (1 , ren1_src,1 ); +remove_file (1 , ren1_src,0 );hashcpy (src_other.sha1, ren1->src_entry->stages[stage].sha); src_other.mode = ren1->src_entry->stages[stage].mode;
t/t6024-merge-rename2.sh new file +97 -0
97 lines not on this page · raw message
Quoted 8 lines · Johannes Schindelin
Quoted 8 lines
merge-recursive.c +0
-0@@ -873,7 +873,7 @@ static int process_renames(struct path_list *a_renames,struct diff_filespec src_other, dst_other;int try_merge, stage = a_renames == renames1 ?3 :2 ;
Quoted 4 lines
merge-recursive.c static int process_renames(struct path_list *a_renames, · line 876
Quoted 2 lines
merge-recursive.c +1
-1-remove_file (1 , ren1_src,1 ); +remove_file (1 , ren1_src,0 );I _think_ that the "0" should be "!index_only".
Err, actually "index_only". Since that's no_wd. But yea, you are right, I didn't consider the index_only mode of operation here.
-->-- corrected patch follows --<--
Remove uncontested renamed files during merge.
Prior to 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae we deleted a file from the working directory during a merge if the file existed before the merge started but was renamed by the branch being merged in. This broke in 65ac63 as git-merge-recursive did not actually update the working directory on an uncontested rename.
--- merge-recursive.c | 2 +- t/t6024-merge-rename2.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletions(-)
merge-recursive.c +1 -1
@@ -873,7 +873,7 @@ static int process_renames(struct path_list *a_renames,struct diff_filespec src_other, dst_other;int try_merge, stage = a_renames == renames1 ?3 :2 ; -remove_file (1 , ren1_src,1 ); +remove_file (1 , ren1_src, index_only);hashcpy (src_other.sha1, ren1->src_entry->stages[stage].sha); src_other.mode = ren1->src_entry->stages[stage].mode;
t/t6024-merge-rename2.sh new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
1.4.4.2.g8662
Hi,
Quoted 14 lines · Shawn O. Pearce
Prior to
65ac6e9c3f47807cb603af07a6a9e1a43bc119aewe deleted a file from the working directory during a merge if the file existed in the working directory before the merge started but was renamed by the branch which is being merged in. This broke in 65ac63 as git-merge-recursive did not actually update the working directory on this uncontested rename case.[...]
merge-recursive.c +0
-0
merge-recursive.c static int process_renames(struct path_list *a_renames, · line 876
Quoted 5 lines
merge-recursive.c +1
-1@@ -873,7 +873,7 @@ static int process_renames(struct path_list *a_renames,struct diff_filespec src_other, dst_other;int try_merge, stage = a_renames == renames1 ?3 :2 ; -remove_file (1 , ren1_src,1 ); +remove_file (1 , ren1_src,0 );
I _think_ that the "0" should be "!index_only". After all, these functions are not only called on the virtual merges, but also on the final merge, which indeed should update the working directory. And since it is a rename, the old file has to go.
Ciao,