Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH 2/3] vcs_info/cvs: set vcs_comm[basedir] in VCS_INFO_detect_cvs
On Tue, Nov 26, 2019 at 10:52 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> Aleksandr Mezin wrote on Tue, 26 Nov 2019 01:28 +00:00:
> > On Tue, Nov 26, 2019 at 7:26 AM Aleksandr Mezin
> > <mezin.alexander@xxxxxxxxx> wrote:
> > >
> > > On Mon, Nov 25, 2019 at 2:17 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > > > Two, as I pointed out in reply to an offlist response, the existence of
> > > > $GIT_DIR and $GIT_WORK_TREE means that the two VCS's basedirs need not
> > > > be in a parent dir – subdir relationship with each other; they can be
> > > > /foo/bar and /foo/baz.
> > >
> > > How is it possible?
>
> % cd "$(mktemp -d)"
> % hg init foo
> % git init bar
> % cd foo
> [shows hg info]
> % export GIT_WORK_TREE=${PWD/foo/bar} GIT_DIR=${PWD/foo/bar}/.git
> [shows git info]
> %
Interesting. I didn't notice that GIT_INFO_detect_git checks the exit
code of `git rev-parse --is-inside-work-tree`, not the actual value.
You don't even need to set GIT_WORK_TREE, GIT_DIR is enough.
But should it work like that?
>
> > > in a git repository
> > >
> > > $ GIT_WORK_TREE=../other-dir git rev-parse --is-inside-work-tree
> > > false
> > >
> > > Work tree root should be a parent of cwd, otherwise `rev-parse
> > > --is-inside-work-tree` returns false -> git repository not detected.
> > > And there is only one path from cwd to the root -> all parents of cwd
> > > are parents or subdirs to each other.
> >
> > I meant "there is only one path from cwd to /" in the last sentence.
> >
>
> Cheers,
>
> Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author