{"thread":{"id":"11122","subject":"[PATCH] Open external merge tool with original file extensions in all three files","startedAt":"2007-12-03T15:31:14Z","lastAt":"2007-12-03T21:28:07Z","messageCount":3,"participants":["Pini Reznik","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"61784","messageId":"1196695874-22567-1-git-send-email-pinir@expand.com","threadId":"11122","inReplyTo":null,"subject":"[PATCH] Open external merge tool with original file extensions in all three files","fromName":"Pini Reznik","fromEmail":"pinir@expand.com","sentAt":"2007-12-03T15:31:14Z","receivedAt":"2007-12-03T15:31:14Z","isPatch":true,"sender":{"key":"pinir@expand.com","avatar":null},"body":"This required to be able to use syntax highlighting in meld during conflicts resolution.\nBefore this change, two merged versions of file with a conflict were open with temporal extensions .LOCAL.$$ and REMOTE.$$\nThis way they were not recognized as a code files.\n\nSigned-off-by: Pini Reznik <pinir@expand.com>\n---\n git-mergetool.sh |    9 +++++----\n 1 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex 5587c5e..4c15d22 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -152,10 +152,11 @@ merge_file () {\n \texit 1\n     fi\n \n-    BACKUP=\"$path.BACKUP.$$\"\n-    LOCAL=\"$path.LOCAL.$$\"\n-    REMOTE=\"$path.REMOTE.$$\"\n-    BASE=\"$path.BASE.$$\"\n+    extension=`echo $path | awk -F \\. '{print $NF}'`\n+    BACKUP=\"$path.BACKUP.$$.${extension}\"\n+    LOCAL=\"$path.LOCAL.$$.${extension}\"\n+    REMOTE=\"$path.REMOTE.$$.${extension}\"\n+    BASE=\"$path.BASE.$$.${extension}\"\n \n     mv -- \"$path\" \"$BACKUP\"\n     cp -- \"$BACKUP\" \"$path\"\n-- \n1.5.3.5\n"},{"id":"61802","messageId":"7v63zfiqx8.fsf@gitster.siamese.dyndns.org","threadId":"11122","inReplyTo":"1196695874-22567-1-git-send-email-pinir@expand.com","subject":"Re: [PATCH] Open external merge tool with original file extensions in all three files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-03T18:17:23Z","receivedAt":"2007-12-03T18:17:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pini Reznik <pinir@expand.com> writes:\n\n> This required to be able to use syntax highlighting in meld during\n> conflicts resolution....\n\n> +    extension=`echo $path | awk -F \\. '{print $NF}'`\n> +    BACKUP=\"$path.BACKUP.$$.${extension}\"\n> +    LOCAL=\"$path.LOCAL.$$.${extension}\"\n> +    REMOTE=\"$path.REMOTE.$$.${extension}\"\n> +    BASE=\"$path.BASE.$$.${extension}\"\n\nI had to wonder what would happen in these cases:\n\n * path = \"a/b/c/d\"\n * path = \"a/b.c/d\"\n\nI also think spawning awk for this is way overkill.\n"},{"id":"61821","messageId":"7vlk8bh3iw.fsf@gitster.siamese.dyndns.org","threadId":"11122","inReplyTo":"7v63zfiqx8.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Open external merge tool with original file extensions in all three files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-03T21:28:07Z","receivedAt":"2007-12-03T21:28:07Z","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> Pini Reznik <pinir@expand.com> writes:\n>\n>> This required to be able to use syntax highlighting in meld during\n>> conflicts resolution....\n>\n>> +    extension=`echo $path | awk -F \\. '{print $NF}'`\n>> +    BACKUP=\"$path.BACKUP.$$.${extension}\"\n>> +    LOCAL=\"$path.LOCAL.$$.${extension}\"\n>> +    REMOTE=\"$path.REMOTE.$$.${extension}\"\n>> +    BASE=\"$path.BASE.$$.${extension}\"\n>\n> I had to wonder what would happen in these cases:\n>\n>  * path = \"a/b/c/d\"\n>  * path = \"a/b.c/d\"\n>\n> I also think spawning awk for this is way overkill.\n\nIOW, I would probably write the above like this:\n\n\text=\"$$$(expr \"$path\" : '.*\\(\\.[^/]*\\)$')\"\n        BACKUP=\"$path.BACKUP.$ext\"\n        LOCAL=\"$path.LOCAL.$ext\"\n        REMOTE=\"$path.REMOTE.$ext\"\n        BASE=\"$path.BASE.$ext\"\n"}]}