fix(update): address review of the index.lock fix

- The automatic update's status check now sets GIT_OPTIONAL_LOCKS=0
  whichever runner it is given, not only the default one.
- Update Code no longer runs `git rebase --abort` on any rebase dir: a
  rebase in progress (detached HEAD) holds the user's conflict work and
  blocks the update; an abandoned one is dropped with `rebase --quit`,
  as the automatic update does, and a failure to clear it stops the update.
- run_git waits out the lock-freshness window after stopping a timed-out
  git, so a lock created just before the timeout is not left behind.
- Mark the Popen/subprocess use with the repo's nosec comments.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-10-29 11:44:41 -04:00
co-authored by Claude Sonnet 5.5
parent e506c1b576
commit 67b373fca0
4 changed files with 118 additions and 10 deletions
+2 -2
View File
@@ -303,11 +303,11 @@ def local_changes(project_dir, run=None, timeout=30):
``run`` raises (e.g. ``subprocess.TimeoutExpired``).
"""
# A status that times out must not leave index.lock: don't refresh the index.
extra = {} if run else {'env': git_index_lock.read_only_env()}
run = run or git_index_lock.run_git
result = run(['git', '-c', 'core.fileMode=false', 'status', '--porcelain',
'--untracked-files=no', '-z'],
cwd=str(project_dir), capture_output=True, text=True, timeout=timeout, **extra)
cwd=str(project_dir), capture_output=True, text=True, timeout=timeout,
env=git_index_lock.read_only_env())
if result.returncode != 0:
return None
changed = []