mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-29 11:24:08 +01:00
fix(pregate): a --base that names a commit gets a branch fix, not an impossible fetch (#3269)
gstack-pregate --base <sha> refused with "fix: git fetch origin <sha> --depth=1". That fetch can never create origin/<sha>: a short SHA fails with "couldn't find remote ref", and a full SHA only reaches FETCH_HEAD. A fork clone hits the same wall with --base upstream/main. When origin/<base> does not resolve but <base> names a commit here and no local branch (a SHA, a tag, another remote's ref), the refusal now says --base takes a branch name on origin and suggests origin/HEAD's branch. A local branch, or a name that resolves nowhere, keeps the fetch fix: that is the unfetched or shallow checkout it repairs. Same code, same exit 3, and pin files are still read only from the reviewed origin/<base>. Fixes #3269 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d5eabd8834
commit
f8232a1067
4 files changed
+61
-8
No files matched your search
@@ -2360,6 +2360,12 @@ working-tree file silently.
|
||||
branch's own file deliberately, pass `--policy-from head --allow-repo-commands`;
|
||||
the receipt then says `policy: head (unreviewed)`.
|
||||
|
||||
`--base` names a branch on `origin`. A commit SHA, a tag or another remote's
|
||||
ref (`upstream/main` in a fork clone) never resolves as `origin/<base>`, and
|
||||
fetching it cannot create that ref, so pass a branch that exists on `origin`
|
||||
(`git branch -r --list 'origin/*'` lists them). `gstack-pregate` says so in
|
||||
its fix instead of suggesting the fetch.
|
||||
|
||||
<a id="policy-invalid"></a>
|
||||
### `POLICY_INVALID`
|
||||
|
||||
|
||||
Reference in new issue
Block a user