Skip to content

fix(git): support repo cache with getBranchUpdateDate#42852

Open
jamietanna wants to merge 1 commit intomainfrom
fix/branch-update-git
Open

fix(git): support repo cache with getBranchUpdateDate#42852
jamietanna wants to merge 1 commit intomainfrom
fix/branch-update-git

Conversation

@jamietanna
Copy link
Copy Markdown
Contributor

Changes

As noted in #41953, the introduction of getBranchUpdateDate did not
take into account the use of a repository cache.

When using a repository cache, the repo is not cloned until it is needed
(and various metadata is used from the cache instead).

However, when using a cache (with a repo not yet cloned) this results in
getBranchUpdateDate failing (and a debug log appearing).

We can instead handle this by performing a repo sync at this point.

Context

Please select one of the following:

  • This closes an existing Issue, Closes: #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests, but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository:

As noted in #41953, the introduction of `getBranchUpdateDate` did not
take into account the use of a repository cache.

When using a repository cache, the repo is not cloned until it is needed
(and various metadata is used from the cache instead).

However, when using a cache (with a repo not yet cloned) this results in
`getBranchUpdateDate` failing (and a debug log appearing).

We can instead handle this by performing a repo sync at this point.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
@github-actions github-actions Bot requested a review from viceice April 23, 2026 16:16
Comment thread lib/util/git/index.ts
if (!branchSha) {
return null;
}
await syncGit();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is the right call here - I wonder if we should instead try and get this from the cache?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think we should have this in cache 🤔

caching can be done in a follow up PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the quick patch, @jamietanna.

caching can be done in a follow up PR

And please let me know if you'd like help with that. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants