* [PATCH 0/2] Fix multiple file rename across D/F conflict
@ 2010-08-17 23:53 Elijah Newren
2010-08-17 23:53 ` [PATCH 1/2] t6031: Add a testcase covering multiple renames across a " Elijah Newren
2010-08-17 23:53 ` [PATCH 2/2] merge-recursive: Fix multiple file rename across " Elijah Newren
0 siblings, 2 replies; 6+ messages in thread
From: Elijah Newren @ 2010-08-17 23:53 UTC (permalink / raw)
To: git; +Cc: gitster, Elijah Newren
Another D/F conflict not fixed by the en/d-f-conflict-fix series in next
was found in the wild, involving multiple file renames across a D/F
conflict. That series would have fixed this case too, were it not for
a stupid simple bug. Fix it, and add a testcase for good measure.
This series is on top of next; it needs both the en/d-f-conflict-fix
series and the testcase requires em/checkout-orphan.
Elijah Newren (2):
t6031: Add a testcase covering multiple renames across a D/F conflict
merge-recursive: Fix triple file rename across D/F conflict
merge-recursive.c | 1 +
t/t6031-merge-recursive.sh | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
--
1.7.2.1.227.g086c8
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] t6031: Add a testcase covering multiple renames across a D/F conflict
2010-08-17 23:53 [PATCH 0/2] Fix multiple file rename across D/F conflict Elijah Newren
@ 2010-08-17 23:53 ` Elijah Newren
2010-08-17 23:53 ` [PATCH 2/2] merge-recursive: Fix multiple file rename across " Elijah Newren
1 sibling, 0 replies; 6+ messages in thread
From: Elijah Newren @ 2010-08-17 23:53 UTC (permalink / raw)
To: git; +Cc: gitster, Elijah Newren
Signed-off-by: Elijah Newren <newren@gmail.com>
---
t/t6031-merge-recursive.sh | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/t/t6031-merge-recursive.sh b/t/t6031-merge-recursive.sh
index 8a3304f..aa235b9 100755
--- a/t/t6031-merge-recursive.sh
+++ b/t/t6031-merge-recursive.sh
@@ -57,4 +57,32 @@ test_expect_success FILEMODE 'verify executable bit on file' '
test -x file2
'
+test_expect_failure 'merging with triple rename across D/F conflict' '
+ git reset --hard HEAD &&
+ git checkout --orphan main &&
+ git rm -rf . &&
+
+ echo "just a file" > sub1 &&
+ mkdir -p sub2 &&
+ echo content > sub2/file1 &&
+ echo content > sub2/file2 &&
+ echo content > sub2/file3 &&
+ mkdir simple &&
+ echo base > simple/bar &&
+ git add -A &&
+ git commit -m base &&
+
+ git checkout -b other &&
+ echo more >> simple/bar &&
+ git commit -a -m changesimplefile &&
+
+ git checkout main &&
+ git rm sub1 &&
+ git mv sub2 sub1 &&
+ git commit -m changefiletodir &&
+
+ git merge other
+'
+
+
test_done
--
1.7.2.1.227.g086c8
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] merge-recursive: Fix multiple file rename across D/F conflict
2010-08-17 23:53 [PATCH 0/2] Fix multiple file rename across D/F conflict Elijah Newren
2010-08-17 23:53 ` [PATCH 1/2] t6031: Add a testcase covering multiple renames across a " Elijah Newren
@ 2010-08-17 23:53 ` Elijah Newren
2010-08-18 19:00 ` Junio C Hamano
2010-08-18 23:17 ` Junio C Hamano
1 sibling, 2 replies; 6+ messages in thread
From: Elijah Newren @ 2010-08-17 23:53 UTC (permalink / raw)
To: git; +Cc: gitster, Elijah Newren
In 5a2580d (merge_recursive: Fix renames across paths below D/F conflicts
2010-07-09), detection was added for renames across paths involved in a
directory<->file conflict. However, the change accidentally involved
reusing an outer loop index ('i') in an inner loop, changing its values
and causing a slightly different type of breakage for cases where there are
multiple renames across the D/F conflict. Fix by creating a new temporary
variable 'i'.
Signed-off-by: Elijah Newren <newren@gmail.com>
---
I'm really embarrased about this one... :-/
merge-recursive.c | 1 +
t/t6031-merge-recursive.sh | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index af53b2a..f413e9f 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1018,6 +1018,7 @@ static int process_renames(struct merge_options *o,
if (mfi.clean &&
sha_eq(mfi.sha, ren1->pair->two->sha1) &&
mfi.mode == ren1->pair->two->mode) {
+ int i;
/*
* This messaged is part of
* t6022 test. If you change
diff --git a/t/t6031-merge-recursive.sh b/t/t6031-merge-recursive.sh
index aa235b9..25ae637 100755
--- a/t/t6031-merge-recursive.sh
+++ b/t/t6031-merge-recursive.sh
@@ -57,7 +57,7 @@ test_expect_success FILEMODE 'verify executable bit on file' '
test -x file2
'
-test_expect_failure 'merging with triple rename across D/F conflict' '
+test_expect_success 'merging with triple rename across D/F conflict' '
git reset --hard HEAD &&
git checkout --orphan main &&
git rm -rf . &&
--
1.7.2.1.227.g086c8
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] merge-recursive: Fix multiple file rename across D/F conflict
2010-08-17 23:53 ` [PATCH 2/2] merge-recursive: Fix multiple file rename across " Elijah Newren
@ 2010-08-18 19:00 ` Junio C Hamano
2010-08-18 23:17 ` Junio C Hamano
1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2010-08-18 19:00 UTC (permalink / raw)
To: Elijah Newren; +Cc: git
Elijah Newren <newren@gmail.com> writes:
> In 5a2580d (merge_recursive: Fix renames across paths below D/F conflicts
> 2010-07-09), detection was added for renames across paths involved in a
> directory<->file conflict. However, the change accidentally involved
> reusing an outer loop index ('i') in an inner loop, changing its values
> and causing a slightly different type of breakage for cases where there are
> multiple renames across the D/F conflict. Fix by creating a new temporary
> variable 'i'.
>
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
> I'm really embarrased about this one... :-/
I am too ;-) Thanks for a fix.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] merge-recursive: Fix multiple file rename across D/F conflict
2010-08-17 23:53 ` [PATCH 2/2] merge-recursive: Fix multiple file rename across " Elijah Newren
2010-08-18 19:00 ` Junio C Hamano
@ 2010-08-18 23:17 ` Junio C Hamano
2010-08-20 12:47 ` Elijah Newren
1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2010-08-18 23:17 UTC (permalink / raw)
To: Elijah Newren; +Cc: git
Elijah Newren <newren@gmail.com> writes:
> I'm really embarrased about this one... :-/
Let's embarrass you even more ;-)
After 5a2580d, the merge has become very noisy, and I don't see a good
reason for that change.
With a version of git built from 5a2580d^, for example, merging
sp/fix-smart-http-deadlock-on-error into maint would give me this:
----------------
$ git merge sp/fix-smart-http-deadlock-on-error
Auto-merging remote-curl.c
Merge made by recursive.
remote-curl.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
----------------
With 5a2580d, it has become this:
----------------
$ git merge sp/fix-smart-http-deadlock-on-error
Adding builtin/add.c
Auto-merging remote-curl.c
Merge made by recursive.
remote-curl.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
----------------
And with this patch on top, it will make it a disaster:
----------------
$ git merge sp/fix-smart-http-deadlock-on-error
Adding builtin/add.c
... similar 97 Adding lines omitted ...
Adding gitweb/static/gitweb.js
Auto-merging remote-curl.c
Adding t/lib-t6000.sh
Adding t/t7810-grep.sh
Adding t/t9350-fast-export.sh
Merge made by recursive.
remote-curl.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
----------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] merge-recursive: Fix multiple file rename across D/F conflict
2010-08-18 23:17 ` Junio C Hamano
@ 2010-08-20 12:47 ` Elijah Newren
0 siblings, 0 replies; 6+ messages in thread
From: Elijah Newren @ 2010-08-20 12:47 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, Aug 18, 2010 at 5:17 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Elijah Newren <newren@gmail.com> writes:
>
>> I'm really embarrased about this one... :-/
>
> Let's embarrass you even more ;-)
Mission accomplished. :-/
> After 5a2580d, the merge has become very noisy, and I don't see a good
> reason for that change.
>
> With a version of git built from 5a2580d^, for example, merging
> sp/fix-smart-http-deadlock-on-error into maint would give me this:
>
> ----------------
> $ git merge sp/fix-smart-http-deadlock-on-error
> Auto-merging remote-curl.c
> Merge made by recursive.
> remote-curl.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
> ----------------
>
> With 5a2580d, it has become this:
>
> ----------------
> $ git merge sp/fix-smart-http-deadlock-on-error
> Adding builtin/add.c
> Auto-merging remote-curl.c
> Merge made by recursive.
> remote-curl.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
> ----------------
>
> And with this patch on top, it will make it a disaster:
>
> ----------------
> $ git merge sp/fix-smart-http-deadlock-on-error
> Adding builtin/add.c
> ... similar 97 Adding lines omitted ...
> Adding gitweb/static/gitweb.js
> Auto-merging remote-curl.c
> Adding t/lib-t6000.sh
> Adding t/t7810-grep.sh
> Adding t/t9350-fast-export.sh
> Merge made by recursive.
> remote-curl.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
> ----------------
Ick.
Interestingly, the new paths I added for additional output are not
being triggered here. Rather, "normal" renames are being considered
unprocessed (I had a faulty assumption in the previous patch that a
clean merge would have cleared out the higher stage entries in
dst_entry as a side effect). Because of this, normal renames are
needlessly re-processed in process_entry(), and trigger extra output
as a side-effect. One could work around this by the following patch,
though it'd be better to just avoid the extra reprocessing. I'll
submit a better patch in a minute.
diff --git a/merge-recursive.c b/merge-recursive.c
index 7ac0f57..5ec7f70 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -75,6 +75,7 @@ struct stage_data
unsigned char sha[20];
} stages[4];
unsigned processed:1;
+ unsigned silent:1;
};
static int show(struct merge_options *o, int v)
@@ -1033,9 +1034,11 @@ static int process_renames(struct merge_options *o,
* conflict) that need to be resolved.
*/
for (i = 1; i <= 3; i++) {
if
(!ren1->dst_entry->stages[i].mode)
continue;
ren1->dst_entry->processed = 0;
+ ren1->dst_entry->silent = 1;
break;
}
} else {
@@ -1188,7 +1198,8 @@ static int process_entry(struct merge_options *o,
remove_file(o, 0, path, !a_sha);
return 1; /* Assume clean till processed */
} else {
- output(o, 2, "Adding %s", path);
+ if (!entry->silent)
+ output(o, 2, "Adding %s", path);
update_file(o, 1, sha, mode, path);
}
} else if (a_sha && b_sha) {
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-08-20 12:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-17 23:53 [PATCH 0/2] Fix multiple file rename across D/F conflict Elijah Newren
2010-08-17 23:53 ` [PATCH 1/2] t6031: Add a testcase covering multiple renames across a " Elijah Newren
2010-08-17 23:53 ` [PATCH 2/2] merge-recursive: Fix multiple file rename across " Elijah Newren
2010-08-18 19:00 ` Junio C Hamano
2010-08-18 23:17 ` Junio C Hamano
2010-08-20 12:47 ` Elijah Newren
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).