Skip to content

Commit 08b321e

Browse files
committed
Fall back to full initialization on any error while reusing the on-disk repo
The reuse path's inner block re-raises non-git errors (bare `raise` after repo.close()), but the outer except only caught InvalidGitRepositoryError / NoSuchPathError / GitCommandError. A checkout failing with e.g. OSError / PermissionError on the shared bundle storage therefore escaped instead of falling through to full initialization, contradicting the documented "reuse it as-is, fall back if unusable" intent. Broaden the outer except to Exception so any unusable on-disk repo falls back as intended (review feedback from @Sanjays2402). Signed-off-by: kjh0623 <[email protected]>
1 parent 9a87461 commit 08b321e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • providers/git/src/airflow/providers/git/bundles

‎providers/git/src/airflow/providers/git/bundles/git.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ def _initialize(self):
223223
except Exception:
224224
repo.close()
225225
raise
226-
except (InvalidGitRepositoryError, NoSuchPathError, GitCommandError) as e:
226+
except Exception as e:
227+
# Reuse is best-effort: fall back to the full initialization path if the
228+
# on-disk repo is unusable for any reason - not only git-level errors but
229+
# also e.g. an OSError/PermissionError on the shared bundle storage.
227230
self._log.info(
228231
"Failed to reuse existing tracking repo, falling back to full initialization",
229232
repo_path=self.repo_path,

0 commit comments

Comments
 (0)