git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Work around a bad interaction between Tcl and cmd.exe with "^{tree}"

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 11, 2007, 08:03 UTC
Message-ID
<20070711080333.GP4436@spearce.org>
In-Reply-To
<4693AF6C.99DB933@eudaptics.com>
Johannes Sixt <J.Sixt@eudaptics.com> wrote:
Show 14 quoted lines
> It seems that MSYS's wish does some quoting for Bourne shells, in
> particular, escape the first '{' of the "^{tree}" suffix, but then it uses
> cmd.exe to run "git rev-parse". However, cmd.exe does not remove the
> backslash, so that the resulting rev expression ends up in git's guts
> as unrecognizable garbage: rev-parse fails, and git-gui hickups in a way
> that it must be restarted.
> 
> Fortunately, recent versions of git can refer to the root tree object using
> the notation "$commit:", which avoids the problematic case.
> 
> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
> ---
> This is a resend with a slightly improved commit message.
> The first version didn't get through for some reason anyway, it seems.

I did get your patch yesterday. I just didn't finish my replacement version. Got busy with other things.

I have seen this { issue before. And not just on MSYS. It also borked on Cygwin. This is why git-gui formats the geometry and font data the way it does in the .git/config file; by default it wanted to use {} around strings with spaces in them and this got all messed up going through the shell. So we s/[{}]/"/g before we call git-config. Yea, it sucks.

Rather than relying on rev-parse to understand the : syntax here
I'm just going to parse the commit object and yank the first line
out of it.  We already do that for an amend to refetch the message
buffer.  Either way it is a fork.  And its roughly the same amount
of CPU time for both git-gui and C git.  :-|
 
Show 12 quoted lines
> diff --git a/lib/commit.tcl b/lib/commit.tcl
> index dc7c88c..43a5aca 100644
> --- a/lib/commit.tcl
> +++ b/lib/commit.tcl
> @@ -258,7 +258,7 @@ proc commit_committree {fd_wt curHEAD msg} {
>  	# -- Verify this wasn't an empty change.
>  	#
>  	if {$commit_type eq {normal}} {
> -		set old_tree [git rev-parse "$PARENT^{tree}"]
> +		set old_tree [git rev-parse "$PARENT:"]
>  		if {$tree_id eq $old_tree} {
>  			info_popup {No changes to commit.
-- 
Shawn.
Previous: Johannes SixtNext: Shawn O. Pearce
Message 2 of 3 in “Work around a bad interaction between Tcl and cmd.exe with "^{tree}"”
  1. Work around a bad interaction between Tcl and cmd.exe with "^{tree}"Johannes Sixt, Jul 10, 2007
  2. Shawn O. PearceJul 11, 2007
  3. Shawn O. PearceJul 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.