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

Re: git gui error with relocated repository

From
Chris Packham <judge.packham@gmail.com>
Date
May 7, 2014, 07:28 UTC
Message-ID
<5369E0A3.4040701@gmail.com>
In-Reply-To
<871tw7xg3o.fsf@fox.patthoyts.tk>
On 07/05/14 00:10, Pat Thoyts wrote:
Show 44 quoted lines
> Chris Packham <judge.packham@gmail.com> writes:
> 
>> On Tue, Apr 29, 2014 at 2:56 PM, Chris Packham <judge.packham@gmail.com> wrote:
>>> Hi Pat,
>>>
>>> I'm running git 2.0.0-rc0 (haven't got round to pulling down rc1 yet)
>>> which includes gitgui-0.19.0 and I'm getting a new error when I run
>>> 'git gui' in a repository with a .git file (created by git submodule).
>>>
>>> I can send you a screencap of the error message off list if you want
>>> but the text is
>>>
>>> "No working directory ../../../<repo>
>>>
>>> couldn't change working directory to ../../../<repo>: no such file or directory"
>>
>> My tcl is a little rusty but I think the problem might be this snippet.
>>
>> # v1.7.0 introduced --show-toplevel to return the canonical work-tree
>> if {[package vsatisfies $_git_version 1.7.0]} {
>>    if { [is_Cygwin] } {
>>        catch {set _gitworktree [exec cygpath --windows [git rev-parse
>> --show-toplevel]]}
>>    } else {
>>        set _gitworktree [git rev-parse --show-toplevel]
>>    }
>> } else {
>>    # try to set work tree from environment, core.worktree or use
>>    # cdup to obtain a relative path to the top of the worktree. If
>>    # run from the top, the ./ prefix ensures normalize expands pwd.
>>    if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {
>>        set _gitworktree [get_config core.worktree]
>>        if {$_gitworktree eq ""} {
>>            set _gitworktree [file normalize ./[git rev-parse --show-cdup]]
>>        }
>>    }
>> }
>>
>> The  vsatisfies call probably doesn't handle '2.0.0.rc0' and the
>> fallback behaviour probably needs to normalise core.worktree
>>
> 
> The _git_version variable has already been trimmed to remove such
> suffixes so the version comparison here will be ok. 

I don't think that's true 'git rev-parse --show-toplevel' does the right thing - if it's run.

Show 5 quoted lines
> It looks more likely
> to be something to do with the .git being a file with a link being
> mishandled. How did you setup this test repository with its link to a
> parent?
>

It's just a git clone of the parent and a git submodule init. A subtle thing to notice is that config.worktree is relative to $GIT_DIR. All the configuration was done by git without any intervention from me.

Show 19 quoted lines
>>>
>>> Here's some other info that might help
>>>
>>>   $ git --version
>>>   git version 2.0.0.rc0
>>>
>>>   $ cat .git
>>>   gitdir: ../.git/modules/<repo>
>>>
>>>   $ git rev-parse --git-dir
>>>   /home/chris/src/<super>/.git/modules/<repo>
>>>
>>>   $ git config core.worktree
>>>   ../../../<repo>
>>>
>>> Thanks,
>>> Chris
>>
> 
Previous: Pat ThoytsNext: Chris Packham
Message 5 of 16 in “git gui error with relocated repository”
  1. Chris PackhamApr 29, 2014
  2. Chris PackhamApr 29, 2014
  3. git-gui: unconditionally use rev-parse --show-toplevelChris Packham, Apr 29, 2014
  4. Pat ThoytsMay 6, 2014
  5. Chris PackhamMay 7, 2014
  6. Chris PackhamMay 7, 2014
  7. git-gui: use vcompare when comparing the git versionJens Lehmann, May 13, 2014
  8. Chris PackhamMay 14, 2014
  9. Jens LehmannMay 14, 2014
  10. Junio C HamanoMay 14, 2014
  11. Junio C HamanoMay 14, 2014
  12. Pat ThoytsMay 17, 2014
  13. git-gui: tolerate major version changes when comparing the git versionJens Lehmann, May 17, 2014
  14. Chris PackhamMay 18, 2014
  15. Eric SunshineMay 18, 2014
  16. Junio C HamanoMay 19, 2014

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.