mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user