Re: git stash doesn't honor --work-tree or GIT_WORK_TREE

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: git stash doesn't honor --work-tree or GIT_WORK_TREE

From: Thomas Rast <hidden>
Date: 2016-06-15 22:59:21

Øystein Walle [off-list ref] writes:
Aaron Brooks <aaron <at> brooks1.net> writes:
quoted
Unlike other commands, git stash doesn't work outside of the worktree,
even when --work-tree is specified:
[...]
The environment variables are properly exported. I verified this by
adding 'echo $GIT_WORK_TREE; echo $GIT_DIR' at the top of git-stash.sh.
So these should propagate to "child gits" just fine, and so it shouldn't
be necessary to test them explicitly.

The problem seems to be that git rev-parse --is-inside-work-tree does
not honor these. In fact it doesn't even honor --git-dir or --work-tree.
Judging by the name this may be intentional.
Thanks for investigating this.

Duy, you are the expert on the worktree detection logic.  Do you know if
there is a reason for --is-inside-work-tree to not honor the
GIT_WORK_TREE / GIT_DIR overrides?

-- 
Thomas Rast
tr@thomasrast.ch

Re: git stash doesn't honor --work-tree or GIT_WORK_TREE

From: Duy Nguyen <hidden>
Date: 2016-06-15 22:59:21

On Sun, Dec 1, 2013 at 6:12 PM, Thomas Rast [off-list ref] wrote:
Øystein Walle [off-list ref] writes:
quoted
The problem seems to be that git rev-parse --is-inside-work-tree does
not honor these. In fact it doesn't even honor --git-dir or --work-tree.
Judging by the name this may be intentional.
Thanks for investigating this.

Duy, you are the expert on the worktree detection logic.  Do you know if
there is a reason for --is-inside-work-tree to not honor the
GIT_WORK_TREE / GIT_DIR overrides?
It should. At the beginning of cmd_rev_parse(), setup_git_directory()
is called, which will check and follow all GIT_* or their command line
equivalent. I'll look into this some time later.
-- 
Duy

Re: git stash doesn't honor --work-tree or GIT_WORK_TREE

From: Øystein Walle <hidden>
Date: 2016-06-15 22:59:21

Duy Nguyen <pclouds <at> gmail.com> writes:
It should. At the beginning of cmd_rev_parse(), setup_git_directory()
is called, which will check and follow all GIT_* or their command line
equivalent. I'll look into this some time later.
I think I was wrong and rev-parse --is-inside-work-tree *does* honor
them. It prints 'false'. If it hadn't honored them it would have printed
"fatal: Not a git repository (...)".

Øsse
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help