{"thread":{"id":"2112","subject":"[PATCH] Fix argument processing for cg-Xmergefile.","startedAt":"2005-10-15T04:27:45Z","lastAt":"2005-10-15T04:27:45Z","messageCount":1,"participants":["Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"10117","messageId":"1129350465.11437.2.camel@dv","threadId":"2112","inReplyTo":null,"subject":"[PATCH] Fix argument processing for cg-Xmergefile.","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-10-15T04:27:45Z","receivedAt":"2005-10-15T04:27:45Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Positional arguments are no longer available.  Use ARGS array instead.\nUse variables with distinctive names for every argument.\nImprove message for the cases cg-Xmergefile cannot handle.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n---\n\n cg-Xmergefile |   61 ++++++++++++++++++++++++++++++++-------------------------\n 1 files changed, 34 insertions(+), 27 deletions(-)\n\napplies-to: f12b3dd9b47f28842943471719e7f5d24727b178\n546a93bdec1cd37516daf21137ed6fa3572b50cb\ndiff --git a/cg-Xmergefile b/cg-Xmergefile\nindex 16a2f69..5bff254 100755\n--- a/cg-Xmergefile\n+++ b/cg-Xmergefile\n@@ -24,6 +24,13 @@\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n+id0=\"${ARGS[0]}\"\n+id1=\"${ARGS[1]}\"\n+id2=\"${ARGS[2]}\"\n+file=\"${ARGS[3]}\"\n+mode0=\"${ARGS[4]}\"\n+mode1=\"${ARGS[5]}\"\n+mode2=\"${ARGS[6]}\"\n \n error()\n {\n@@ -37,37 +44,37 @@ warning()\n }\n \n \n-case \"${1:-.}${2:-.}${3:-.}\" in\n+case \"${id0:-.}${id1:-.}${id2:-.}\" in\n #\n # Deleted in both or deleted in one and unchanged in the other\n #\n-\"$1..\" | \"$1.$1\" | \"$1$1.\")\n-\t#echo \"Removing $4\"\n-\tif test -f \"$4\"; then\n-\t\trm -f -- \"$4\"\n+\"$id0..\" | \"$id0.$id0\" | \"$id0$id0.\")\n+\t#echo \"Removing $file\"\n+\tif test -f \"$file\"; then\n+\t\trm -f -- \"$file\"\n \tfi &&\n-\t\texec git-update-index --remove -- \"$4\"\n+\t\texec git-update-index --remove -- \"$file\"\n \t;;\n \n #\n # Added in one.\n #\n-\".$2.\" | \"..$3\" )\n-\t#echo \"Adding $4\"\n-\tgit-update-index --add --cacheinfo \"$6$7\" \"$2$3\" \"$4\" &&\n-\t\texec git-checkout-index -u -f -- \"$4\"\n+\".$id1.\" | \"..$id2\" )\n+\t#echo \"Adding $file\"\n+\tgit-update-index --add --cacheinfo \"$mode1$mode2\" \"$id1$id2\" \"$file\" &&\n+\t\texec git-checkout-index -u -f -- \"$file\"\n \t;;\n \n #\n # Added in both (check for same permissions).\n #\n-\".$3$2\")\n-\t#echo \"Adding $4\"\n-\tgit-update-index --add --cacheinfo \"$6\" \"$2\" \"$4\" &&\n-\t\tgit-checkout-index -u -f -- \"$4\"\n+\".$id2$id1\")\n+\t#echo \"Adding $file\"\n+\tgit-update-index --add --cacheinfo \"$mode1\" \"$id1\" \"$file\" &&\n+\t\tgit-checkout-index -u -f -- \"$file\"\n \tret=$?\n-\tif [ \"$6\" != \"$7\" ]; then\n-\t\terror \"$4: added in both branches, permissions conflict $6->$7\"\n+\tif [ \"$mode1\" != \"$mode2\" ]; then\n+\t\terror \"$file: added in both branches, permissions conflict $mode1->$mode2\"\n \t\texit 1\n \tfi\n \texit $ret\n@@ -76,21 +83,21 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n #\n # Modified in both, but differently.\n #\n-\"$1$2$3\")\n-\techo \"... Auto-merging $4\"\n-\torig=$(git-unpack-file $1)\n-\tsrc2=$(git-unpack-file $3)\n+\"$id0$id1$id2\")\n+\techo \"... Auto-merging $file\"\n+\torig=$(git-unpack-file $id0)\n+\tsrc2=$(git-unpack-file $id2)\n \n \t# We reset the index to the first branch, making\n \t# git-diff-file useful\n-\tgit-update-index --add --cacheinfo \"$6\" \"$2\" \"$4\"\n-\t\tgit-checkout-index -u -f -- \"$4\" &&\n-\t\tmerge \"$4\" \"$orig\" \"$src2\"\n+\tgit-update-index --add --cacheinfo \"$mode1\" \"$id1\" \"$file\"\n+\t\tgit-checkout-index -u -f -- \"$file\" &&\n+\t\tmerge \"$file\" \"$orig\" \"$src2\"\n \tret=$?\n \trm -f -- \"$orig\" \"$src2\"\n \n-\tif [ \"$6\" != \"$7\" ]; then\n-\t\terror \"Permissions conflict: $5->$6,$7.\"\n+\tif [ \"$mode1\" != \"$mode2\" ]; then\n+\t\terror \"Permissions conflict: $mode0->$mode1,$mode2.\"\n \t\tret=1\n \tfi\n \n@@ -100,11 +107,11 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n \t\t#error \"Auto-merge failed\"\n \t\texit 1\n \tfi\n-\texec git-update-index -- \"$4\"\n+\texec git-update-index -- \"$file\"\n \t;;\n \n *)\n-\terror \"$4: Not handling case $1 -> $2 -> $3\"\n+\terror \"$file: Not handling case: ${id0:-empty} -> ${id1:-empty} -> ${id2:-empty}\"\n \t;;\n esac\n exit 1\n---\n0.99.8.GIT\n\n\n-- \nRegards,\nPavel Roskin\n"}]}