mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-09 00:30:28 +00:00
fix: stop pruning the cached action ref on refresh (#1312)
The action cache refresh fetched with `--prune` and the unqualified refspec `+<ref>:refs/runner/<hash>`. Git cannot map that ref back to a remote ref, so it deleted it on every other refresh. The first job after a branch or tag moved then failed with `cannot lock ref`, and a moved tag in a full clone could silently run its old commit. `--no-prune` fixes this and also overrides an inherited `fetch.prune`. Fixes: https://gitea.com/gitea/runner/issues/1311 Reviewed-on: https://gitea.com/gitea/runner/pulls/1312 Reviewed-by: Lunny Xiao <[email protected]> Reviewed-by: Zettat123 <[email protected]>
This commit is contained in:
1 parent
470969dc74
commit
42858c61df
7 files changed
+87
-5
No files matched your search
@@ -304,7 +304,7 @@ func shallowPinnedClone(ctx context.Context, input NewGitCloneExecutorInput) err
|
||||
}
|
||||
|
||||
func fetch(ctx context.Context, input NewGitCloneExecutorInput) error {
|
||||
args := []string{"fetch", "--force", "--prune"}
|
||||
args := []string{"fetch", "--force", "--no-prune"}
|
||||
if _, err := os.Stat(filepath.Join(input.Dir, ".git", "shallow")); err == nil {
|
||||
args = append(args, "--depth", "1", "--no-tags")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user