How to count objects in repository... fast #1797
Unanswered
Gyro-Gearless
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks :-) go-git noob here...
I am playing around writing a little tool to backup remote git repositories, where backup just means "do a regularly
git fetch".Cloning repositories and doing the fetch goes pretty straightforward with go-git!
But now, i want to get some stats on how many (if any) update where fetched, so i had the idea to ask ChatGPT for a
git count-objectssurrogate, and came up with this:(Idea is to do a count of objects before and after the fetch operation, and check the difference in counted objects)
This works and seems to give proper numbers, but... it is dog slow!
Even on a medium sized repository like this one: https://github.com/LMMS/lmms.git , the above calculation takes almost 5 minutes, whereas
git count-objects -valmost immediately gives a result.So i would be glad for any hint on how to make this faster - ultimately, i would just need the information if
fetchpicked up zero or more updates from remote...Cheers, Gyro :-)
Beta Was this translation helpful? Give feedback.
All reactions