summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-12-27 09:25:19 +0200
committerLars Wirzenius <liw@liw.fi>2023-12-27 09:25:19 +0200
commitdd95c2b380c6259fe38a6cb6113812fdcea96445 (patch)
tree95118eaa6ef3c5e0ef9d12f604bd79522fe5e79f
parent11bb7195106fe80e6fdedbe402c66ac5ce5c0d2d (diff)
downloadwumpus-hunter-dd95c2b380c6259fe38a6cb6113812fdcea96445.tar.gz
fix: how existing clone is updated
Signed-off-by: Lars Wirzenius <liw@liw.fi>
-rwxr-xr-xwumpus-hunter8
1 files changed, 7 insertions, 1 deletions
diff --git a/wumpus-hunter b/wumpus-hunter
index 5a80bda..53e1607 100755
--- a/wumpus-hunter
+++ b/wumpus-hunter
@@ -41,9 +41,10 @@ def get_code(url, ref, dirname):
git_clone(url, dirname)
git_checkout(dirname, ref)
else:
+ git_clean(dirname)
git_checkout(dirname, ref)
git_remote_update(url, dirname)
- git_clean(dirname)
+ git_reset(dirname, ref)
git_status(dirname)
git_show_head(dirname)
@@ -63,6 +64,11 @@ def git_remote_update(url, dirname):
git("remote", "update", cwd=dirname)
+def git_reset(dirname, ref):
+ logging.info(f"reset {dirname} to {ref}")
+ git("reset", "--hard", ref, cwd=dirname)
+
+
def git_clean(dirname):
logging.info(f"remove files not in git in {dirname}")
git("clean", "-fdx", cwd=dirname)