diff mbox series

[22/22,v3] support/download: force fetching tags

Message ID e79a13c69b3717a5a56d0af58d2e905c98af1c2f.1714858818.git.yann.morin.1998@free.fr
State Accepted
Headers show
Series support/download: extend download features and reproducibility (branch yem/git-attributes-2) | expand

Commit Message

Yann E. MORIN May 4, 2024, 9:40 p.m. UTC
Our git download backend switches the remote of our local clone, and
fetches all refs and tags from that remote.

When the local clone has a tag fetched from another remote, and the new
remote also has a tag by the same name, and that tag points to another
commit, then git refuses to fetch the new tag and exit in error, as it
consider that the new tag would clobber the existing one. This is a safe
and sane behaviour when run interactively with a human that can take a
decision.

However, in our case, we don't care what tag is eventually used, as
only\the last one makes sense in our case: the one from the remote the
user has requested for the current build.

Tell git to forcefully pull tags, even if they woudl clobber existing
ones.

Note that, although this changes the git backend, it does not change the
content of generated archives, so we do not need to bump the suffix
version.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 support/download/git | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/support/download/git b/support/download/git
index 8134c07214..d49016e90c 100755
--- a/support/download/git
+++ b/support/download/git
@@ -132,7 +132,7 @@  _git remote set-url origin "'${uri}'"
 
 printf "Fetching all references\n"
 _git fetch origin
-_git fetch origin -t
+_git fetch origin -t -f
 
 # Try to get the special refs exposed by some forges (pull-requests for
 # github, changes for gerrit...). There is no easy way to know whether