From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC] require-work-tree wants more than what its name says
Date: Wed, 4 May 2011 03:38:50 -0400 [thread overview]
Message-ID: <20110504073850.GA8512@sigill.intra.peff.net> (raw)
In-Reply-To: <7vhb9bgy0a.fsf@alter.siamese.dyndns.org>
On Tue, May 03, 2011 at 04:33:41PM -0700, Junio C Hamano wrote:
> But the implementation of require_work_tree we have today is quite
> different. I don't have energy to dig the history, but currently it says:
>
> test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true ||
> die "fatal: $0 cannot be used without a working tree."
>
> Which is completely bogus. Even though we may happen to be just outside
> of it right now, we may have a working tree that we can cd_to_toplevel
> back to.
Yeah, I ran into this just recently when converting merge-one-file to
use git-sh-setup. I was surprised that require_work_tree also required
one to be inside it. My solution was to call cd_to_toplevel first, as
you noted.
> I think the right solution would be to apply the attached patch; and then
> audit all the callers that call "require_work_tree" to see if any of them
> meant "No, it is not Ok just to have working tree somewhere! I want you to
> be IN that working tree when you call me", and convert them to call the
> new require_to_be_in_work_tree instead.
Your proposed semantics for require_work_tree make much more sense to
me, but I worry about compatibility. We can audit our in-tree scripts,
but git-sh-setup is part of the recommended API for external scripts,
no? This change might break those scripts, so we would need to do the
usual deprecation thing. I'm also concerned that the breakage might be
pretty severe. As in, not just "script doesn't work" but "script
silently produces incorrect results" or "script deletes data".
For example, the merge-one-file bug I fixed recently was silently
producing bogus merges because of a confusion over whether it was in the
workdir. Something like "git clean" would be even worse.
-Peff
next prev parent reply other threads:[~2011-05-04 7:38 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 [this message]
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
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=20110504073850.GA8512@sigill.intra.peff.net \
--to=peff@peff.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).