git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Work around a bad interaction between Tcl and cmd.exe with "^{tree}"
@ 2007-07-10 13:09 Johannes Sixt
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Sixt @ 2007-07-10 13:09 UTC (permalink / raw)
  To: spearce; +Cc: git, Johannes Sixt

From: Johannes Sixt <johannes.sixt@telecom.at>

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 the "git rev-parse" command. However, cmd.exe does not remove
the backslash, so that the resulting ref expression ends up in git's guts
as unrecognizable garbage.

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>
---
 lib/commit.tcl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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.
 
-- 
1.5.3.rc0.32.g2968f

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] Work around a bad interaction between Tcl and cmd.exe with  "^{tree}"
@ 2007-07-10 16:10 Johannes Sixt
  2007-07-11  8:03 ` Shawn O. Pearce
  2007-07-12  6:47 ` Shawn O. Pearce
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Sixt @ 2007-07-10 16:10 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git

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.

 lib/commit.tcl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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.
 
-- 
1.5.3.rc0.32.g2968f

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Work around a bad interaction between Tcl and cmd.exe with "^{tree}"
  2007-07-10 16:10 [PATCH] Work around a bad interaction between Tcl and cmd.exe with "^{tree}" Johannes Sixt
@ 2007-07-11  8:03 ` Shawn O. Pearce
  2007-07-12  6:47 ` Shawn O. Pearce
  1 sibling, 0 replies; 4+ messages in thread
From: Shawn O. Pearce @ 2007-07-11  8:03 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Johannes Sixt <J.Sixt@eudaptics.com> wrote:
> 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.  :-|
 
> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Work around a bad interaction between Tcl and cmd.exe with "^{tree}"
  2007-07-10 16:10 [PATCH] Work around a bad interaction between Tcl and cmd.exe with "^{tree}" Johannes Sixt
  2007-07-11  8:03 ` Shawn O. Pearce
@ 2007-07-12  6:47 ` Shawn O. Pearce
  1 sibling, 0 replies; 4+ messages in thread
From: Shawn O. Pearce @ 2007-07-12  6:47 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Johannes Sixt <J.Sixt@eudaptics.com> wrote:
> 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.

Finally fixed in git-gui 0.7.5, which I just pushed out.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-12  6:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-10 16:10 [PATCH] Work around a bad interaction between Tcl and cmd.exe with "^{tree}" Johannes Sixt
2007-07-11  8:03 ` Shawn O. Pearce
2007-07-12  6:47 ` Shawn O. Pearce
  -- strict thread matches above, loose matches on Subject: below --
2007-07-10 13:09 Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).