{"thread":{"id":"26594","subject":"Swap file trouble with gvimdiff","startedAt":"2011-02-24T19:34:12Z","lastAt":"2011-02-27T22:33:54Z","messageCount":4,"participants":["Marco","Michael J Gruber","Junio C Hamano","David Aguilar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"162184","messageId":"20110224203412.29b732b9@glyph","threadId":"26594","inReplyTo":null,"subject":"Swap file trouble with gvimdiff","fromName":"Marco","fromEmail":"netuse@lavabit.com","sentAt":"2011-02-24T19:34:12Z","receivedAt":"2011-02-24T19:34:12Z","isPatch":false,"sender":{"key":"netuse@lavabit.com","avatar":null},"body":"Hi,\n\nI use gvimdiff as difftool. The relevant .gitconfig entries look as follows:\n\n[diff]\n\ttool = gvimdiff\n[difftool]\n\tprompt = false\n\nBut when one diffs a file alredy opened in another window it clashes because\ngvimdiff recognises the swap file and throws a message.\n\nIt would make sense to pass the option »-n« to gvimdiff to avoid creating a\nswap file, since it is not needed here.\n\nI haven't found the place where the command line and arguments for the\nsupported difftools are placed, so I created a new entry in the .gitconfig\n\n[diff]\n\ttool = bettergvimdiff\n[difftool \"bettergvimdiff\"]\n\tcmd = \"gvimdiff -f -n \\\"$LOCAL\\\" \\\"$REMOTE\\\"\"\n\nI want to know if this is a »correct« solution and — if not — how you solve\nthe problem.\n\n\nMarco\n"},{"id":"162224","messageId":"227c6e4e11ce964a6e6898afb422d424d46a7b50.1298626494.git.git@drmicha.warpmail.net","threadId":"26594","inReplyTo":"20110224203412.29b732b9@glyph","subject":"[PATCH] mergetool-lib: call vim in readonly mode for diffs","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-02-25T09:36:39Z","receivedAt":"2011-02-25T09:36:39Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"When [g]vimdiff is called for files which are opened already, the editor\ncomplains about the existing swap file. But we do not want to write\nanything when called from difftool. So, make difftool use \"-R\" for the\nvim family. This\n\n- prevents the use of a swap file and\n- marks the buffers readonly.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nNotes:\n    It would be nice to mark all buffers but one with -R in mergemode\n    but that seems to require some vim-scripting. There are no per-file command\n    line options that I know of.\n\n git-mergetool--lib.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\nindex 77d4aee..78ce49e 100644\n--- a/git-mergetool--lib.sh\n+++ b/git-mergetool--lib.sh\n@@ -182,7 +182,7 @@ run_merge_tool () {\n \t\t\tfi\n \t\t\tcheck_unchanged\n \t\telse\n-\t\t\t\"$merge_tool_path\" -f -d -c \"wincmd l\" \\\n+\t\t\t\"$merge_tool_path\" -R -f -d -c \"wincmd l\" \\\n \t\t\t\t\"$LOCAL\" \"$REMOTE\"\n \t\tfi\n \t\t;;\n@@ -193,7 +193,7 @@ run_merge_tool () {\n \t\t\t\t\"$LOCAL\" \"$MERGED\" \"$REMOTE\"\n \t\t\tcheck_unchanged\n \t\telse\n-\t\t\t\"$merge_tool_path\" -f -d -c \"wincmd l\" \\\n+\t\t\t\"$merge_tool_path\" -R -f -d -c \"wincmd l\" \\\n \t\t\t\t\"$LOCAL\" \"$REMOTE\"\n \t\tfi\n \t\t;;\n-- \n1.7.4.1.224.gefc87\n"},{"id":"162263","messageId":"7v62s7anp0.fsf@alter.siamese.dyndns.org","threadId":"26594","inReplyTo":"227c6e4e11ce964a6e6898afb422d424d46a7b50.1298626494.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] mergetool-lib: call vim in readonly mode for diffs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-02-25T20:01:15Z","receivedAt":"2011-02-25T20:01:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> When [g]vimdiff is called for files which are opened already, the editor\n> complains about the existing swap file. But we do not want to write\n> anything when called from difftool. So, make difftool use \"-R\" for the\n> vim family.\n\nMakes sense.  Maint-worthy?\n\nWill queue, thanks.\n"},{"id":"162387","messageId":"20110227223350.GA37866@gmail.com","threadId":"26594","inReplyTo":"7v62s7anp0.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] mergetool-lib: call vim in readonly mode for diffs","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2011-02-27T22:33:54Z","receivedAt":"2011-02-27T22:33:54Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Fri, Feb 25, 2011 at 12:01:15PM -0800, Junio C Hamano wrote:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n> > When [g]vimdiff is called for files which are opened already, the editor\n> > complains about the existing swap file. But we do not want to write\n> > anything when called from difftool. So, make difftool use \"-R\" for the\n> > vim family.\n> \n> Makes sense.  Maint-worthy?\n\nI think this would be good in maint.\nthanks,\n-- \n\t\tDavid\n"}]}