threads / bug / 22693

[BUG] git-gui blame: "Show History Context" is broken

Subject: [BUG] git-gui blame: "Show History Context" is broken

## tl;dr

3 messages between Feb 17, 2010 and Feb 19, 2010.

replies: 2people: 2as markdown or json

Kirill Smelkov· Feb 17, 2010, 12:13 UTC · lore
Git-gui as shipped with todays git.git master is a bit broken:
in git.git master (v1.7.0-29-g6d81630), try running:
    $ git gui blame xdiff-interface.h

Then select first line 'd9ea d9ea 1 #ifndef XDIFF_INTERFACE_H', right click to popup context menu, select "Show History Context" -->

--> git gui errors with:
    "Error: couldn't change working directory to "": no ...

Thanks, Kirill

Pat Thoyts· Feb 18, 2010, 02:11 UTC · re: Kirill Smelkov · lore

[PATCH] Handle failure of core.worktree to identify the working directory.

Commit 21985a11 'git-gui: handle non-standard worktree locations' attempts to use either GIT_WORK_TREE or core.worktree to set the _gitworktree variable but these may not be set which leads to a failure to launch gitk to review history. Use _gitdir to set the location for a standard git layout where the parent of the .git directory is the working tree.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
Show 16 quoted lines
>Git-gui as shipped with todays git.git master is a bit broken:
>
>in git.git master (v1.7.0-29-g6d81630), try running:
>
>    $ git gui blame xdiff-interface.h
>
>Then select first line 'd9ea d9ea   1 #ifndef XDIFF_INTERFACE_H', right
>click to popup context menu, select "Show History Context" -->
>
>--> git gui errors with:
>
>    "Error: couldn't change working directory to "": no ...
>
>
>Thanks,
>Kirill
 git-gui.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index 8996d2d..ec81b15 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1158,6 +1158,9 @@ apply_config
 # try to set work tree from environment, falling back to core.worktree
 if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {
 	set _gitworktree [get_config core.worktree]
+	if {$_gitworktree eq ""} {
+		set _gitworktree [file dirname [file normalize $_gitdir]]
+	}
 }
 if {$_prefix ne {}} {
 	if {$_gitworktree eq {}} {
-- 
1.6.5.1.1367.gcd48


-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD
Kirill Smelkov· Feb 19, 2010, 13:55 UTC · re: Pat Thoyts · lore

Re: [PATCH] Handle failure of core.worktree to identify the working directory.

On Thu, Feb 18, 2010 at 02:11:21AM +0000, Pat Thoyts wrote:
Show 7 quoted lines
> Commit 21985a11 'git-gui: handle non-standard worktree locations' attempts
> to use either GIT_WORK_TREE or core.worktree to set the _gitworktree
> variable but these may not be set which leads to a failure to launch
> gitk to review history. Use _gitdir to set the location for a standard
> git layout where the parent of the .git directory is the working tree.
> 
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Now it works, thanks.
Tested-by: Kirill Smelkov <kirr@mns.spb.ru>
Show 34 quoted lines
> >Git-gui as shipped with todays git.git master is a bit broken:
> >
> >in git.git master (v1.7.0-29-g6d81630), try running:
> >
> >    $ git gui blame xdiff-interface.h
> >
> >Then select first line 'd9ea d9ea   1 #ifndef XDIFF_INTERFACE_H', right
> >click to popup context menu, select "Show History Context" -->
> >
> >--> git gui errors with:
> >
> >    "Error: couldn't change working directory to "": no ...
> >
> >
> >Thanks,
> >Kirill
> 
>  git-gui.sh |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/git-gui.sh b/git-gui.sh
> index 8996d2d..ec81b15 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -1158,6 +1158,9 @@ apply_config
>  # try to set work tree from environment, falling back to core.worktree
>  if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {
>  	set _gitworktree [get_config core.worktree]
> +	if {$_gitworktree eq ""} {
> +		set _gitworktree [file dirname [file normalize $_gitdir]]
> +	}
>  }
>  if {$_prefix ne {}} {
>  	if {$_gitworktree eq {}} {

← back to recent threads