From 3d2e0188890648ac02874667c2d9f6ae0e3d65ce Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Tue, 1 May 2018 10:44:13 +0200 Subject: [PATCH] download/git: ensure we checkout to a clean state Force the checkout to ignore and throw away any local changes. This allows recovering from a previous partial checkout (e.g. killed by the user, or by a CI job...) git checkout -f has been supported since the inception of git, so we can use it without any second thought. Also do a forced-forced clean, to really get rid of all untracked stuff. Signed-off-by: "Yann E. MORIN" Cc: Maxime Hadjinlian Cc: Ricardo Martincoski Cc: Thomas Petazzoni Cc: Arnout Vandecappelle Reviewed-by: Ricardo Martincoski Tested-by: Ricardo Martincoski Signed-off-by: Thomas Petazzoni --- support/download/git | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/support/download/git b/support/download/git index 39e57aac34..c88249ee63 100755 --- a/support/download/git +++ b/support/download/git @@ -154,7 +154,11 @@ fi # Checkout the required changeset, so that we can update the required # submodules. -_git checkout -q "'${cset}'" +_git checkout -f -q "'${cset}'" + +# Get rid of now-untracked directories (in case a git operation was +# interrupted in a previous run). +_git clean -ffdx # Get date of commit to generate a reproducible archive. # %cD is RFC2822, so it's fully qualified, with TZ and all.