Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: `git rev-parse --is-inside-work-tree` and $GIT_WORK_TREE

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:09:06

Jeff King [off-list ref] writes:
On Tue, Mar 29, 2016 at 08:08:29AM -0700, Junio C Hamano wrote:
quoted
So it is a misconfiguration if you only set GIT_WORK_TREE without
setting GIT_DIR.
Hmm. I have frequently done this when my cwd is a git repository (e.g.,
a bare one), and it works as you'd expect (find the git-dir in the
current path, then the working tree via $GIT_WORK_TREE).
Hmm, does what is done by "git add HEAD" in such a situation match
what you'd expect?

        git init work
        cd work; date >HEAD; git commit -m initial
        git push ../bare master:master
	date >>HEAD
        export GIT_WORK_TREE=$(pwd)
	cd ..
	git --bare init bare
	cd bare
	git add HEAD

I'd have to say that this invites unnecessary confusion, even though
I agree that "go to the GIT_WORK_TREE and take pathspecs relative to
that directory" is the only sensible thing for us to be doing.

But that is not an issue about "set only work-tree" (it is about
"run from outside the work-tree").
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help