{"thread":{"id":"1698","subject":"Make \"git resolve\" less scary","startedAt":"2005-08-30T05:36:16Z","lastAt":"2005-08-30T05:36:16Z","messageCount":1,"participants":["Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"7944","messageId":"Pine.LNX.4.58.0508292230300.3243@g5.osdl.org","threadId":"1698","inReplyTo":null,"subject":"Make \"git resolve\" less scary","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-30T05:36:16Z","receivedAt":"2005-08-30T05:36:16Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nWhen we resolve a merge between two branches, and it removes a file in the \ncurrent branch, we notify the person doing the resolve with a big nice \nnotice like\n\n\tRemoving xyzzy\n\nwhich is all well and good.\n\nHOWEVER, we also do this when the file was actually removed in the current \nbranch, and we're merging with another branch that didn't have it removed \n(or, indeed, if the other branch _did_ have it removed, but the common \nparent was far enough back that the file still existed in there).\n\nAnd that just doesn't make sense. In that case we're not removing\nanything: the file didn't exist in the branch we're merging into in the\nfirst place. So the message just makes people nervous, and makes no sense.\n\nThis has been around forever, but I never bothered to do anything about \nit.\n\nUntil now.\n\nThe trivial fix is to only talk about removing files if the file existed \nin the branch we're merging into, but will not exist in the result.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\ndiff --git a/git-merge-one-file-script b/git-merge-one-file-script\n--- a/git-merge-one-file-script\n+++ b/git-merge-one-file-script\n@@ -21,7 +21,9 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n # Deleted in both or deleted in one and unchanged in the other\n #\n \"$1..\" | \"$1.$1\" | \"$1$1.\")\n-\techo \"Removing $4\"\n+\tif [ \"$2\" ]; then\n+\t\techo \"Removing $4\"\n+\tfi\n \tif test -f \"$4\"; then\n \t\trm -f -- \"$4\"\n \tfi &&\n"}]}