From: Junio C Hamano <gitster@pobox.com>
To: Emily Shaffer <nasamuffin@google.com>
Cc: "Michał Mirosław" <emmir@google.com>, git@vger.kernel.org
Subject: Re: includeIf not matching during `git rebase`
Date: Tue, 25 Jul 2023 16:15:26 -0700 [thread overview]
Message-ID: <xmqqila7h9bl.fsf@gitster.g> (raw)
In-Reply-To: <CAJoAoZnuLxyQ7ufUTrK4mBJ_4sQoyPCqJD9eeS8XfquWue1xQA@mail.gmail.com> (Emily Shaffer's message of "Tue, 25 Jul 2023 13:28:08 -0700")
Emily Shaffer <nasamuffin@google.com> writes:
> emilyshaffer@podkayne:~/git [libification-style|REBASE 3/4]$ git
> branch | head -n1
> * (no branch, rebasing libification-style)
>
> It looks like to log that error, we're using a cached branch name (and
> pick that up from wt_status_get_state and eventually
> wt_status_check_rebase, which checks
> .git/rebase-(merge|apply)/head-name).
>
> However, when we check the current branch for includeif.onbranch
> (config.c:include_by_branch()) we're using resolve_ref_unsafe("HEAD"),
> which doesn't check the current rebase state the way that the
> wt_status_* stuff does.
>
> Does that mean that the config machinery should also be using
> wt_status to determine which branch to use?
Not really. The low-level config machinery shouldn't rely on a
piece of information from so high a layer (making call to
wt_status.c or spawning "git status" is an absolute no-no).
But "we are not exactly on branch X, but doing work on behalf of
branch X" is a common situation during rebase and possibly bisect,
and I agree that it is a good future direction to introduce a
reliable low-level primitive to notice that condition.
I however am hesitant to fully support such an idea, because I
suspect that there may be cases such as "we are technically on
branch Y, but actually doing work on behalf of branch X" or worse
yet "we are on branch Z, but actually doing work on behalf of both
branches X and Y", where there are more than one plausible branch,
which is different from what HEAD points at, that
include_by_branch() could use.
Thanks.
next prev parent reply other threads:[~2023-07-25 23:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 19:49 includeIf not matching during `git rebase` Michał Mirosław
2023-07-25 20:28 ` Emily Shaffer
2023-07-25 23:15 ` Junio C Hamano [this message]
2023-07-27 18:08 ` Glen Choo
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=xmqqila7h9bl.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=emmir@google.com \
--cc=git@vger.kernel.org \
--cc=nasamuffin@google.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).