{"thread":{"id":"8967","subject":"[PATCH] Work around a bad interaction between Tcl and cmd.exe with \"^{tree}\"","startedAt":"2007-07-10T16:10:20Z","lastAt":"2007-07-12T06:47:38Z","messageCount":3,"participants":["Johannes Sixt","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"46961","messageId":"4693AF6C.99DB933@eudaptics.com","threadId":"8967","inReplyTo":null,"subject":"[PATCH] Work around a bad interaction between Tcl and cmd.exe with \"^{tree}\"","fromName":"Johannes Sixt","fromEmail":"j.sixt@eudaptics.com","sentAt":"2007-07-10T16:10:20Z","receivedAt":"2007-07-10T16:10:20Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"It seems that MSYS's wish does some quoting for Bourne shells, in\nparticular, escape the first '{' of the \"^{tree}\" suffix, but then it uses\ncmd.exe to run \"git rev-parse\". However, cmd.exe does not remove the\nbackslash, so that the resulting rev expression ends up in git's guts\nas unrecognizable garbage: rev-parse fails, and git-gui hickups in a way\nthat it must be restarted.\n\nFortunately, recent versions of git can refer to the root tree object using\nthe notation \"$commit:\", which avoids the problematic case.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\nThis is a resend with a slightly improved commit message.\nThe first version didn't get through for some reason anyway, it seems.\n\n lib/commit.tcl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/lib/commit.tcl b/lib/commit.tcl\nindex dc7c88c..43a5aca 100644\n--- a/lib/commit.tcl\n+++ b/lib/commit.tcl\n@@ -258,7 +258,7 @@ proc commit_committree {fd_wt curHEAD msg} {\n \t# -- Verify this wasn't an empty change.\n \t#\n \tif {$commit_type eq {normal}} {\n-\t\tset old_tree [git rev-parse \"$PARENT^{tree}\"]\n+\t\tset old_tree [git rev-parse \"$PARENT:\"]\n \t\tif {$tree_id eq $old_tree} {\n \t\t\tinfo_popup {No changes to commit.\n \n-- \n1.5.3.rc0.32.g2968f\n"},{"id":"47013","messageId":"20070711080333.GP4436@spearce.org","threadId":"8967","inReplyTo":"4693AF6C.99DB933@eudaptics.com","subject":"Re: [PATCH] Work around a bad interaction between Tcl and cmd.exe with \"^{tree}\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-07-11T08:03:33Z","receivedAt":"2007-07-11T08:03:33Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Sixt <J.Sixt@eudaptics.com> wrote:\n> It seems that MSYS's wish does some quoting for Bourne shells, in\n> particular, escape the first '{' of the \"^{tree}\" suffix, but then it uses\n> cmd.exe to run \"git rev-parse\". However, cmd.exe does not remove the\n> backslash, so that the resulting rev expression ends up in git's guts\n> as unrecognizable garbage: rev-parse fails, and git-gui hickups in a way\n> that it must be restarted.\n> \n> Fortunately, recent versions of git can refer to the root tree object using\n> the notation \"$commit:\", which avoids the problematic case.\n> \n> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n> ---\n> This is a resend with a slightly improved commit message.\n> The first version didn't get through for some reason anyway, it seems.\n\nI did get your patch yesterday.  I just didn't finish my replacement\nversion.  Got busy with other things.\n\nI have seen this { issue before.  And not just on MSYS.  It also\nborked on Cygwin.  This is why git-gui formats the geometry and\nfont data the way it does in the .git/config file; by default it\nwanted to use {} around strings with spaces in them and this got\nall messed up going through the shell.  So we s/[{}]/\"/g before we\ncall git-config.  Yea, it sucks.\n\nRather than relying on rev-parse to understand the : syntax here\nI'm just going to parse the commit object and yank the first line\nout of it.  We already do that for an amend to refetch the message\nbuffer.  Either way it is a fork.  And its roughly the same amount\nof CPU time for both git-gui and C git.  :-|\n \n> diff --git a/lib/commit.tcl b/lib/commit.tcl\n> index dc7c88c..43a5aca 100644\n> --- a/lib/commit.tcl\n> +++ b/lib/commit.tcl\n> @@ -258,7 +258,7 @@ proc commit_committree {fd_wt curHEAD msg} {\n>  \t# -- Verify this wasn't an empty change.\n>  \t#\n>  \tif {$commit_type eq {normal}} {\n> -\t\tset old_tree [git rev-parse \"$PARENT^{tree}\"]\n> +\t\tset old_tree [git rev-parse \"$PARENT:\"]\n>  \t\tif {$tree_id eq $old_tree} {\n>  \t\t\tinfo_popup {No changes to commit.\n\n-- \nShawn.\n"},{"id":"47122","messageId":"20070712064738.GT4436@spearce.org","threadId":"8967","inReplyTo":"4693AF6C.99DB933@eudaptics.com","subject":"Re: [PATCH] Work around a bad interaction between Tcl and cmd.exe with \"^{tree}\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-07-12T06:47:38Z","receivedAt":"2007-07-12T06:47:38Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Sixt <J.Sixt@eudaptics.com> wrote:\n> It seems that MSYS's wish does some quoting for Bourne shells, in\n> particular, escape the first '{' of the \"^{tree}\" suffix, but then it uses\n> cmd.exe to run \"git rev-parse\". However, cmd.exe does not remove the\n> backslash, so that the resulting rev expression ends up in git's guts\n> as unrecognizable garbage: rev-parse fails, and git-gui hickups in a way\n> that it must be restarted.\n\nFinally fixed in git-gui 0.7.5, which I just pushed out.\n\n-- \nShawn.\n"}]}