]> git.ipfire.org Git - thirdparty/git.git/commit
fetch: make set_head() call easier to read
authorJeff King <peff@peff.net>
Fri, 4 Apr 2025 08:58:12 +0000 (04:58 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Apr 2025 16:03:47 +0000 (09:03 -0700)
commitf9356f9cb4c2c9c6baab30c1a8579445fddfe502
treeef7cb42343765c0021787efd27f7307f1440ad9b
parentaab0f899d9349bed824bf545b7398ab16c27a204
fetch: make set_head() call easier to read

We ignore any error returned from set_head(), but 638060dcb9 (fetch
set_head: refactor to use remote directly, 2025-01-26) left its call in
a noop "if" conditional as a sort of note-to-self.

When c834d1a7ce (fetch: only respect followRemoteHEAD with configured
refspecs, 2025-03-18) added a "do_set_head" flag, it was rolled into the
same conditional, putting set_head() on the right-hand side of a
short-circuit AND.

That's not wrong, but it really hides the point of the line, which
is (maybe) calling the function.

Instead, let's have a full if() block for the flag, and then our comment
(with some rewording) will be sufficient to clarify the error handling.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c