Kunal8954 opened a new pull request, #72787:
URL: https://github.com/apache/airflow/pull/72787
When `GitDagBundle` is killed while cloning a bundle version, it leaves
behind a
version directory that git can open as a repository but that cannot resolve
the
configured `tracking_ref`. `git clone` writes the `.git` skeleton before it
writes refs or checks out the working tree, so such a leftover has `.git`
with
no refs and an empty working tree. Every later task pinned to that bundle
version then failed on every retry:
```
GitCommandError: git checkout <tracking_ref>
stderr: 'error: pathspec '<tracking_ref>' did not match any file(s) known
to git'
```
because the broken directory was reopened but never repaired or replaced.
## Change
Move `self.repo.git.checkout(self.tracking_ref)` into
`_clone_repo_if_required`, inside its `@retry` / `shutil.rmtree` block. A
repository that cannot resolve the tracking ref is now discarded and
re-cloned
from the healthy local bare mirror instead of failing forever. This also
lets a
SHA-pinned `tracking_ref` be promoted in-place without clearing local storage
(the case tracked in #71388).
## Tests
- New `test_interrupted_clone_version_dir_is_recovered`: simulates a killed
clone (`.git` skeleton present, refs/packed-refs absent, empty working
tree),
then asserts `initialize()` restores both the expected version and the Dag
files. Fails on `main`, passes with this change.
- Updated `test_tracking_ref_commit_sha_promote_without_clearing_storage`
(was
`...promote_fails_without_clearing_storage`) to assert in-place promotion
now
succeeds.
- `providers/git/tests/unit/git/` — 141 passed.
- `ruff`, `ruff format`, and `mypy` on both changed files pass.
closes: #72759
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — opencode (big-pickle)
src-notes: no newsfragment for a provider change (released from `main`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]