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

Re: [RFC PATCH] hooks--pre-push.sample: identify branch point

From
Antoine Beaupré <anarcat@debian.org>
Date
Mar 12, 2023, 18:14 UTC
Message-ID
<87lek1suqb.fsf@angela.anarc.at>
In-Reply-To
<CAMP44s30GBC7PFovzgaORMLLGYW=1mFVG4WH-dUfUW5-1sMd1Q@mail.gmail.com>
On 2023-03-10 16:09:43, Felipe Contreras wrote:
Show 7 quoted lines
> On Fri, Mar 10, 2023 at 10:28 AM Antoine Beaupré <anarcat@debian.org> wrote:
>>
>> On 2023-03-09 17:22:55, Felipe Contreras wrote:
>> > Hi Antoine,
>> >
>> > On Thu, Mar 9, 2023 at 4:34 PM Antoine Beaupré <anarcat@debian.org> wrote:
>> >
[...]
Show 26 quoted lines
>> > It's interesting how we keep coming back to the same problems; right
>> > now there's a discussion in the git-users mailing list precisely about
>> > the same topic: how to find the branch point, in particular so `git
>> > name-rev` shows the correct branch a commit belongs to (which is
>> > otherwise just a bad guess).
>>
>> Well, it's a need people certainly seem to have. :)
>>
>> I feel we are letting perfection be the enemy of good here. No, there
>> are no solutions that work for the general case, you always find a
>> corner case that breaks it. But what if we could have a simple solution
>> that works for *most* cases and then *fails* gracefully for the corner
>> cases?
>
> I did propose such a solution, I wrote extensive tests to make sure it
> worked properly, but it was largely ignored [2].
>
> The solution with --exclude-first-parent-only fails my tests in a very
> complex case:
>
>    X (master)
>     \
>      A (topic)
>
> Sure, it's probably easy to fix, but the point is that a reliable and
> robust solution everyone agrees with doesn't exist.

Hm... that's odd, I'm surprised that doesn't work. But that's certainly a "special" (!) case that should be handled properly.

[...]
Show 6 quoted lines
>> Or they could even have a per-branch .git/config entry to map the branch
>> to an upstream branch, and *that* could even "default" to "main" or
>> whatever that setting is called now. :)
>
> Sounds like you are talking about the upstream tracking branch [3].
> Are you familiar with that?

No, I'm not refering to branch.NAME.upstream here, sorry if my use of "upstream" here was confusing. I mean "the branch this branch has been forked from" not "the upstream equivalent to this local branch".

a.
-- 
Science knows still practically nothing about the real nature of
matter, energy, dimension, or time; and even less about those
remarkable things called life and thought. But whatever the meaning
and purpose of this universe, you are a legitimate part of it.
                        - Gene Roddenberry
Previous: Felipe ContrerasNext: Felipe Contreras
Message 5 of 6 in “hooks--pre-push.sample: identify branch point”
  1. hooks--pre-push.sample: identify branch pointAntoine Beaupré, Mar 9, 2023
  2. Felipe ContrerasMar 9, 2023
  3. Antoine BeaupréMar 10, 2023
  4. Felipe ContrerasMar 10, 2023
  5. Antoine BeaupréMar 12, 2023
  6. Felipe ContrerasMar 16, 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.