Subject: Re: [PATCH v13 8/9] fetch: set remote/HEAD if it does not exist

From: Junio C Hamano <[email-masked]>
Date: Wed, 20 Nov 2024 11:28:17 +0900

Junio C Hamano <[email-masked]> writes:

> "Bence Ferdinandy" <[email-masked]> writes:
>
>> Your suggestion seems to be the original tri-state configuration that came up
>> in one of the original discussions. It was recently requested again for fetch
>> to just do this automatically
>> (https://lore.kernel.org/git/CAAHKNRGv19rhnqCkJMpE2FomNQBHvSS36aC=[email-masked]),
>> so at least some people would like to have this fully automated.
>
> And that is *not* the only option, and I am trying to help others
> by preventing unconditional warning messages from annoying them.

By the way, because I've left it out from my messages, some folks
who are reading from sideways might not realize this, so let's make
it a bit more explicit.  One thing to note is that the assumption
that HEAD at the remote rarely changes _only_ holds for forges and
the like, a typically bare repository used for publishing without a
working tree.

If you have a clone from a repository with a working tree (this
happens when you have two places to work, either on two machines or
two separate repositories on a same machine) to allow you to work
here during the day and work there after work, the HEAD at the clone
source may change to the branch you happen to be working on when
left there.  In such a setting, it is reasonable to make the
repositories aware of each other (i.e. the after-work repository may
have refs/remotes/at-work/* remote-tracking branches while the
at-work repository keeps refs/remotes/after-work/* remote-tracking
branches, to keep track of each other), and "git fetch" that warns
every time it notices the remote end has HEAD pointing at a
different branch would be annoying, as they would likely be working
on different "project" when they leave after work.

Users who fall outside of a typical "we have a central repository
and the only interaction with the repository is we clone and
fetch/pull from it and nothing else" hosting site setting, are why
I'll encourage folks to tread carefully when they are tempted to
make anything unconditional.

Thanks.