From: Jeff King <peff@peff.net>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [RFC] require-work-tree wants more than what its name says
Date: Wed, 4 May 2011 04:50:14 -0400 [thread overview]
Message-ID: <20110504085014.GA9739@sigill.intra.peff.net> (raw)
In-Reply-To: <4DC112A1.5090805@drmicha.warpmail.net>
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
next prev parent reply other threads:[~2011-05-04 8:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 23:33 [RFC] require-work-tree wants more than what its name says Junio C Hamano
2011-05-04 7:38 ` Jeff King
2011-05-04 15:42 ` Junio C Hamano
2011-05-04 21:28 ` Jeff King
2011-05-05 2:11 ` Junio C Hamano
2011-05-05 4:23 ` Jeff King
2011-05-05 4:28 ` Jeff King
2011-05-05 11:15 ` Sverre Rabbelier
2011-05-05 17:31 ` Junio C Hamano
2011-05-04 8:47 ` Michael J Gruber
2011-05-04 8:50 ` Jeff King [this message]
2011-05-04 15:47 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110504085014.GA9739@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).