Run every claude the loop starts in a Claude home generated outside the clone
CI / tests (pull_request) Successful in 4m45s
CI / tests (pull_request) Successful in 4m45s
This commit is contained in:
+2
-13
@@ -15,9 +15,6 @@ def moved_to_newest(clone: str) -> str | Failure:
|
||||
return tag
|
||||
if tag is None:
|
||||
return Failure(f"{clone}'s origin has no v* tag to move to")
|
||||
# Re-reads each file through the clean filter, so a model pick alone leaves settings.json unchanged.
|
||||
if isinstance(refreshed := git("update-index", "-q", "--refresh", cwd=clone), Failure):
|
||||
return refreshed
|
||||
listed = git("diff", "--name-only", "-z", "HEAD", cwd=clone)
|
||||
if isinstance(listed, Failure):
|
||||
return listed
|
||||
@@ -34,15 +31,9 @@ def moved_to_newest(clone: str) -> str | Failure:
|
||||
return f"{clone} is already on {tag}, the newest release."
|
||||
if isinstance(git("merge-base", "--is-ancestor", "HEAD", tag, cwd=clone), Failure):
|
||||
return Failure(f"{tag} doesn't hold {clone}'s commit, so the move would drop work no release holds: cut a release that holds it first")
|
||||
settings_changed = isinstance(git("diff", "--quiet", "HEAD", tag, "--", "settings.json", cwd=clone), Failure)
|
||||
# The tag holds each uncommitted change, so undoing them doesn't lose anything, and lets the move below take the tag's copy.
|
||||
# A settings.json the clean filter shows unchanged may still differ on disk, by a model pick or Claude Code's key order, which checkout refuses to overwrite; the pick is asked for again below.
|
||||
tracked = git("ls-files", "-z", "--", "settings.json", cwd=clone)
|
||||
if isinstance(tracked, Failure):
|
||||
return tracked
|
||||
set_aside = sorted({*changed, *names(tracked)} if settings_changed else set(changed))
|
||||
if set_aside:
|
||||
restored = git("checkout", "--quiet", "HEAD", "--", *set_aside, cwd=clone)
|
||||
if changed:
|
||||
restored = git("checkout", "--quiet", "HEAD", "--", *changed, cwd=clone)
|
||||
if isinstance(restored, Failure):
|
||||
return restored
|
||||
moved = git("checkout", "--quiet", "--detach", tag, cwd=clone)
|
||||
@@ -50,8 +41,6 @@ def moved_to_newest(clone: str) -> str | Failure:
|
||||
return moved
|
||||
changelog = git("show", f"{tag}:CHANGELOG.md", cwd=clone)
|
||||
lines = [f"Moved {clone} from {old_tag or 'an untagged commit'} to {tag}."]
|
||||
if settings_changed:
|
||||
lines.append("settings.json changed: pick the model again with /model.")
|
||||
if not isinstance(changelog, Failure):
|
||||
lines += newer_sections(changelog, old_tag)
|
||||
return "\n\n".join(lines)
|
||||
|
||||
Reference in New Issue
Block a user