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

Re: [RFC] require-work-tree wants more than what its name says

From: Jeff King <hidden>
Date: 2016-06-15 22:51:09

On Wed, May 04, 2011 at 10:47:29AM +0200, Michael J Gruber wrote:
The only thing I can imagine doing right now is changing
require_work_tree() to actually cd to toplevel when possible, so that
(like before) on success we're really within. But that changes cwd, of
course. In summary, a require_work_tree() now can have three assumptions
when it returns with success:

- we have a worktree
- we are within worktree
- cwd has not changed

I'd rather break the last one than the second one, but breaking any may
be a problem, depending on the caller.
Check out some of the older scripts in contrib/examples. Several of them
require_work_tree, but do not cd_to_toplevel immediately; instead, they
do it much later for some specific bits.

I didn't go through and analyze what would happen in each case if we did
the cd_to_toplevel first. I suspect some of it would be pretty mild
breakage (like "git commit -F foo" not finding "foo"). But it would be
breakage nonetheless.

-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