git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: includeIf not matching during `git rebase`

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 25, 2023, 23:15 UTC
Message-ID
<xmqqila7h9bl.fsf@gitster.g>
In-Reply-To
<CAJoAoZnuLxyQ7ufUTrK4mBJ_4sQoyPCqJD9eeS8XfquWue1xQA@mail.gmail.com>
Emily Shaffer <nasamuffin@google.com> writes:
Show 16 quoted lines
> 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.
Previous: Emily ShafferNext: Glen Choo
Message 3 of 4 in “includeIf not matching during `git rebase`”
  1. Michał MirosławJul 25, 2023
  2. Emily ShafferJul 25, 2023
  3. Junio C HamanoJul 25, 2023
  4. Glen ChooJul 27, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.