{"thread":{"id":"2764","subject":"[PATCH 2/3] git-merge-one: new merge world order.","startedAt":"2005-12-07T10:01:35Z","lastAt":"2005-12-07T10:01:35Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"13309","messageId":"7v3bl5usxs.fsf@assigned-by-dhcp.cox.net","threadId":"2764","inReplyTo":null,"subject":"[PATCH 2/3] git-merge-one: new merge world order.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-07T10:01:35Z","receivedAt":"2005-12-07T10:01:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This does two things:\n\n - Use new --stage=2 option to create the working tree file with\n   leading paths and correct permission bits using\n   checkout-index, as before.\n\n - Make sure we do not confuse \"merge\" program when the file\n   being merged has an unfortunate name, '-L'.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n git-merge-one-file.sh |   25 +++++++++----------------\n 1 files changed, 9 insertions(+), 16 deletions(-)\n\nb539c5e8fbd36e38eb8f589e11aa5b136ddce753\ndiff --git a/git-merge-one-file.sh b/git-merge-one-file.sh\nindex 88a5da9..7dee88a 100755\n--- a/git-merge-one-file.sh\n+++ b/git-merge-one-file.sh\n@@ -16,14 +16,6 @@\n # been handled already by git-read-tree, but that one doesn't\n # do any merges that might change the tree layout.\n \n-verify_path() {\n-    file=\"$1\"\n-    dir=`dirname \"$file\"` &&\n-    mkdir -p \"$dir\" &&\n-    rm -f -- \"$file\" &&\n-    : >\"$file\"\n-}\n-\n case \"${1:-.}${2:-.}${3:-.}\" in\n #\n # Deleted in both or deleted in one and unchanged in the other\n@@ -95,15 +87,16 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n \t\t;;\n \tesac\n \n-\t# Create the working tree file, with the correct permission bits.\n-\t# we can not rely on the fact that our tree has the path, because\n-\t# we allow the merge to be done in an unchecked-out working tree.\n-\tverify_path \"$4\" &&\n-\t\tgit-cat-file blob \"$2\" >\"$4\" &&\n-\t\tcase \"$6\" in *7??) chmod +x -- \"$4\" ;; esac &&\n-\t\tmerge \"$4\" \"$orig\" \"$src2\"\n+\t# Be careful for funny filename such as \"-L\" in \"$4\", which\n+\t# would confuse \"merge\" greatly.\n+\tsrc1=`git-unpack-file $2`\n+\tmerge \"$src1\" \"$orig\" \"$src2\"\n \tret=$?\n-\trm -f -- \"$orig\" \"$src2\"\n+\n+\t# Create the working tree file, using \"our tree\" version from the\n+\t# index, and then store the result of the merge.\n+\tgit-checkout-index -f --stage=2 -- \"$4\" && cat \"$src1\" >\"$4\"\n+\trm -f -- \"$orig\" \"$src1\" \"$src2\"\n \n \tif [ \"$6\" != \"$7\" ]; then\n \t\techo \"ERROR: Permissions conflict: $5->$6,$7.\"\n-- \n0.99.9.GIT\n"}]}