git rev-parse --show-toplevel doesn't work inside git-dir

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

git rev-parse --show-toplevel doesn't work inside git-dir

From: Orgad Shaneh <hidden>
Date: 2016-06-15 22:57:33

Running "git rev-parse --show-toplevel" doesn't print anything when it
is run inside .git dir (on all levels)

- Orgad

Re: git rev-parse --show-toplevel doesn't work inside git-dir

From: Jeff King <hidden>
Date: 2016-06-15 22:57:34

On Wed, Jun 05, 2013 at 10:34:11AM +0300, Orgad Shaneh wrote:
Running "git rev-parse --show-toplevel" doesn't print anything when it
is run inside .git dir (on all levels)
This is by design. "--show-toplevel" does not print anything when you
do not have a working tree, and you do not have one if you are inside
the .git directory. If you were to do:

  cd .git
  git --work-tree=.. rev-parse --show-toplevel

(or use GIT_WORK_TREE, or set core.worktree, etc), you would get back
the toplevel of the working tree.

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