{"thread":{"id":"17421","subject":"[PATCH] add -u: do not fail to resolve a path as deleted","startedAt":"2009-01-28T22:28:08Z","lastAt":"2009-01-29T00:13:21Z","messageCount":3,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"102363","messageId":"7vbptrkqvb.fsf@gitster.siamese.dyndns.org","threadId":"17421","inReplyTo":null,"subject":"[PATCH] add -u: do not fail to resolve a path as deleted","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-28T22:28:08Z","receivedAt":"2009-01-28T22:28:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"After you resolve a conflicted merge to remove the path, \"git add -u\"\nfailed to record the removal.  Instead it errored out by saying that the\nremoved path is not found in the work tree, but that is what the user\nwanted to do and failing it is illogical.\n\nThis fixes it.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n read-cache.c          |    5 +++++\n t/t2200-add-update.sh |   20 +++++++++++++++++++-\n 2 files changed, 24 insertions(+), 1 deletions(-)\n\ndiff --git a/read-cache.c b/read-cache.c\nindex b1475ff..ddc0586 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -1574,6 +1574,11 @@ static void update_callback(struct diff_queue_struct *q,\n \t\tdefault:\n \t\t\tdie(\"unexpected diff status %c\", p->status);\n \t\tcase DIFF_STATUS_UNMERGED:\n+\t\t\t/*\n+\t\t\t * diff-files gives U followed by the work tree state\n+\t\t\t * such as M or D, so we can ignore this.\n+\t\t\t */\n+\t\t\tcontinue;\n \t\tcase DIFF_STATUS_MODIFIED:\n \t\tcase DIFF_STATUS_TYPE_CHANGED:\n \t\t\tif (add_file_to_index(&the_index, path, data->flags)) {\ndiff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh\nindex cd9231c..e917a01 100755\n--- a/t/t2200-add-update.sh\n+++ b/t/t2200-add-update.sh\n@@ -12,7 +12,7 @@ and issues a git add -u with path limiting on \"dir\" to add\n only the updates to dir/sub.\n \n Also tested are \"git add -u\" without limiting, and \"git add -u\"\n-without contents changes.'\n+without contents changes, and other conditions'\n \n . ./test-lib.sh\n \n@@ -128,4 +128,22 @@ test_expect_success 'add -n -u should not add but just report' '\n \n '\n \n+test_expect_success 'add -u resolves unmerged paths' '\n+\tgit reset --hard &&\n+\tone=$(echo 1 | git hash-object -w --stdin) &&\n+\ttwo=$(echo 2 | git hash-object -w --stdin) &&\n+\tthree=$(echo 3 | git hash-object -w --stdin) &&\n+\tfor path in path1 path2\n+\tdo\n+\t\techo \"100644 $one 1\t$path\"\n+\t\techo \"100644 $two 2\t$path\"\n+\t\techo \"100644 $three 3\t$path\"\n+\tdone |\n+\tgit update-index --index-info &&\n+\techo 4 >path1 &&\n+\tgit add -u &&\n+\ttest 1 = \"$(git ls-files path1 path2 | wc -l)\"\n+'\n+\n test_done\n+\n-- \n1.6.1.1.278.g6a817\n"},{"id":"102373","messageId":"7viqnzj9ay.fsf@gitster.siamese.dyndns.org","threadId":"17421","inReplyTo":"7vbptrkqvb.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] add -u: do not fail to resolve a path as deleted","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-28T23:32:53Z","receivedAt":"2009-01-28T23:32:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> After you resolve a conflicted merge to remove the path, \"git add -u\"\n> failed to record the removal.  Instead it errored out by saying that the\n> removed path is not found in the work tree, but that is what the user\n> wanted to do and failing it is illogical.\n>\n> This fixes it.\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  read-cache.c          |    5 +++++\n>  t/t2200-add-update.sh |   20 +++++++++++++++++++-\n>  2 files changed, 24 insertions(+), 1 deletions(-)\n>\n> diff --git a/read-cache.c b/read-cache.c\n> index b1475ff..ddc0586 100644\n> --- a/read-cache.c\n> +++ b/read-cache.c\n> @@ -1574,6 +1574,11 @@ static void update_callback(struct diff_queue_struct *q,\n>  \t\tdefault:\n>  \t\t\tdie(\"unexpected diff status %c\", p->status);\n>  \t\tcase DIFF_STATUS_UNMERGED:\n> +\t\t\t/*\n> +\t\t\t * diff-files gives U followed by the work tree state\n> +\t\t\t * such as M or D, so we can ignore this.\n> +\t\t\t */\n> +\t\t\tcontinue;\n\nThis is wrong; breaks t3702.\n"},{"id":"102375","messageId":"7veiynj7fi.fsf@gitster.siamese.dyndns.org","threadId":"17421","inReplyTo":"7viqnzj9ay.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] add -u: do not fail to resolve a path as deleted","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-29T00:13:21Z","receivedAt":"2009-01-29T00:13:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> This is wrong; breaks t3702.\n\nUgh; that is a bogus test.  Please disregard.\n"}]}