git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/2] Address recovery failures with directory/file conflicts
@ 2018-07-11  5:18 Elijah Newren
  2018-07-11  5:18 ` [PATCH 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-11  5:18 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

Several "recovery" commands outright fail or do not fully recover
when directory-file conflicts are present.  This includes:
   * git read-tree --reset HEAD
   * git am --skip
   * git am --abort
   * git merge --abort (or git reset --merge)
   * git reset --hard

It turns out that multiple invocations of 'git reset --hard' can serve as
a functional workaround, but I've been annoyed with that workaround for
years.  This time, I found the problem, and this patch series provides a
fix for all of these.


Elijah Newren (2):
  t1015: demonstrate directory/file conflict recovery failures
  read-cache: fix directory/file conflict handling in read_index_unmerged()

 read-cache.c                         |  13 +--
 t/t1015-read-index-unmerged.sh       | 123 +++++++++++++++++++++++++++
 t/t6020-merge-df.sh                  |   3 -
 t/t6042-merge-rename-corner-cases.sh |   1 -
 4 files changed, 131 insertions(+), 9 deletions(-)
 create mode 100755 t/t1015-read-index-unmerged.sh

-- 
2.18.0.138.g557c5d94c.dirty


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/2] t1015: demonstrate directory/file conflict recovery failures
  2018-07-11  5:18 [PATCH 0/2] Address recovery failures with directory/file conflicts Elijah Newren
@ 2018-07-11  5:18 ` Elijah Newren
  2018-07-11  9:21   ` Eric Sunshine
  2018-07-11  5:18 ` [PATCH 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() Elijah Newren
  2018-07-13 16:33 ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
  2 siblings, 1 reply; 14+ messages in thread
From: Elijah Newren @ 2018-07-11  5:18 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

Several "recovery" commands outright fail or do not fully recover
when directory-file conflicts are present.  This includes:
  * git read-tree --reset HEAD
  * git am --skip
  * git am --abort
  * git merge --abort
  * git reset --hard

Add testcases documenting these shortcomings.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t1015-read-index-unmerged.sh | 123 +++++++++++++++++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100755 t/t1015-read-index-unmerged.sh

diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
new file mode 100755
index 000000000..bbd64587c
--- /dev/null
+++ b/t/t1015-read-index-unmerged.sh
@@ -0,0 +1,123 @@
+#!/bin/sh
+
+test_description='Test various callers of read_index_unmerged'
+. ./test-lib.sh
+
+test_expect_success 'setup modify/delete + directory/file conflict' '
+	test_create_repo df_plus_modify_delete &&
+	(
+		cd df_plus_modify_delete &&
+
+		printf "a\nb\nc\nd\ne\nf\ng\nh\n" >letters &&
+		git add letters &&
+		git commit -m initial &&
+
+		git checkout -b modify &&
+		# Throw in letters.txt for sorting order fun
+		# ("letters.txt" sorts between "letters" and "letters/file")
+		echo i >>letters &&
+		echo "version 2" >letters.txt &&
+		git add letters letters.txt &&
+		git commit -m modified &&
+
+		git checkout -b delete HEAD^ &&
+		git rm letters &&
+		mkdir letters &&
+		>letters/file &&
+		echo "version 1" >letters.txt &&
+		git add letters letters.txt &&
+		git commit -m deleted
+	)
+'
+
+test_expect_failure 'read-tree --reset cleans unmerged entries' '
+	test_when_finished "git -C df_plus_modify_delete clean -f" &&
+	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
+	(
+		cd df_plus_modify_delete &&
+
+		git checkout delete^0 &&
+		test_must_fail git merge modify &&
+
+		git read-tree --reset HEAD &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_expect_failure 'One reset --hard cleans unmerged entries' '
+	test_when_finished "git -C df_plus_modify_delete clean -f" &&
+	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
+	(
+		cd df_plus_modify_delete &&
+
+		git checkout delete^0 &&
+		test_must_fail git merge modify &&
+
+		git reset --hard &&
+		test_path_is_missing .git/MERGE_HEAD &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_expect_success 'setup directory/file conflict + simple edit/edit' '
+	test_create_repo df_plus_edit_edit &&
+	(
+		cd df_plus_edit_edit &&
+
+		test_seq 1 10 >numbers &&
+		git add numbers &&
+		git commit -m initial &&
+
+		git checkout -b d-edit &&
+		mkdir foo &&
+		echo content >foo/bar &&
+		git add foo &&
+		echo 11 >>numbers &&
+		git add numbers &&
+		git commit -m "directory and edit" &&
+
+		git checkout -b f-edit d-edit^1 &&
+		echo content >foo &&
+		git add foo &&
+		echo eleven >>numbers &&
+		git add numbers &&
+		git commit -m "file and edit"
+	)
+'
+
+test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
+	test_when_finished "git -C df_plus_edit_edit clean -f" &&
+	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
+	(
+		cd df_plus_edit_edit &&
+
+		git checkout f-edit^0 &&
+		test_must_fail git merge d-edit^0 &&
+
+		git merge --abort &&
+		test_path_is_missing .git/MERGE_HEAD &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_expect_failure 'git am --skip succeeds despite D/F conflict' '
+	test_when_finished "git -C df_plus_edit_edit clean -f" &&
+	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
+	(
+		cd df_plus_edit_edit &&
+
+		git checkout f-edit^0 &&
+		git format-patch -1 d-edit &&
+		test_must_fail git am -3 0001*.patch &&
+
+		git am --skip &&
+		test_path_is_missing .git/rebase-apply &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_done
-- 
2.18.0.138.g557c5d94c.dirty


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged()
  2018-07-11  5:18 [PATCH 0/2] Address recovery failures with directory/file conflicts Elijah Newren
  2018-07-11  5:18 ` [PATCH 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
@ 2018-07-11  5:18 ` Elijah Newren
  2018-07-11 17:03   ` Junio C Hamano
  2018-07-13 16:33 ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
  2 siblings, 1 reply; 14+ messages in thread
From: Elijah Newren @ 2018-07-11  5:18 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

read_index_unmerged() has two intended purposes:
  * return 1 if there are any unmerged entries, 0 otherwise
  * drops any higher-stage entries down to stage #0

There are several callers of read_index_unmerged() that check the return
value to see if it is non-zero, all of which then die() if that condition
is met.  For these callers, dropping higher-stage entries down to stage #0
is a waste of resources, and returning immediately on first unmerged entry
would be better.  But it's probably only a very minor difference and isn't
the focus of this series.

The remaining callers ignore the return value and call this function for
the side effect of dropping higher-stage entries down to stage #0.  As
mentioned in commit e11d7b596970 ("'reset --merge': fix unmerged case",
2009-12-31),

    The _only_ reason we want to keep a previously unmerged entry in the
    index at stage #0 is so that we don't forget the fact that we have
    corresponding file in the work tree in order to be able to remove it
    when the tree we are resetting to does not have the path.

In fact, prior to commit d1a43f2aa4bf ("reset --hard/read-tree --reset -u:
remove unmerged new paths", 2008-10-15), read_index_unmerged() did just
remove unmerged entries from the cache immediately but that had the
unwanted effect of leaving around new untracked files in the tree from
aborted merges.

So, that's the intended purpose of this function.  The problem is that
when directory/files conflicts are present, trying to add the file to the
index at stage 0 fails (because there is still a directory in the way),
and the function returns early with a -1 return code to signify the error.
As noted above, none of the callers who want the drop-to-stage-0 behavior
check the return status, though, so this means all remaining unmerged
entries remain in the index and the callers proceed assuming otherwise.
Users then see errors of the form:

    error: 'DIR-OR-FILE' appears as both a file and as a directory
    error: DIR-OR-FILE: cannot drop to stage #0

and potentially also messages about other unmerged entries which came
lexicographically later than whatever pathname was both a file and a
directory.  Google finds a few hits searching for those messages,
suggesting there were probably a couple people who hit this besides me.
Luckily, calling `git reset --hard` multiple times would workaround
this bug.

Since the whole purpose here is to just put the entry *temporarily* into
the index so that any associated file in the working copy can be removed,
we can just skip the DFCHECK and allow both the file and directory to
appear in the index.  The temporary simultaneous appearance of the
directory and file entries in the index will be removed by the callers
before they attempt to write the index anywhere.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 read-cache.c                         | 13 ++++++++-----
 t/t1015-read-index-unmerged.sh       |  8 ++++----
 t/t6020-merge-df.sh                  |  3 ---
 t/t6042-merge-rename-corner-cases.sh |  1 -
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index 372588260..666d295a5 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2632,10 +2632,13 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
 
 /*
  * Read the index file that is potentially unmerged into given
- * index_state, dropping any unmerged entries.  Returns true if
- * the index is unmerged.  Callers who want to refuse to work
- * from an unmerged state can call this and check its return value,
- * instead of calling read_cache().
+ * index_state, dropping any unmerged entries to stage #0 (potentially
+ * resulting in a path appearing as both a file and a directory in the
+ * index; the caller is responsible to clear out the extra entries
+ * before writing the index to a tree).  Returns true if the index is
+ * unmerged.  Callers who want to refuse to work from an unmerged
+ * state can call this and check its return value, instead of calling
+ * read_cache().
  */
 int read_index_unmerged(struct index_state *istate)
 {
@@ -2658,7 +2661,7 @@ int read_index_unmerged(struct index_state *istate)
 		new_ce->ce_flags = create_ce_flags(0) | CE_CONFLICTED;
 		new_ce->ce_namelen = len;
 		new_ce->ce_mode = ce->ce_mode;
-		if (add_index_entry(istate, new_ce, 0))
+		if (add_index_entry(istate, new_ce, ADD_CACHE_SKIP_DFCHECK))
 			return error("%s: cannot drop to stage #0",
 				     new_ce->name);
 	}
diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
index bbd64587c..5034ed931 100755
--- a/t/t1015-read-index-unmerged.sh
+++ b/t/t1015-read-index-unmerged.sh
@@ -30,7 +30,7 @@ test_expect_success 'setup modify/delete + directory/file conflict' '
 	)
 '
 
-test_expect_failure 'read-tree --reset cleans unmerged entries' '
+test_expect_success 'read-tree --reset cleans unmerged entries' '
 	test_when_finished "git -C df_plus_modify_delete clean -f" &&
 	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
 	(
@@ -45,7 +45,7 @@ test_expect_failure 'read-tree --reset cleans unmerged entries' '
 	)
 '
 
-test_expect_failure 'One reset --hard cleans unmerged entries' '
+test_expect_success 'One reset --hard cleans unmerged entries' '
 	test_when_finished "git -C df_plus_modify_delete clean -f" &&
 	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
 	(
@@ -87,7 +87,7 @@ test_expect_success 'setup directory/file conflict + simple edit/edit' '
 	)
 '
 
-test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
+test_expect_success 'git merge --abort succeeds despite D/F conflict' '
 	test_when_finished "git -C df_plus_edit_edit clean -f" &&
 	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
 	(
@@ -103,7 +103,7 @@ test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
 	)
 '
 
-test_expect_failure 'git am --skip succeeds despite D/F conflict' '
+test_expect_success 'git am --skip succeeds despite D/F conflict' '
 	test_when_finished "git -C df_plus_edit_edit clean -f" &&
 	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
 	(
diff --git a/t/t6020-merge-df.sh b/t/t6020-merge-df.sh
index 2af1beec5..46b506b3b 100755
--- a/t/t6020-merge-df.sh
+++ b/t/t6020-merge-df.sh
@@ -89,9 +89,6 @@ test_expect_success 'modify/delete + directory/file conflict' '
 '
 
 test_expect_success 'modify/delete + directory/file conflict; other way' '
-	# Yes, we really need the double reset since "letters" appears as
-	# both a file and a directory.
-	git reset --hard &&
 	git reset --hard &&
 	git clean -f &&
 	git checkout modify^0 &&
diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh
index 1cbd946fc..583e68997 100755
--- a/t/t6042-merge-rename-corner-cases.sh
+++ b/t/t6042-merge-rename-corner-cases.sh
@@ -323,7 +323,6 @@ test_expect_success 'rename/directory conflict + content merge conflict' '
 	(
 		cd rename-directory-1 &&
 
-		git reset --hard &&
 		git reset --hard &&
 		git clean -fdqx &&
 
-- 
2.18.0.138.g557c5d94c.dirty


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] t1015: demonstrate directory/file conflict recovery failures
  2018-07-11  5:18 ` [PATCH 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
@ 2018-07-11  9:21   ` Eric Sunshine
  2018-07-11 18:23     ` Elijah Newren
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Sunshine @ 2018-07-11  9:21 UTC (permalink / raw)
  To: Elijah Newren; +Cc: git, gitster

On Tue, Jul 10, 2018 at 10:18:33PM -0700, Elijah Newren wrote:
> Several "recovery" commands outright fail or do not fully recover
> when directory-file conflicts are present.  This includes:
>   * git read-tree --reset HEAD
>   * git am --skip
>   * git am --abort
>   * git merge --abort
>   * git reset --hard
> 
> Add testcases documenting these shortcomings.
> 
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
> diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
> @@ -0,0 +1,123 @@
> +test_expect_success 'setup modify/delete + directory/file conflict' '
> +	test_create_repo df_plus_modify_delete &&
> +	(
> +		cd df_plus_modify_delete &&
> +
> +		printf "a\nb\nc\nd\ne\nf\ng\nh\n" >letters &&

test_write_lines a b c d e f g h >letters &&

> +		git add letters &&
> +		git commit -m initial &&
> +
> +		git checkout -b modify &&
> +		# Throw in letters.txt for sorting order fun
> +		# ("letters.txt" sorts between "letters" and "letters/file")
> +		echo i >>letters &&
> +		echo "version 2" >letters.txt &&
> +		git add letters letters.txt &&
> +		git commit -m modified &&
> +
> +		git checkout -b delete HEAD^ &&
> +		git rm letters &&
> +		mkdir letters &&
> +		>letters/file &&
> +		echo "version 1" >letters.txt &&
> +		git add letters letters.txt &&
> +		git commit -m deleted
> +	)
> +'
> +
> +test_expect_failure 'read-tree --reset cleans unmerged entries' '
> +	test_when_finished "git -C df_plus_modify_delete clean -f" &&
> +	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
> +	(
> +		cd df_plus_modify_delete &&
> +		...
> +	)
> +'

I wonder how much value these distinct repositories add over not using
them:

--- >8 ---
#!/bin/sh

test_description='Test various callers of read_index_unmerged'
. ./test-lib.sh

test_expect_success 'setup modify/delete + directory/file conflict' '
	test_write_lines a b c d e f g h >letters &&
	git add letters &&
	git commit -m initial &&

	git checkout -b modify &&
	# Throw in letters.txt for sorting order fun
	# ("letters.txt" sorts between "letters" and "letters/file")
	echo i >>letters &&
	echo "version 2" >letters.txt &&
	git add letters letters.txt &&
	git commit -m modified &&

	git checkout -b delete HEAD^ &&
	git rm letters &&
	mkdir letters &&
	>letters/file &&
	echo "version 1" >letters.txt &&
	git add letters letters.txt &&
	git commit -m deleted
'

test_expect_failure 'read-tree --reset cleans unmerged entries' '
	test_when_finished "git clean -f" &&
	test_when_finished "git reset --hard" &&

	git checkout delete^0 &&
	test_must_fail git merge modify &&

	git read-tree --reset HEAD &&
	git ls-files -u >conflicts &&
	test_must_be_empty conflicts
'

test_expect_failure 'One reset --hard cleans unmerged entries' '
	test_when_finished "git clean -f" &&
	test_when_finished "git reset --hard" &&

	git checkout delete^0 &&
	test_must_fail git merge modify &&

	git reset --hard &&
	test_path_is_missing .git/MERGE_HEAD &&
	git ls-files -u >conflicts &&
	test_must_be_empty conflicts
'

test_expect_success 'setup directory/file conflict + simple edit/edit' '
	test_seq 1 10 >numbers &&
	git add numbers &&
	git commit -m initial &&

	git checkout -b d-edit &&
	mkdir foo &&
	echo content >foo/bar &&
	git add foo &&
	echo 11 >>numbers &&
	git add numbers &&
	git commit -m "directory and edit" &&

	git checkout -b f-edit d-edit^1 &&
	echo content >foo &&
	git add foo &&
	echo eleven >>numbers &&
	git add numbers &&
	git commit -m "file and edit"
'

test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
	test_when_finished "git clean -f" &&
	test_when_finished "git reset --hard" &&

	git checkout f-edit^0 &&
	test_must_fail git merge d-edit^0 &&

	git merge --abort &&
	test_path_is_missing .git/MERGE_HEAD &&
	git ls-files -u >conflicts &&
	test_must_be_empty conflicts
'

test_expect_failure 'git am --skip succeeds despite D/F conflict' '
	test_when_finished "git clean -f" &&
	test_when_finished "git reset --hard" &&

	git checkout f-edit^0 &&
	git format-patch -1 d-edit &&
	test_must_fail git am -3 0001*.patch &&

	git am --skip &&
	test_path_is_missing .git/rebase-apply &&
	git ls-files -u >conflicts &&
	test_must_be_empty conflicts
'

test_done
--- >8 ---

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged()
  2018-07-11  5:18 ` [PATCH 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() Elijah Newren
@ 2018-07-11 17:03   ` Junio C Hamano
  2018-07-11 18:24     ` Elijah Newren
  0 siblings, 1 reply; 14+ messages in thread
From: Junio C Hamano @ 2018-07-11 17:03 UTC (permalink / raw)
  To: Elijah Newren; +Cc: git

Elijah Newren <newren@gmail.com> writes:

>     The _only_ reason we want to keep a previously unmerged entry in the
>     index at stage #0 is so that we don't forget the fact that we have
>     corresponding file in the work tree in order to be able to remove it
>     when the tree we are resetting to does not have the path.
> ...
> So, that's the intended purpose of this function.  The problem is that
> when directory/files conflicts are present, trying to add the file to the
> index at stage 0 fails (because there is still a directory in the way),
> and the function returns early with a -1 return code to signify the error.
> As noted above, none of the callers who want the drop-to-stage-0 behavior
> check the return status, though, so this means all remaining unmerged
> entries remain in the index and the callers proceed assuming otherwise.

Nicely analysed and explained so far.

> ...  The temporary simultaneous appearance of the
> directory and file entries in the index will be removed by the callers
> before they attempt to write the index anywhere.

But this part makes me feel a bit uneasy, as I find this "will be
removed" a bit hand-wavy.  There are two such callers.  "am --skip"
and "reset".  

The former uses am.c::fast_forward_to that calls unpack_trees() to
two-way merge (aka "switch to the other branch") and these entries
with CE_CONFLICTED flag get removed in merged/deleted_entry().

"reset" (all variants) call unpack_trees() on the index prepared
with read_cache_unmerged(), and the unmerged entries that are marked
with CE_CONFLICTED bit get removed the same way.

So perhaps before "before they attempt to", saying "by calling
unpack_trees(), which excludes these unmerged entries marked with
CE_CONFLICTED flag from the resulting index," or something like that
would help uneasy readers?

> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
>  read-cache.c                         | 13 ++++++++-----
>  t/t1015-read-index-unmerged.sh       |  8 ++++----
>  t/t6020-merge-df.sh                  |  3 ---
>  t/t6042-merge-rename-corner-cases.sh |  1 -
>  4 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/read-cache.c b/read-cache.c
> index 372588260..666d295a5 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -2632,10 +2632,13 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
>  
>  /*
>   * Read the index file that is potentially unmerged into given
> - * index_state, dropping any unmerged entries.  Returns true if
> - * the index is unmerged.  Callers who want to refuse to work
> - * from an unmerged state can call this and check its return value,
> - * instead of calling read_cache().
> + * index_state, dropping any unmerged entries to stage #0 (potentially
> + * resulting in a path appearing as both a file and a directory in the
> + * index; the caller is responsible to clear out the extra entries
> + * before writing the index to a tree).  Returns true if the index is
> + * unmerged.  Callers who want to refuse to work from an unmerged
> + * state can call this and check its return value, instead of calling
> + * read_cache().
>   */
>  int read_index_unmerged(struct index_state *istate)
>  {
> @@ -2658,7 +2661,7 @@ int read_index_unmerged(struct index_state *istate)
>  		new_ce->ce_flags = create_ce_flags(0) | CE_CONFLICTED;
>  		new_ce->ce_namelen = len;
>  		new_ce->ce_mode = ce->ce_mode;
> -		if (add_index_entry(istate, new_ce, 0))
> +		if (add_index_entry(istate, new_ce, ADD_CACHE_SKIP_DFCHECK))
>  			return error("%s: cannot drop to stage #0",
>  				     new_ce->name);
>  	}
> diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
> index bbd64587c..5034ed931 100755
> --- a/t/t1015-read-index-unmerged.sh
> +++ b/t/t1015-read-index-unmerged.sh
> @@ -30,7 +30,7 @@ test_expect_success 'setup modify/delete + directory/file conflict' '
>  	)
>  '
>  
> -test_expect_failure 'read-tree --reset cleans unmerged entries' '
> +test_expect_success 'read-tree --reset cleans unmerged entries' '
>  	test_when_finished "git -C df_plus_modify_delete clean -f" &&
>  	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
>  	(
> @@ -45,7 +45,7 @@ test_expect_failure 'read-tree --reset cleans unmerged entries' '
>  	)
>  '
>  
> -test_expect_failure 'One reset --hard cleans unmerged entries' '
> +test_expect_success 'One reset --hard cleans unmerged entries' '
>  	test_when_finished "git -C df_plus_modify_delete clean -f" &&
>  	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
>  	(
> @@ -87,7 +87,7 @@ test_expect_success 'setup directory/file conflict + simple edit/edit' '
>  	)
>  '
>  
> -test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
> +test_expect_success 'git merge --abort succeeds despite D/F conflict' '
>  	test_when_finished "git -C df_plus_edit_edit clean -f" &&
>  	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
>  	(
> @@ -103,7 +103,7 @@ test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
>  	)
>  '
>  
> -test_expect_failure 'git am --skip succeeds despite D/F conflict' '
> +test_expect_success 'git am --skip succeeds despite D/F conflict' '
>  	test_when_finished "git -C df_plus_edit_edit clean -f" &&
>  	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
>  	(
> diff --git a/t/t6020-merge-df.sh b/t/t6020-merge-df.sh
> index 2af1beec5..46b506b3b 100755
> --- a/t/t6020-merge-df.sh
> +++ b/t/t6020-merge-df.sh
> @@ -89,9 +89,6 @@ test_expect_success 'modify/delete + directory/file conflict' '
>  '
>  
>  test_expect_success 'modify/delete + directory/file conflict; other way' '
> -	# Yes, we really need the double reset since "letters" appears as
> -	# both a file and a directory.
> -	git reset --hard &&
>  	git reset --hard &&
>  	git clean -f &&
>  	git checkout modify^0 &&
> diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh
> index 1cbd946fc..583e68997 100755
> --- a/t/t6042-merge-rename-corner-cases.sh
> +++ b/t/t6042-merge-rename-corner-cases.sh
> @@ -323,7 +323,6 @@ test_expect_success 'rename/directory conflict + content merge conflict' '
>  	(
>  		cd rename-directory-1 &&
>  
> -		git reset --hard &&
>  		git reset --hard &&
>  		git clean -fdqx &&

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] t1015: demonstrate directory/file conflict recovery failures
  2018-07-11  9:21   ` Eric Sunshine
@ 2018-07-11 18:23     ` Elijah Newren
  0 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-11 18:23 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Git Mailing List, Junio C Hamano

Hi Eric,

On Wed, Jul 11, 2018 at 2:21 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Tue, Jul 10, 2018 at 10:18:33PM -0700, Elijah Newren wrote:
>> Several "recovery" commands outright fail or do not fully recover
>> when directory-file conflicts are present.  This includes:
>>   * git read-tree --reset HEAD
>>   * git am --skip
>>   * git am --abort
>>   * git merge --abort
>>   * git reset --hard
>>
>> Add testcases documenting these shortcomings.
>>
>> Signed-off-by: Elijah Newren <newren@gmail.com>
>> ---
>> diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
>> @@ -0,0 +1,123 @@
>> +test_expect_success 'setup modify/delete + directory/file conflict' '
>> +     test_create_repo df_plus_modify_delete &&
>> +     (
>> +             cd df_plus_modify_delete &&
>> +
>> +             printf "a\nb\nc\nd\ne\nf\ng\nh\n" >letters &&
>
> test_write_lines a b c d e f g h >letters &&

Copying and modifying an existing testcase, while forgetting to check
for anachronisms, strikes again.  As always, thanks for reviewing and
catching this; I'll fix it up.

>> +             git add letters &&
>> +             git commit -m initial &&
>> +
>> +             git checkout -b modify &&
>> +             # Throw in letters.txt for sorting order fun
>> +             # ("letters.txt" sorts between "letters" and "letters/file")
>> +             echo i >>letters &&
>> +             echo "version 2" >letters.txt &&
>> +             git add letters letters.txt &&
>> +             git commit -m modified &&
>> +
>> +             git checkout -b delete HEAD^ &&
>> +             git rm letters &&
>> +             mkdir letters &&
>> +             >letters/file &&
>> +             echo "version 1" >letters.txt &&
>> +             git add letters letters.txt &&
>> +             git commit -m deleted
>> +     )
>> +'
>> +
>> +test_expect_failure 'read-tree --reset cleans unmerged entries' '
>> +     test_when_finished "git -C df_plus_modify_delete clean -f" &&
>> +     test_when_finished "git -C df_plus_modify_delete reset --hard" &&
>> +     (
>> +             cd df_plus_modify_delete &&
>> +             ...
>> +     )
>> +'
>
> I wonder how much value these distinct repositories add over not using
> them:

In my opinion, that'd be much worse.  Personally, I think we should
move in the opposite direction and try to migrate more of the
testsuite elsewhere towards clearly independent tests.  A huge pet
peeve of mine is that trying to debug a test often requires working
through dozens and dozens of unrelated tests and their setup just to
understand which part of the repository state is related to the test
at hand and which parts can be ignored.  It's happened enough times
that I just intentionally try to make it clear which tests of mine are
independent by making sure they have their own separate repo (and I
used to do a git reset --hard && git clean -fdqx && rm -rf .git && git
init at the beginning of tests).  If folks have a better suggestion
for how to ensure test independence than using test_create_repo, I'm
all ears, but I'm strongly against just adding more files into the
repo than what previous tests did and continuing running from there.
I feel that's especially important for future readers when dealing
with weird edge and corner cases for merges, but I'd really like to
see that clean separation spread throughout the test suite.

> --- >8 ---
> #!/bin/sh
>
> test_description='Test various callers of read_index_unmerged'
> . ./test-lib.sh
>
> test_expect_success 'setup modify/delete + directory/file conflict' '
>         test_write_lines a b c d e f g h >letters &&
>         git add letters &&
>         git commit -m initial &&
>
>         git checkout -b modify &&
>         # Throw in letters.txt for sorting order fun
>         # ("letters.txt" sorts between "letters" and "letters/file")
>         echo i >>letters &&
>         echo "version 2" >letters.txt &&
>         git add letters letters.txt &&
>         git commit -m modified &&
>
>         git checkout -b delete HEAD^ &&
>         git rm letters &&
>         mkdir letters &&
>         >letters/file &&
>         echo "version 1" >letters.txt &&
>         git add letters letters.txt &&
>         git commit -m deleted
> '
>
> test_expect_failure 'read-tree --reset cleans unmerged entries' '
>         test_when_finished "git clean -f" &&
>         test_when_finished "git reset --hard" &&
>
>         git checkout delete^0 &&
>         test_must_fail git merge modify &&
>
>         git read-tree --reset HEAD &&
>         git ls-files -u >conflicts &&
>         test_must_be_empty conflicts
> '
>
> test_expect_failure 'One reset --hard cleans unmerged entries' '
>         test_when_finished "git clean -f" &&
>         test_when_finished "git reset --hard" &&
>
>         git checkout delete^0 &&
>         test_must_fail git merge modify &&
>
>         git reset --hard &&
>         test_path_is_missing .git/MERGE_HEAD &&
>         git ls-files -u >conflicts &&
>         test_must_be_empty conflicts
> '
>
> test_expect_success 'setup directory/file conflict + simple edit/edit' '
>         test_seq 1 10 >numbers &&
>         git add numbers &&
>         git commit -m initial &&
>
>         git checkout -b d-edit &&
>         mkdir foo &&
>         echo content >foo/bar &&
>         git add foo &&
>         echo 11 >>numbers &&
>         git add numbers &&
>         git commit -m "directory and edit" &&
>
>         git checkout -b f-edit d-edit^1 &&
>         echo content >foo &&
>         git add foo &&
>         echo eleven >>numbers &&
>         git add numbers &&
>         git commit -m "file and edit"
> '
>
> test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
>         test_when_finished "git clean -f" &&
>         test_when_finished "git reset --hard" &&
>
>         git checkout f-edit^0 &&
>         test_must_fail git merge d-edit^0 &&
>
>         git merge --abort &&
>         test_path_is_missing .git/MERGE_HEAD &&
>         git ls-files -u >conflicts &&
>         test_must_be_empty conflicts
> '
>
> test_expect_failure 'git am --skip succeeds despite D/F conflict' '
>         test_when_finished "git clean -f" &&
>         test_when_finished "git reset --hard" &&
>
>         git checkout f-edit^0 &&
>         git format-patch -1 d-edit &&
>         test_must_fail git am -3 0001*.patch &&
>
>         git am --skip &&
>         test_path_is_missing .git/rebase-apply &&
>         git ls-files -u >conflicts &&
>         test_must_be_empty conflicts
> '
>
> test_done
> --- >8 ---

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged()
  2018-07-11 17:03   ` Junio C Hamano
@ 2018-07-11 18:24     ` Elijah Newren
  0 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-11 18:24 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Wed, Jul 11, 2018 at 10:03 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Elijah Newren <newren@gmail.com> writes:
>
>>     The _only_ reason we want to keep a previously unmerged entry in the
>>     index at stage #0 is so that we don't forget the fact that we have
>>     corresponding file in the work tree in order to be able to remove it
>>     when the tree we are resetting to does not have the path.
>> ...
>> So, that's the intended purpose of this function.  The problem is that
>> when directory/files conflicts are present, trying to add the file to the
>> index at stage 0 fails (because there is still a directory in the way),
>> and the function returns early with a -1 return code to signify the error.
>> As noted above, none of the callers who want the drop-to-stage-0 behavior
>> check the return status, though, so this means all remaining unmerged
>> entries remain in the index and the callers proceed assuming otherwise.
>
> Nicely analysed and explained so far.
>
>> ...  The temporary simultaneous appearance of the
>> directory and file entries in the index will be removed by the callers
>> before they attempt to write the index anywhere.
>
> But this part makes me feel a bit uneasy, as I find this "will be
> removed" a bit hand-wavy.  There are two such callers.  "am --skip"
> and "reset".
>
> The former uses am.c::fast_forward_to that calls unpack_trees() to
> two-way merge (aka "switch to the other branch") and these entries
> with CE_CONFLICTED flag get removed in merged/deleted_entry().
>
> "reset" (all variants) call unpack_trees() on the index prepared
> with read_cache_unmerged(), and the unmerged entries that are marked
> with CE_CONFLICTED bit get removed the same way.
>
> So perhaps before "before they attempt to", saying "by calling
> unpack_trees(), which excludes these unmerged entries marked with
> CE_CONFLICTED flag from the resulting index," or something like that
> would help uneasy readers?

Makes sense, I'll include that in my re-roll after waiting a little
bit for any further reviews.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 0/2] Address recovery failures with directory/file conflicts
  2018-07-11  5:18 [PATCH 0/2] Address recovery failures with directory/file conflicts Elijah Newren
  2018-07-11  5:18 ` [PATCH 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
  2018-07-11  5:18 ` [PATCH 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() Elijah Newren
@ 2018-07-13 16:33 ` Elijah Newren
  2018-07-13 16:33   ` [PATCH v2 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
                     ` (3 more replies)
  2 siblings, 4 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-13 16:33 UTC (permalink / raw)
  To: gitster; +Cc: git, sunshine, Elijah Newren

This patch series fixes several "recovery" commands that outright fail
or do not fully recover when directory-file conflicts are present.
This includes:
   * git read-tree --reset HEAD
   * git am --skip
   * git am --abort
   * git merge --abort (or git reset --merge)
   * git reset --hard

Changes since v1 (full range-diff below):
  - Make use of test_write_lines, as suggested by Eric.
  - Provide a little more explanation in one of the commit messages, as
    suggested by Junio.

Elijah Newren (2):
  t1015: demonstrate directory/file conflict recovery failures
  read-cache: fix directory/file conflict handling in
    read_index_unmerged()

 read-cache.c                         |  13 +--
 t/t1015-read-index-unmerged.sh       | 123 +++++++++++++++++++++++++++
 t/t6020-merge-df.sh                  |   3 -
 t/t6042-merge-rename-corner-cases.sh |   1 -
 4 files changed, 131 insertions(+), 9 deletions(-)
 create mode 100755 t/t1015-read-index-unmerged.sh

1:  a85e462914 ! 1:  8f53327a8d t1015: demonstrate directory/file conflict recovery failures
    @@ -29,7 +29,7 @@
     +	(
     +		cd df_plus_modify_delete &&
     +
    -+		printf "a\nb\nc\nd\ne\nf\ng\nh\n" >letters &&
    ++		test_write_lines a b c d e f g h >letters &&
     +		git add letters &&
     +		git commit -m initial &&
     +
2:  43d5b0a5ae ! 2:  990a469d44 read-cache: fix directory/file conflict handling in read_index_unmerged()
    @@ -53,7 +53,9 @@
         we can just skip the DFCHECK and allow both the file and directory to
         appear in the index.  The temporary simultaneous appearance of the
         directory and file entries in the index will be removed by the callers
    -    before they attempt to write the index anywhere.
    +    by calling unpack_trees(), which excludes these unmerged entries marked
    +    with CE_CONFLICTED flag from the resulting index, before they attempt to
    +    write the index anywhere.
     
         Signed-off-by: Elijah Newren <newren@gmail.com>
     
-- 
2.18.0.645.g72fe132ec2

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 1/2] t1015: demonstrate directory/file conflict recovery failures
  2018-07-13 16:33 ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
@ 2018-07-13 16:33   ` Elijah Newren
  2018-07-13 16:33   ` [PATCH v2 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() Elijah Newren
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-13 16:33 UTC (permalink / raw)
  To: gitster; +Cc: git, sunshine, Elijah Newren

Several "recovery" commands outright fail or do not fully recover
when directory-file conflicts are present.  This includes:
  * git read-tree --reset HEAD
  * git am --skip
  * git am --abort
  * git merge --abort
  * git reset --hard

Add testcases documenting these shortcomings.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t1015-read-index-unmerged.sh | 123 +++++++++++++++++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100755 t/t1015-read-index-unmerged.sh

diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
new file mode 100755
index 0000000000..32ef6bdcfa
--- /dev/null
+++ b/t/t1015-read-index-unmerged.sh
@@ -0,0 +1,123 @@
+#!/bin/sh
+
+test_description='Test various callers of read_index_unmerged'
+. ./test-lib.sh
+
+test_expect_success 'setup modify/delete + directory/file conflict' '
+	test_create_repo df_plus_modify_delete &&
+	(
+		cd df_plus_modify_delete &&
+
+		test_write_lines a b c d e f g h >letters &&
+		git add letters &&
+		git commit -m initial &&
+
+		git checkout -b modify &&
+		# Throw in letters.txt for sorting order fun
+		# ("letters.txt" sorts between "letters" and "letters/file")
+		echo i >>letters &&
+		echo "version 2" >letters.txt &&
+		git add letters letters.txt &&
+		git commit -m modified &&
+
+		git checkout -b delete HEAD^ &&
+		git rm letters &&
+		mkdir letters &&
+		>letters/file &&
+		echo "version 1" >letters.txt &&
+		git add letters letters.txt &&
+		git commit -m deleted
+	)
+'
+
+test_expect_failure 'read-tree --reset cleans unmerged entries' '
+	test_when_finished "git -C df_plus_modify_delete clean -f" &&
+	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
+	(
+		cd df_plus_modify_delete &&
+
+		git checkout delete^0 &&
+		test_must_fail git merge modify &&
+
+		git read-tree --reset HEAD &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_expect_failure 'One reset --hard cleans unmerged entries' '
+	test_when_finished "git -C df_plus_modify_delete clean -f" &&
+	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
+	(
+		cd df_plus_modify_delete &&
+
+		git checkout delete^0 &&
+		test_must_fail git merge modify &&
+
+		git reset --hard &&
+		test_path_is_missing .git/MERGE_HEAD &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_expect_success 'setup directory/file conflict + simple edit/edit' '
+	test_create_repo df_plus_edit_edit &&
+	(
+		cd df_plus_edit_edit &&
+
+		test_seq 1 10 >numbers &&
+		git add numbers &&
+		git commit -m initial &&
+
+		git checkout -b d-edit &&
+		mkdir foo &&
+		echo content >foo/bar &&
+		git add foo &&
+		echo 11 >>numbers &&
+		git add numbers &&
+		git commit -m "directory and edit" &&
+
+		git checkout -b f-edit d-edit^1 &&
+		echo content >foo &&
+		git add foo &&
+		echo eleven >>numbers &&
+		git add numbers &&
+		git commit -m "file and edit"
+	)
+'
+
+test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
+	test_when_finished "git -C df_plus_edit_edit clean -f" &&
+	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
+	(
+		cd df_plus_edit_edit &&
+
+		git checkout f-edit^0 &&
+		test_must_fail git merge d-edit^0 &&
+
+		git merge --abort &&
+		test_path_is_missing .git/MERGE_HEAD &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_expect_failure 'git am --skip succeeds despite D/F conflict' '
+	test_when_finished "git -C df_plus_edit_edit clean -f" &&
+	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
+	(
+		cd df_plus_edit_edit &&
+
+		git checkout f-edit^0 &&
+		git format-patch -1 d-edit &&
+		test_must_fail git am -3 0001*.patch &&
+
+		git am --skip &&
+		test_path_is_missing .git/rebase-apply &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_done
-- 
2.18.0.645.g72fe132ec2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged()
  2018-07-13 16:33 ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
  2018-07-13 16:33   ` [PATCH v2 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
@ 2018-07-13 16:33   ` Elijah Newren
  2018-07-13 16:45   ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
  2018-07-31 17:12   ` [PATCH v3 " Elijah Newren
  3 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-13 16:33 UTC (permalink / raw)
  To: gitster; +Cc: git, sunshine, Elijah Newren

read_index_unmerged() has two intended purposes:
  * return 1 if there are any unmerged entries, 0 otherwise
  * drops any higher-stage entries down to stage #0

There are several callers of read_index_unmerged() that check the return
value to see if it is non-zero, all of which then die() if that condition
is met.  For these callers, dropping higher-stage entries down to stage #0
is a waste of resources, and returning immediately on first unmerged entry
would be better.  But it's probably only a very minor difference and isn't
the focus of this series.

The remaining callers ignore the return value and call this function for
the side effect of dropping higher-stage entries down to stage #0.  As
mentioned in commit e11d7b596970 ("'reset --merge': fix unmerged case",
2009-12-31),

    The _only_ reason we want to keep a previously unmerged entry in the
    index at stage #0 is so that we don't forget the fact that we have
    corresponding file in the work tree in order to be able to remove it
    when the tree we are resetting to does not have the path.

In fact, prior to commit d1a43f2aa4bf ("reset --hard/read-tree --reset -u:
remove unmerged new paths", 2008-10-15), read_index_unmerged() did just
remove unmerged entries from the cache immediately but that had the
unwanted effect of leaving around new untracked files in the tree from
aborted merges.

So, that's the intended purpose of this function.  The problem is that
when directory/files conflicts are present, trying to add the file to the
index at stage 0 fails (because there is still a directory in the way),
and the function returns early with a -1 return code to signify the error.
As noted above, none of the callers who want the drop-to-stage-0 behavior
check the return status, though, so this means all remaining unmerged
entries remain in the index and the callers proceed assuming otherwise.
Users then see errors of the form:

    error: 'DIR-OR-FILE' appears as both a file and as a directory
    error: DIR-OR-FILE: cannot drop to stage #0

and potentially also messages about other unmerged entries which came
lexicographically later than whatever pathname was both a file and a
directory.  Google finds a few hits searching for those messages,
suggesting there were probably a couple people who hit this besides me.
Luckily, calling `git reset --hard` multiple times would workaround
this bug.

Since the whole purpose here is to just put the entry *temporarily* into
the index so that any associated file in the working copy can be removed,
we can just skip the DFCHECK and allow both the file and directory to
appear in the index.  The temporary simultaneous appearance of the
directory and file entries in the index will be removed by the callers
by calling unpack_trees(), which excludes these unmerged entries marked
with CE_CONFLICTED flag from the resulting index, before they attempt to
write the index anywhere.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 read-cache.c                         | 13 ++++++++-----
 t/t1015-read-index-unmerged.sh       |  8 ++++----
 t/t6020-merge-df.sh                  |  3 ---
 t/t6042-merge-rename-corner-cases.sh |  1 -
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index 372588260e..666d295a5a 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2632,10 +2632,13 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
 
 /*
  * Read the index file that is potentially unmerged into given
- * index_state, dropping any unmerged entries.  Returns true if
- * the index is unmerged.  Callers who want to refuse to work
- * from an unmerged state can call this and check its return value,
- * instead of calling read_cache().
+ * index_state, dropping any unmerged entries to stage #0 (potentially
+ * resulting in a path appearing as both a file and a directory in the
+ * index; the caller is responsible to clear out the extra entries
+ * before writing the index to a tree).  Returns true if the index is
+ * unmerged.  Callers who want to refuse to work from an unmerged
+ * state can call this and check its return value, instead of calling
+ * read_cache().
  */
 int read_index_unmerged(struct index_state *istate)
 {
@@ -2658,7 +2661,7 @@ int read_index_unmerged(struct index_state *istate)
 		new_ce->ce_flags = create_ce_flags(0) | CE_CONFLICTED;
 		new_ce->ce_namelen = len;
 		new_ce->ce_mode = ce->ce_mode;
-		if (add_index_entry(istate, new_ce, 0))
+		if (add_index_entry(istate, new_ce, ADD_CACHE_SKIP_DFCHECK))
 			return error("%s: cannot drop to stage #0",
 				     new_ce->name);
 	}
diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
index 32ef6bdcfa..55d22da32c 100755
--- a/t/t1015-read-index-unmerged.sh
+++ b/t/t1015-read-index-unmerged.sh
@@ -30,7 +30,7 @@ test_expect_success 'setup modify/delete + directory/file conflict' '
 	)
 '
 
-test_expect_failure 'read-tree --reset cleans unmerged entries' '
+test_expect_success 'read-tree --reset cleans unmerged entries' '
 	test_when_finished "git -C df_plus_modify_delete clean -f" &&
 	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
 	(
@@ -45,7 +45,7 @@ test_expect_failure 'read-tree --reset cleans unmerged entries' '
 	)
 '
 
-test_expect_failure 'One reset --hard cleans unmerged entries' '
+test_expect_success 'One reset --hard cleans unmerged entries' '
 	test_when_finished "git -C df_plus_modify_delete clean -f" &&
 	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
 	(
@@ -87,7 +87,7 @@ test_expect_success 'setup directory/file conflict + simple edit/edit' '
 	)
 '
 
-test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
+test_expect_success 'git merge --abort succeeds despite D/F conflict' '
 	test_when_finished "git -C df_plus_edit_edit clean -f" &&
 	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
 	(
@@ -103,7 +103,7 @@ test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
 	)
 '
 
-test_expect_failure 'git am --skip succeeds despite D/F conflict' '
+test_expect_success 'git am --skip succeeds despite D/F conflict' '
 	test_when_finished "git -C df_plus_edit_edit clean -f" &&
 	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
 	(
diff --git a/t/t6020-merge-df.sh b/t/t6020-merge-df.sh
index 2af1beec5f..46b506b3b7 100755
--- a/t/t6020-merge-df.sh
+++ b/t/t6020-merge-df.sh
@@ -89,9 +89,6 @@ test_expect_success 'modify/delete + directory/file conflict' '
 '
 
 test_expect_success 'modify/delete + directory/file conflict; other way' '
-	# Yes, we really need the double reset since "letters" appears as
-	# both a file and a directory.
-	git reset --hard &&
 	git reset --hard &&
 	git clean -f &&
 	git checkout modify^0 &&
diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh
index 1cbd946fc2..583e68997e 100755
--- a/t/t6042-merge-rename-corner-cases.sh
+++ b/t/t6042-merge-rename-corner-cases.sh
@@ -323,7 +323,6 @@ test_expect_success 'rename/directory conflict + content merge conflict' '
 	(
 		cd rename-directory-1 &&
 
-		git reset --hard &&
 		git reset --hard &&
 		git clean -fdqx &&
 
-- 
2.18.0.645.g72fe132ec2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/2] Address recovery failures with directory/file conflicts
  2018-07-13 16:33 ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
  2018-07-13 16:33   ` [PATCH v2 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
  2018-07-13 16:33   ` [PATCH v2 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() Elijah Newren
@ 2018-07-13 16:45   ` Elijah Newren
  2018-07-31 17:12   ` [PATCH v3 " Elijah Newren
  3 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-13 16:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List, Eric Sunshine, Elijah Newren

On Fri, Jul 13, 2018 at 9:33 AM, Elijah Newren <newren@gmail.com> wrote:
> This patch series fixes several "recovery" commands that outright fail
> or do not fully recover when directory-file conflicts are present.
> This includes:
>    * git read-tree --reset HEAD
>    * git am --skip
>    * git am --abort
>    * git merge --abort (or git reset --merge)
>    * git reset --hard
>
> Changes since v1 (full range-diff below):
>   - Make use of test_write_lines, as suggested by Eric.
>   - Provide a little more explanation in one of the commit messages, as
>     suggested by Junio.

I forgot to mention: there is also an expected failing merge --abort
testcase in en/t7405-recursive-submodule-conflicts (currently in pu),
and the fact that this series does not fix that testcase is known.
For the curious...

This read-index-unmerged series is part of the solution for the
problem highlighted in t7405; in fact, the similarity between
file/directory and submodule/directory conflicts is such that this
patch series does also happen to fix recovery problems for many
submodule/directory conflicts as well.  However, additional work is
needed when the same path is found under both the submodule and the
directory, and the testcase in en/t7405-recursive-submodule-conflicts
is precisely one of those cases that needs additional work.

(This is just a long winded way of saying that this series and
en/t7405-recursive-submodule-conflicts don't conflict or duplicate
each other.)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 0/2] Address recovery failures with directory/file conflicts
  2018-07-13 16:33 ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
                     ` (2 preceding siblings ...)
  2018-07-13 16:45   ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
@ 2018-07-31 17:12   ` Elijah Newren
  2018-07-31 17:12     ` [PATCH v3 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
  2018-07-31 17:12     ` [PATCH v3 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() Elijah Newren
  3 siblings, 2 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-31 17:12 UTC (permalink / raw)
  To: gitster; +Cc: git, sunshine, Elijah Newren

This patch series fixes several "recovery" commands that outright fail
or do not fully recover when directory-file conflicts are present.
This includes:
   * git read-tree --reset HEAD
   * git am --skip
   * git am --abort
   * git merge --abort (or git reset --merge)
   * git reset --hard

Changes since v2 (full range-diff below):
  - Backported to maint (there were some textual conflicts in t6042
    due to the merging of en/merge-recursive-tests to master), because
    of this comment from Junio's what's cooking email:

    "This may have to be rebased on an older maintenance track before
     moving forward."

Elijah Newren (2):
  t1015: demonstrate directory/file conflict recovery failures
  read-cache: fix directory/file conflict handling in
    read_index_unmerged()

 read-cache.c                         |  13 +--
 t/t1015-read-index-unmerged.sh       | 123 +++++++++++++++++++++++++++
 t/t6020-merge-df.sh                  |   3 -
 t/t6042-merge-rename-corner-cases.sh |   2 -
 4 files changed, 131 insertions(+), 10 deletions(-)
 create mode 100755 t/t1015-read-index-unmerged.sh

1:  4a1c9c3368 ! 1:  00f94a8b41 t1015: demonstrate directory/file conflict recovery failures
    @@ -14,7 +14,6 @@
     
         Signed-off-by: Elijah Newren <newren@gmail.com>
         Signed-off-by: Junio C Hamano <gitster@pobox.com>
    -    Message-Id: <20180713163331.22446-2-newren@gmail.com>
     
     diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
     new file mode 100755
2:  e105e8bfbd ! 2:  d3b8d7edb6 read-cache: fix directory/file conflict handling in read_index_unmerged()
    @@ -59,7 +59,6 @@
     
         Signed-off-by: Elijah Newren <newren@gmail.com>
         Signed-off-by: Junio C Hamano <gitster@pobox.com>
    -    Message-Id: <20180713163331.22446-3-newren@gmail.com>
     
     diff --git a/read-cache.c b/read-cache.c
     --- a/read-cache.c
    @@ -150,10 +149,18 @@
     --- a/t/t6042-merge-rename-corner-cases.sh
     +++ b/t/t6042-merge-rename-corner-cases.sh
     @@
    - 	(
    - 		cd rename-directory-1 &&
    + '
    +
    + test_expect_success 'rename/directory conflict + clean content merge' '
    +-	git reset --hard &&
    +	git reset --hard &&
    +	git clean -fdqx &&
      
    --		git reset --hard &&
    - 		git reset --hard &&
    - 		git clean -fdqx &&
    +@@
    + '
    +
    + test_expect_success 'rename/directory conflict + content merge conflict' '
    +-	git reset --hard &&
    +	git reset --hard &&
    +	git clean -fdqx &&
      
-- 
2.18.0.2.gf4c50c7885

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 1/2] t1015: demonstrate directory/file conflict recovery failures
  2018-07-31 17:12   ` [PATCH v3 " Elijah Newren
@ 2018-07-31 17:12     ` Elijah Newren
  2018-07-31 17:12     ` [PATCH v3 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() Elijah Newren
  1 sibling, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-31 17:12 UTC (permalink / raw)
  To: gitster; +Cc: git, sunshine, Elijah Newren

Several "recovery" commands outright fail or do not fully recover
when directory-file conflicts are present.  This includes:
  * git read-tree --reset HEAD
  * git am --skip
  * git am --abort
  * git merge --abort
  * git reset --hard

Add testcases documenting these shortcomings.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t1015-read-index-unmerged.sh | 123 +++++++++++++++++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100755 t/t1015-read-index-unmerged.sh

diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
new file mode 100755
index 0000000000..32ef6bdcfa
--- /dev/null
+++ b/t/t1015-read-index-unmerged.sh
@@ -0,0 +1,123 @@
+#!/bin/sh
+
+test_description='Test various callers of read_index_unmerged'
+. ./test-lib.sh
+
+test_expect_success 'setup modify/delete + directory/file conflict' '
+	test_create_repo df_plus_modify_delete &&
+	(
+		cd df_plus_modify_delete &&
+
+		test_write_lines a b c d e f g h >letters &&
+		git add letters &&
+		git commit -m initial &&
+
+		git checkout -b modify &&
+		# Throw in letters.txt for sorting order fun
+		# ("letters.txt" sorts between "letters" and "letters/file")
+		echo i >>letters &&
+		echo "version 2" >letters.txt &&
+		git add letters letters.txt &&
+		git commit -m modified &&
+
+		git checkout -b delete HEAD^ &&
+		git rm letters &&
+		mkdir letters &&
+		>letters/file &&
+		echo "version 1" >letters.txt &&
+		git add letters letters.txt &&
+		git commit -m deleted
+	)
+'
+
+test_expect_failure 'read-tree --reset cleans unmerged entries' '
+	test_when_finished "git -C df_plus_modify_delete clean -f" &&
+	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
+	(
+		cd df_plus_modify_delete &&
+
+		git checkout delete^0 &&
+		test_must_fail git merge modify &&
+
+		git read-tree --reset HEAD &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_expect_failure 'One reset --hard cleans unmerged entries' '
+	test_when_finished "git -C df_plus_modify_delete clean -f" &&
+	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
+	(
+		cd df_plus_modify_delete &&
+
+		git checkout delete^0 &&
+		test_must_fail git merge modify &&
+
+		git reset --hard &&
+		test_path_is_missing .git/MERGE_HEAD &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_expect_success 'setup directory/file conflict + simple edit/edit' '
+	test_create_repo df_plus_edit_edit &&
+	(
+		cd df_plus_edit_edit &&
+
+		test_seq 1 10 >numbers &&
+		git add numbers &&
+		git commit -m initial &&
+
+		git checkout -b d-edit &&
+		mkdir foo &&
+		echo content >foo/bar &&
+		git add foo &&
+		echo 11 >>numbers &&
+		git add numbers &&
+		git commit -m "directory and edit" &&
+
+		git checkout -b f-edit d-edit^1 &&
+		echo content >foo &&
+		git add foo &&
+		echo eleven >>numbers &&
+		git add numbers &&
+		git commit -m "file and edit"
+	)
+'
+
+test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
+	test_when_finished "git -C df_plus_edit_edit clean -f" &&
+	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
+	(
+		cd df_plus_edit_edit &&
+
+		git checkout f-edit^0 &&
+		test_must_fail git merge d-edit^0 &&
+
+		git merge --abort &&
+		test_path_is_missing .git/MERGE_HEAD &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_expect_failure 'git am --skip succeeds despite D/F conflict' '
+	test_when_finished "git -C df_plus_edit_edit clean -f" &&
+	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
+	(
+		cd df_plus_edit_edit &&
+
+		git checkout f-edit^0 &&
+		git format-patch -1 d-edit &&
+		test_must_fail git am -3 0001*.patch &&
+
+		git am --skip &&
+		test_path_is_missing .git/rebase-apply &&
+		git ls-files -u >conflicts &&
+		test_must_be_empty conflicts
+	)
+'
+
+test_done
-- 
2.18.0.2.gf4c50c7885


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged()
  2018-07-31 17:12   ` [PATCH v3 " Elijah Newren
  2018-07-31 17:12     ` [PATCH v3 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
@ 2018-07-31 17:12     ` Elijah Newren
  1 sibling, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-31 17:12 UTC (permalink / raw)
  To: gitster; +Cc: git, sunshine, Elijah Newren

read_index_unmerged() has two intended purposes:
  * return 1 if there are any unmerged entries, 0 otherwise
  * drops any higher-stage entries down to stage #0

There are several callers of read_index_unmerged() that check the return
value to see if it is non-zero, all of which then die() if that condition
is met.  For these callers, dropping higher-stage entries down to stage #0
is a waste of resources, and returning immediately on first unmerged entry
would be better.  But it's probably only a very minor difference and isn't
the focus of this series.

The remaining callers ignore the return value and call this function for
the side effect of dropping higher-stage entries down to stage #0.  As
mentioned in commit e11d7b596970 ("'reset --merge': fix unmerged case",
2009-12-31),

    The _only_ reason we want to keep a previously unmerged entry in the
    index at stage #0 is so that we don't forget the fact that we have
    corresponding file in the work tree in order to be able to remove it
    when the tree we are resetting to does not have the path.

In fact, prior to commit d1a43f2aa4bf ("reset --hard/read-tree --reset -u:
remove unmerged new paths", 2008-10-15), read_index_unmerged() did just
remove unmerged entries from the cache immediately but that had the
unwanted effect of leaving around new untracked files in the tree from
aborted merges.

So, that's the intended purpose of this function.  The problem is that
when directory/files conflicts are present, trying to add the file to the
index at stage 0 fails (because there is still a directory in the way),
and the function returns early with a -1 return code to signify the error.
As noted above, none of the callers who want the drop-to-stage-0 behavior
check the return status, though, so this means all remaining unmerged
entries remain in the index and the callers proceed assuming otherwise.
Users then see errors of the form:

    error: 'DIR-OR-FILE' appears as both a file and as a directory
    error: DIR-OR-FILE: cannot drop to stage #0

and potentially also messages about other unmerged entries which came
lexicographically later than whatever pathname was both a file and a
directory.  Google finds a few hits searching for those messages,
suggesting there were probably a couple people who hit this besides me.
Luckily, calling `git reset --hard` multiple times would workaround
this bug.

Since the whole purpose here is to just put the entry *temporarily* into
the index so that any associated file in the working copy can be removed,
we can just skip the DFCHECK and allow both the file and directory to
appear in the index.  The temporary simultaneous appearance of the
directory and file entries in the index will be removed by the callers
by calling unpack_trees(), which excludes these unmerged entries marked
with CE_CONFLICTED flag from the resulting index, before they attempt to
write the index anywhere.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 read-cache.c                         | 13 ++++++++-----
 t/t1015-read-index-unmerged.sh       |  8 ++++----
 t/t6020-merge-df.sh                  |  3 ---
 t/t6042-merge-rename-corner-cases.sh |  2 --
 4 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index 372588260e..666d295a5a 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2632,10 +2632,13 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
 
 /*
  * Read the index file that is potentially unmerged into given
- * index_state, dropping any unmerged entries.  Returns true if
- * the index is unmerged.  Callers who want to refuse to work
- * from an unmerged state can call this and check its return value,
- * instead of calling read_cache().
+ * index_state, dropping any unmerged entries to stage #0 (potentially
+ * resulting in a path appearing as both a file and a directory in the
+ * index; the caller is responsible to clear out the extra entries
+ * before writing the index to a tree).  Returns true if the index is
+ * unmerged.  Callers who want to refuse to work from an unmerged
+ * state can call this and check its return value, instead of calling
+ * read_cache().
  */
 int read_index_unmerged(struct index_state *istate)
 {
@@ -2658,7 +2661,7 @@ int read_index_unmerged(struct index_state *istate)
 		new_ce->ce_flags = create_ce_flags(0) | CE_CONFLICTED;
 		new_ce->ce_namelen = len;
 		new_ce->ce_mode = ce->ce_mode;
-		if (add_index_entry(istate, new_ce, 0))
+		if (add_index_entry(istate, new_ce, ADD_CACHE_SKIP_DFCHECK))
 			return error("%s: cannot drop to stage #0",
 				     new_ce->name);
 	}
diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
index 32ef6bdcfa..55d22da32c 100755
--- a/t/t1015-read-index-unmerged.sh
+++ b/t/t1015-read-index-unmerged.sh
@@ -30,7 +30,7 @@ test_expect_success 'setup modify/delete + directory/file conflict' '
 	)
 '
 
-test_expect_failure 'read-tree --reset cleans unmerged entries' '
+test_expect_success 'read-tree --reset cleans unmerged entries' '
 	test_when_finished "git -C df_plus_modify_delete clean -f" &&
 	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
 	(
@@ -45,7 +45,7 @@ test_expect_failure 'read-tree --reset cleans unmerged entries' '
 	)
 '
 
-test_expect_failure 'One reset --hard cleans unmerged entries' '
+test_expect_success 'One reset --hard cleans unmerged entries' '
 	test_when_finished "git -C df_plus_modify_delete clean -f" &&
 	test_when_finished "git -C df_plus_modify_delete reset --hard" &&
 	(
@@ -87,7 +87,7 @@ test_expect_success 'setup directory/file conflict + simple edit/edit' '
 	)
 '
 
-test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
+test_expect_success 'git merge --abort succeeds despite D/F conflict' '
 	test_when_finished "git -C df_plus_edit_edit clean -f" &&
 	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
 	(
@@ -103,7 +103,7 @@ test_expect_failure 'git merge --abort succeeds despite D/F conflict' '
 	)
 '
 
-test_expect_failure 'git am --skip succeeds despite D/F conflict' '
+test_expect_success 'git am --skip succeeds despite D/F conflict' '
 	test_when_finished "git -C df_plus_edit_edit clean -f" &&
 	test_when_finished "git -C df_plus_edit_edit reset --hard" &&
 	(
diff --git a/t/t6020-merge-df.sh b/t/t6020-merge-df.sh
index 2af1beec5f..46b506b3b7 100755
--- a/t/t6020-merge-df.sh
+++ b/t/t6020-merge-df.sh
@@ -89,9 +89,6 @@ test_expect_success 'modify/delete + directory/file conflict' '
 '
 
 test_expect_success 'modify/delete + directory/file conflict; other way' '
-	# Yes, we really need the double reset since "letters" appears as
-	# both a file and a directory.
-	git reset --hard &&
 	git reset --hard &&
 	git clean -f &&
 	git checkout modify^0 &&
diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh
index 411550d2b6..de77bfaf4f 100755
--- a/t/t6042-merge-rename-corner-cases.sh
+++ b/t/t6042-merge-rename-corner-cases.sh
@@ -235,7 +235,6 @@ test_expect_success 'setup content merge + rename/directory conflict' '
 '
 
 test_expect_success 'rename/directory conflict + clean content merge' '
-	git reset --hard &&
 	git reset --hard &&
 	git clean -fdqx &&
 
@@ -259,7 +258,6 @@ test_expect_success 'rename/directory conflict + clean content merge' '
 '
 
 test_expect_success 'rename/directory conflict + content merge conflict' '
-	git reset --hard &&
 	git reset --hard &&
 	git clean -fdqx &&
 
-- 
2.18.0.2.gf4c50c7885


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-07-31 17:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11  5:18 [PATCH 0/2] Address recovery failures with directory/file conflicts Elijah Newren
2018-07-11  5:18 ` [PATCH 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
2018-07-11  9:21   ` Eric Sunshine
2018-07-11 18:23     ` Elijah Newren
2018-07-11  5:18 ` [PATCH 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() Elijah Newren
2018-07-11 17:03   ` Junio C Hamano
2018-07-11 18:24     ` Elijah Newren
2018-07-13 16:33 ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
2018-07-13 16:33   ` [PATCH v2 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
2018-07-13 16:33   ` [PATCH v2 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() Elijah Newren
2018-07-13 16:45   ` [PATCH v2 0/2] Address recovery failures with directory/file conflicts Elijah Newren
2018-07-31 17:12   ` [PATCH v3 " Elijah Newren
2018-07-31 17:12     ` [PATCH v3 1/2] t1015: demonstrate directory/file conflict recovery failures Elijah Newren
2018-07-31 17:12     ` [PATCH v3 2/2] read-cache: fix directory/file conflict handling in read_index_unmerged() 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).