From 092c922377be49b5fc059c6c8f64742006d8480e Mon Sep 17 00:00:00 2001 From: Sudeep Holla Date: Thu, 17 Oct 2024 12:17:21 +0100 Subject: [PATCH] config: Fix git reset arguments for force sync Currently if the git revision specified it a tag, this issue gets unnoticed as the git checkout prior to git reset does the right job of checking out the right source and `git tag -l` resolves to success which means `git reset --hard` step is skipped. However when the commit hash is specified, while the checkout is successful the `git tag -l` resolves to false and `git reset --hard` is executed which doesn't like or accept the remote name in the index/tag. So fix it my dropping the remote name `origin` in the reset step. Cc: Jean-Philippe Brucker Signed-off-by: Sudeep Holla --- shrinkwrap/utils/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shrinkwrap/utils/config.py b/shrinkwrap/utils/config.py index 2e03147..5c30293 100644 --- a/shrinkwrap/utils/config.py +++ b/shrinkwrap/utils/config.py @@ -931,7 +931,7 @@ def build_graph(configs, echo, nosync, force_sync): git remote set-url origin {gitremote} git fetch {gitargs}--prune --prune-tags --force --recurse-submodules=off origin git checkout {gitargs}--force {gitrev} - [ $(git tag -l {gitrev}) ] || git reset {gitargs}--hard origin/{gitrev} + [ $(git tag -l {gitrev}) ] || git reset {gitargs}--hard {gitrev} git submodule {gitargs}sync --recursive git submodule {gitargs}update --init --checkout --recursive --force '''.strip() -- GitLab