diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2021-03-21 04:23:04 +0100 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2021-05-05 22:42:30 +0200 |
commit | 416cd66e296d9bd726fc5fe426bcd2bdf7922117 (patch) | |
tree | 63a4fe2dcab4310d9774d93b1358040842f4b7e5 /maintainers/scripts | |
parent | a7afb378d5c2928d7ef7574eb30c74970f15f2cc (diff) | |
download | nixpkgs-416cd66e296d9bd726fc5fe426bcd2bdf7922117.tar nixpkgs-416cd66e296d9bd726fc5fe426bcd2bdf7922117.tar.gz nixpkgs-416cd66e296d9bd726fc5fe426bcd2bdf7922117.tar.bz2 nixpkgs-416cd66e296d9bd726fc5fe426bcd2bdf7922117.tar.lz nixpkgs-416cd66e296d9bd726fc5fe426bcd2bdf7922117.tar.xz nixpkgs-416cd66e296d9bd726fc5fe426bcd2bdf7922117.tar.zst nixpkgs-416cd66e296d9bd726fc5fe426bcd2bdf7922117.zip |
maintainers/scripts/update.nix: Ensure the worktree is clean
When an update script fails, it might still modify the source tree. These changes would then be committed in the next update attempt. Let’s make sure the worktree is clean before updating to avoid that.
Diffstat (limited to 'maintainers/scripts')
-rw-r--r-- | maintainers/scripts/update.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/maintainers/scripts/update.py b/maintainers/scripts/update.py index 8cc2bcbd67c..eb26a472e92 100644 --- a/maintainers/scripts/update.py +++ b/maintainers/scripts/update.py @@ -39,6 +39,9 @@ async def run_update_script(nixpkgs_root: str, merge_lock: asyncio.Lock, temp_di if temp_dir is not None: worktree, _branch = temp_dir + # Ensure the worktree is clean before update. + await check_subprocess('git', 'reset', '--hard', '--quiet', 'HEAD', cwd=worktree) + # Update scripts can use $(dirname $0) to get their location but we want to run # their clones in the git worktree, not in the main nixpkgs repo. update_script_command = map(lambda arg: re.sub(r'^{0}'.format(re.escape(nixpkgs_root)), worktree, arg), update_script_command) |