8silvergun commented on PR #71535:
URL: https://github.com/apache/airflow/pull/71535#issuecomment-5594405254

   Following up from #72759, which describes a different way to reach the same 
failing `checkout`: if a process is killed while a bundle version is being 
cloned, `versions/<sha>/` is left with a `.git` that has no references and an 
empty working tree, and it is reused on every later initialization.
   
   Your change looks like it recovers that state too, for a reason it was not 
written for:
   
   - `_has_version(repo, tracking_ref)` cannot resolve `tracking_ref` in a 
repository with no refs, so it returns `False` and the fetch runs.
   - `git clone` writes the remote before it transfers objects, so a leftover 
can still have `remote.origin.url` configured, pointing at the bundle's healthy 
local bare mirror. The fetch is local and repopulates `refs/remotes/origin/*`, 
after which the checkout resolves.
   
   If you agree, would you like a regression test for that path added to this 
PR? It initializes a versioned bundle with a named branch such as `main` as 
`tracking_ref`, removes all loose and packed refs from `versions/<sha>/.git`, 
leaves HEAD pointing at a nonexistent branch, empties the working tree, 
verifies that `origin` remains configured, then initializes the same version 
again and asserts that both the expected version and the Dag files are 
restored. It fails on `main` and should pass with this change.
   
   I have it written against the current `TestGitDagBundle` fixtures and can 
push it to your branch or post it here as a patch, whichever you prefer. Happy 
to leave it out if you would rather keep this PR scoped to #71388.
   


-- 
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]

Reply via email to