Skip to content

Conversation

tycho
Copy link
Contributor

@tycho tycho commented Sep 29, 2025

I was surprised to see that the pull mirroring mechanism is trying to parse the human-readable git fetch output instead of using the machine-readable git fetch --porcelain or an equivalent approach.

This change makes the parsing less fragile since the underlying command now has a predictable output format.

I do notice that git fetch --porcelain was only added in Git 2.41.0 (~8 months ago?), according to the release notes. So I might need to add a fallback mechanism to use the existing parseRemoteUpdateOutput if we're using an old git version, with a new feature flag added here?

Also, an alternative approach would be to do something like... record the output of git for-each-ref --format='%(refname) %(objectname)' before and after the git fetch invocation and figure out the differences based on that, but I'm open to suggestions.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 29, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Sep 29, 2025
@tycho tycho force-pushed the pr/pull-mirror-machine-readable branch from 9b405a6 to 12d05b4 Compare September 29, 2025 04:51
@lunny
Copy link
Member

lunny commented Sep 29, 2025

Since it requires a high version of git, a version feature check and fallback is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants