git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Bence Ferdinandy <bence@ferdinandy.com>,  git@vger.kernel.org
Subject: Re: feature request: set remote/HEAD with fetch
Date: Fri, 16 Aug 2024 15:10:21 -0700	[thread overview]
Message-ID: <xmqqplq8jf02.fsf@gitster.g> (raw)
In-Reply-To: <Zr_KtAXQuFwEmFfI@tapette.crustytoothpaste.net> (brian m. carlson's message of "Fri, 16 Aug 2024 21:55:00 +0000")

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

>> My current workaround is an alias:
>>     fetchall = !git fetch --all && git remote | xargs -i git remote set-head -a {}
>> 
>> which works for me, but I think it would be more elegant not to have to do this.
>
> I believe this would be a valuable change.  I know a lot of other users
> want this features as well.  However, I think it needs to be opt-in,
> since there are some cases where you want `git fetch` to specifically
> fetch only certain objects or don't want to modify the refs. For
> example, I know some server-side implementations use `git fetch`
> internally and require refs to be updated in a special way, and they
> would not appreciate extra refs appearing.

Yeah, "remote set-head" implementation internally uses the same
"what's the current state of the refs on the other side?" query as
what "fetch" does when it contacts the other side, so it makes sense
for a new feature "git fetch --set-head ..." to internally do what
is done by "remote set-head".

What should *not* happen automatically without an opt-in is to
overwrite an existing refs/remotes/$remote/HEAD with a new value.
It might even make sense to allow it to happen, even if the
"--set-head" option is not given from the command line, if
"refs/remotes/$remote/HEAD" does not exist.

Thanks.






  reply	other threads:[~2024-08-16 22:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-16 11:53 feature request: set remote/HEAD with fetch Bence Ferdinandy
2024-08-16 21:55 ` brian m. carlson
2024-08-16 22:10   ` Junio C Hamano [this message]
2024-08-17  5:02   ` Jeff King
2024-08-17 19:00     ` Bence Ferdinandy
2024-08-19 16:40       ` Johannes Schindelin
2024-08-20 21:38         ` Bence Ferdinandy

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=xmqqplq8jf02.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=bence@ferdinandy.com \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.net \
    /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).