From: Junio C Hamano <gitster@pobox.com>
To: Roland Hieber <rhi@pengutronix.de>
Cc: git@vger.kernel.org, Vasco Almeida <vascomalmeida@sapo.pt>
Subject: Re: [PATCH] bisect: allow to run from subdirectories
Date: Mon, 21 Jun 2021 12:43:32 +0900 [thread overview]
Message-ID: <xmqqy2b3j317.fsf@gitster.g> (raw)
In-Reply-To: 20210620213836.10771-1-rhi@pengutronix.de
Roland Hieber <rhi@pengutronix.de> writes:
> Currently, calling 'git bisect' from a directory other than the top
> level of a repository only comes up with an error message:
>
> You need to run this command from the toplevel of the working tree.
>
> After a glance through the bisect code, there seems to be nothing that
> relies on the current working directory, and a few hours of bisect usage
> also didn't turn up any problems. Set the appropriate flag for
> git-sh-setup to remove the error message.
Try to find a history in which to run a bisect that
(1) has a directory T in the recent part of the history, and
(2) does not have that directory in the older part of the history.
Better yet, if the older part of the history has T as a regular
file, that would be ideal. Even better, if that old regular
file T was added, then removed, and then recreated, before it
got turned into a directory.
Now, using the two commits you used to satisfy conditions (1) and
(2) as "bad" and "good", and using "bad - has T as a directory" and
"good - does not have T as a directory", as the bisection criterion,
try to find where "good" turns "bad"---in other words, find the
commit that either creates T as a directory or turns the regular
file T into a directory.
Perform that bisect from the subdirectory T. Would that work? I
suspect it wouldn't; when trying to check out an old version that
does not have T in the directory, either the checkout would fail
because it cannot remove T which has an active process (i.e. your
terminal session) in it, or your process sitting in an orphaned
directory (i.e. your ".." may still be the original top-level
directory that used to have T subdirectory, but "cd T" from the
top-level will not reach where you are). All sorts of things can
go wrong and that is why we forbid it. Just a single "cd" upfront
would save the user a lot of headache.
This does not depend on "do we have T as a directory?" being the
bisection criteria. The important thing is that the current
directory would appear and disappear as the bisection process makes
you jump around in the history.
Hope this helps understanding the issue.
next prev parent reply other threads:[~2021-06-21 3:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-20 21:38 [PATCH] bisect: allow to run from subdirectories Roland Hieber
2021-06-21 0:35 ` Ævar Arnfjörð Bjarmason
2021-06-21 2:00 ` brian m. carlson
2021-06-21 2:10 ` Eric Sunshine
2021-06-21 9:33 ` Roland Hieber
2021-06-21 12:45 ` Ævar Arnfjörð Bjarmason
2021-06-21 20:02 ` Eric Sunshine
2021-06-22 15:27 ` Ævar Arnfjörð Bjarmason
2021-06-22 0:09 ` brian m. carlson
2021-06-21 3:43 ` Junio C Hamano [this message]
2021-06-23 23:40 ` Jeff King
2021-06-29 1:22 ` Junio C Hamano
2021-06-29 2:00 ` Jeff King
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=xmqqy2b3j317.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=rhi@pengutronix.de \
--cc=vascomalmeida@sapo.pt \
/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).