Re: [PATCH 3/8] Clean up work-tree handling
From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:24
Hi, On Fri, 27 Jul 2007, Junio C Hamano wrote:
Now, I think it is fair to say that if your worktree is somewhere totally unrelated to your cwd, no amount of going up will take you to the top. IOW, you have to come down after going up some levels. In such a case, it is easier to code the implementation of --show-cdup to give an absolute path. But in that case you are not even in the working tree to begin with, aren't you? Does git need to support that?
I'd say yes.
It is utterly _inconvenient_ to have to cd to the working tree when you
just want to check the status, for example. And git already knows about
the work-tree!
But you got me convinced about the relative path: it is true that nobody
who has not set core.worktree should be affected.
So I will do something like
if (!inside_work_tree()) {
puts(get_git_work_tree());
continue;
}
[do the old thing of outputting ../../[...]]
In fact, I had this in an unpublished version of the patch, and decided
that I could remove more lines without breaking the test suite.
Heck, I'll even add a test case to make sure that behavior is maintained.
Okay?
Ciao,
Dscho
P.S.: I'll be offline for a few hours, but then come back to finish it up.