This commit is contained in:
Markus Corazzione 2026-04-24 17:22:34 -05:00 committed by GitHub
commit 5d68d29fdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 51 additions and 6 deletions

11
cli.py
View file

@ -917,11 +917,16 @@ def _cleanup_worktree(info: Dict[str, str] = None) -> None:
# but didn't push.
has_unpushed = False
try:
result = subprocess.run(
["git", "log", "--oneline", "HEAD", "--not", "--remotes"],
remote_refs = subprocess.run(
["git", "for-each-ref", "--format=%(refname)", "refs/remotes"],
capture_output=True, text=True, timeout=10, cwd=wt_path,
)
has_unpushed = bool(result.stdout.strip())
if remote_refs.stdout.strip():
result = subprocess.run(
["git", "log", "--oneline", "HEAD", "--not", "--remotes"],
capture_output=True, text=True, timeout=10, cwd=wt_path,
)
has_unpushed = bool(result.stdout.strip())
except Exception:
has_unpushed = True # Assume unpushed on error — don't delete