From 4d60e89a99529eda56b9f167295e0ceb3d53a118 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 15 Jun 2020 23:58:17 +0530 Subject: [PATCH] git-update: Use --force when checking out manifest When we have a manifest, we DEFINITELY want exactly that, please throw away any local changes, thanks. Fixes CI: https://gitlab.freedesktop.org/alatiera/gst-ci/-/jobs/3105690 ``` Checking out f5b44d31284cfa1b6d029fdfe69d6cdb9a8aeb36 in gst-devtools Could not rebase subprojects\gst-devtools, please fix and try again. Error: error: Your local changes to the following files would be overwritten by checkout: docs/plugins/fakesrc.simple.validatetest.yaml Please commit your changes or stash them before you switch branches. Aborting Command '['git', 'checkout', '--detach', 'f5b44d31284cfa1b6d029fdfe69d6cdb9a8aeb36']' returned non-zero exit status 1. ``` This is probably caused by some shared cache shenanigans, but forcing is also what we want anyway in this case. Part-of: --- git-update | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git-update b/git-update index 37d9a43..3cd604e 100755 --- a/git-update +++ b/git-update @@ -12,6 +12,8 @@ from scripts.common import get_meson SCRIPTDIR = os.path.normpath(os.path.dirname(__file__)) +# Force a checkout to happen and throw away local changes +FORCE_CHECKOUT = False def manifest_get_commits(manifest): @@ -90,7 +92,9 @@ def update_repo(repo_name, repo_dir, revision, no_interaction, fetch_args=[], re if revision: print("Checking out %s in %s" % (revision, repo_name)) git("fetch", *fetch_args, repository_path=repo_dir) - git("checkout", "--detach", revision, repository_path=repo_dir) + checkout_args = ["--force"] if FORCE_CHECKOUT else [] + checkout_args += ["--detach", revision] + git("checkout", *checkout_args, repository_path=repo_dir) else: print("Updating branch %s in %s" % (get_branch_name(repo_dir), repo_name)) git("pull", "--rebase", repository_path=repo_dir) @@ -187,6 +191,7 @@ if __name__ == "__main__": meson = get_meson() targets_s = subprocess.check_output(meson + ['subprojects', 'download']) repos_commits = manifest_get_commits(options.manifest) + FORCE_CHECKOUT = True else: repos_commits = {} -- 2.7.4