On 2008-10-19, at 23:02, Jeff King wrote:
I took a closer look at this. I'm not sure that there is actually a
problem with moving the cd_to_toplevel before require_work_tree.
cd_to_toplevel makes sure there is actually something to cdup to. In
my
test without a work-tree, "git rev-parse --show-cdup" simply printed
nothing, causing no "cd" to occur.
I won't speculate on whether moving cd_to_toplevel up will introduce
problem or not. I am not familiar with git internals, and I just
repeat an opinion gathered on #git. However, -C seem to be better
suited for simple cases, conceptually cleaner, and may make the
learning curve a bit less steep. There is no need for consdering all
possible --work-tree/--git-dir combinations and their implications, it
is possible just to say "cd there, and act as usual".
So:
1. I think we can fix this breakage by swapping the two.
I can prepare a patch if that's expected, but probably I won't
understand what it exactly does and what are implications of this
change.
2. There is still breakage in other scripts, some of which may need
quite in-depth fixes (e.g., git-bisect requires a work tree but
does not chdir at all. For the require_work_tree test to work, it
needs to be inside the work tree, and the script will need a
careful looking over to see what ramifications that has).
I really don't think I'm competent enough to fix more complex cases
without breaking twice as many things; I don't feel confident even
with a simple swap in git-pull at the moment
3. I think your -C option has some merit independent of this, since
it allows you to chdir and still use the usual lookup rules (e.g.,
see if it is bare vs a regular repository). But I don't feel
strongly about it one way or the other.
In my use case, it definitely has merits as it makes git behave
exactly as if user himself wrote "git pull" inside the work tree, and
I am still not sure wheter expected --work-tree/--git-dir combinations
would behave the same. Probably I'll need to add more commands and
more complex use cases as I develop cl-librarian, and -C would make
this job way easier.
Regards,
Maciej.
--
-><- Maciej Pasternacki -><- http://www.pasternacki.net/ -><-
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html