You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The repo is currently 274MB when cloned, and just the src tree (i.e., excluding past versions in .git) is 85MB — the actual code takes up negligible space, and the vast majority of that space is taken up by src/test/resources/gcd-head.zip.
This makes it take an unusually large amount of time to clone the repo, and it will likely grow every time this blob is updated to a new version.
Would it be possible to not version these large files (and ideally remove them from history while there are few forks), and get them from Maven or other sources, pinned to a specific version?
I am not sure how to exclude past versions of a file (and was unaware that they are actually pulled when repo is cloned). I don't think it is likely that we will have much changes in gcd-head but the plan is to be depended on gcloud SDK which in the future will include the gcd tool and hopefully will be available via maven.
(gcd-v1beta2-rev1-2.1.1.zip is what we want to prune).
$ git log --oneline --branches -- src/test/resources/gcd-v1beta2-rev1-2.1.1.zip e68feca replace local gcd hack with a fixed version of gcd c79887b Automatically invoke gcd for testing
But this created a scary/nasty change-list per forked branch (I tried it in my fork) touching all files (this may be safe but was too scary for me, so I dropped it). Not to mention that for this to work all forks has to be re-based (rather than merge) to avoid re-introducing the object again...
Any more suggestions on how to remove src/test/resources/gcd-v1beta2-rev1-2.1.1.zip which was introduced by this changelist and later got replaced with src/test/resources/gcd-head.zip by this changelist?
@ryanseys : Any input here? Is there a "best practice way" to remove large binaries from history? The link @ludoch provided seems pretty straightforward.
We'll be totally re-writing history (which sucks, I know) and therefore fucking over the 11 forks that exist today, but I think making 11 people unhappy is better than having giant binaries hanging around in the git repository...
But this created a scary/nasty change-list per forked branch (I tried it in my fork) touching all files (this may be safe but was too scary for me, so I dropped it).
I think thats supposed to happen. You're effectively re-writing history, no?
Yep that github link to remove sensitive data looks on point. You are rewriting all history when deleting the references to the files so the SHAs will change and screw over any forks or clones so potentially way more than 11 people. But this is the only way to permanently remove large blobs from your repo.
So the % difference is not that big and honestly I am not comfortable to do it blindly (as
my knowledge in git is very basic, I just follow the steps without really understanding them
or their implication).
I still didn't manage to recover my fork which keep saying that it is "This branch is 171 commits ahead of GoogleCloudPlatform:master" (without any file change). Yes, I understand that it is re-writing history (though I would expect less
history to be behind not ahead).
Any advice on how to reset my fork to a fresh start would be much appreciated. After that (and after I know how to recover from it) I don't mind to give it another try (and let someone that understand review that push request or better yet do it himself).
It also seems weird that the number of objects is so large. From the logs above, it looks like your fork had 26,043, whereas GCP/gcloud-java had 70,531? How did we get a 3x multiplier there? Are we sure there aren't more blobs floating around?
The following stats just don't look quite right to me...
You don't really chop out commits, you chop out files (listed above) from the index and as a result, you affect every commit that follows the earliest commit that added those files to the index.
Activity
aozarov commentedon Feb 18, 2015
I am not sure how to exclude past versions of a file (and was unaware that they are actually pulled when repo is cloned). I don't think it is likely that we will have much changes in gcd-head but the plan is to be depended on gcloud SDK which in the future will include the gcd tool and hopefully will be available via maven.
ludoch commentedon May 19, 2015
I think it's about time to do this clean up before we are too successful:-)
Never done that, but I guess http://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery#Removing-Objects will help?
aozarov commentedon May 19, 2015
This sounds dangerous (and I wonder if such a change, that is not a changelist could then be applied back on the github repository...)
In any case, I followed the directions there on my local branch.
$ git verify-pack -v .git/objects/pack/pack-0c7478248833c2e7e29bb2bb0de8670669d2482c.
pack-0c7478248833c2e7e29bb2bb0de8670669d2482c.idx pack-0c7478248833c2e7e29bb2bb0de8670669d2482c.pack
$ git verify-pack -v .git/objects/pack/pack-0c7478248833c2e7e29bb2bb0de8670669d2482c.idx | sort -k 3 -n | tail -3
997af117c72074594a71ed6b141f9675709ec948 blob 931373 52784 90364920
484475ed6fc310dc3eaf115309719344fcda6791 blob 89098873 89111817 273395
ac05237a254e2892d0eb3b497d12f54515df775c blob 99807981 99811510 127031733
$ git rev-list --objects --all | grep ac05237a254e2892d0eb3b497d12f54515df775c
ac05237a254e2892d0eb3b497d12f54515df775c src/test/resources/gcd-v1beta2-rev1-2.1.1.zip
(gcd-v1beta2-rev1-2.1.1.zip is what we want to prune).
$ git log --oneline --branches -- src/test/resources/gcd-v1beta2-rev1-2.1.1.zip
e68feca replace local gcd hack with a fixed version of gcd
c79887b Automatically invoke gcd for testing
$ git filter-branch --index-filter 'git rm --ignore-unmatch --cached src/test/resources/gcd-v1beta2-rev1-2.1.1.zip' -- c79887b^..
$ rm -Rf .git/refs/original
$ rm -Rf .git/logs
$ git prune --expire now
$ git count-objects -v
But could not see any difference (I verified and repeated the steps but still no change).
I then found this: https://help.github.com/articles/remove-sensitive-data/
and use it to do the cleanup of the old /gcd-v1beta2-rev1-2.1.1.zip
$ git filter-branch --force --index-filter \
But this created a scary/nasty change-list per forked branch (I tried it in my fork) touching all files (this may be safe but was too scary for me, so I dropped it). Not to mention that for this to work all forks has to be re-based (rather than merge) to avoid re-introducing the object again...
aozarov commentedon May 19, 2015
Any more suggestions on how to remove src/test/resources/gcd-v1beta2-rev1-2.1.1.zip which was introduced by this changelist and later got replaced with src/test/resources/gcd-head.zip by this changelist?
jgeewax commentedon May 20, 2015
@ryanseys : Any input here? Is there a "best practice way" to remove large binaries from history? The link @ludoch provided seems pretty straightforward.
We'll be totally re-writing history (which sucks, I know) and therefore fucking over the 11 forks that exist today, but I think making 11 people unhappy is better than having giant binaries hanging around in the git repository...
jgeewax commentedon May 20, 2015
@aozarov
I think thats supposed to happen. You're effectively re-writing history, no?
ryanseys commentedon May 20, 2015
Yep that github link to remove sensitive data looks on point. You are rewriting all history when deleting the references to the files so the SHAs will change and screw over any forks or clones so potentially way more than 11 people. But this is the only way to permanently remove large blobs from your repo.
jgeewax commentedon May 20, 2015
Yep, sounds like a necessary evil :(
aozarov commentedon May 20, 2015
Is it really a necessary evil? When I clone my fork where I applied all this git scary magic I get:
When I clone the non-fork (GoogleCloudPlatform/gcloud-java) I get:
So the % difference is not that big and honestly I am not comfortable to do it blindly (as
my knowledge in git is very basic, I just follow the steps without really understanding them
or their implication).
I still didn't manage to recover my fork which keep saying that it is "This branch is 171 commits ahead of GoogleCloudPlatform:master" (without any file change). Yes, I understand that it is re-writing history (though I would expect less
history to be behind not ahead).
Any advice on how to reset my fork to a fresh start would be much appreciated. After that (and after I know how to recover from it) I don't mind to give it another try (and let someone that understand review that push request or better yet do it himself).
jgeewax commentedon May 21, 2015
OK I think the bigger problem is that this library is 200 MB...
That's an order of magnitude larger than gcloud-python, which has been around for quite a bit longer:
It also seems weird that the number of objects is so large. From the logs above, it looks like your fork had 26,043, whereas GCP/gcloud-java had 70,531? How did we get a 3x multiplier there? Are we sure there aren't more blobs floating around?
The following stats just don't look quite right to me...
ryanseys commentedon May 21, 2015
Yeah there's a definite difference.
Before:
After:
Results:
jgeewax commentedon May 21, 2015
@ryanseys : Which commits / blobs did you chop out ?
ryanseys commentedon May 21, 2015
ryanseys commentedon May 21, 2015
You don't really chop out commits, you chop out files (listed above) from the index and as a result, you affect every commit that follows the earliest commit that added those files to the index.
How to reproduce:
Step 0. Fork and clone repo.
git clone git@github.com:{{username}}/gcloud-java.gitStep 1. Remove
src/test/resources/gcd-v1beta2-rev1-2.1.1.zipfrom index.git filter-branch --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch src/test/resources/gcd-v1beta2-rev1-2.1.1.zip' --tag-name-filter cat -- --allStep 2. Remove
src/test/resources/gcd-head.zipfrom index.git filter-branch --force --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch src/test/resources/gcd-head.zip' --tag-name-filter cat -- --allStep 3. Ignore those files from now on, make a new commit.
Step 4. Garbage collect outdated blobs and force push back to your fork.
(WARNING THIS WILL REWRITE HISTORY IN YOUR FORK)
Step 5. Clone it under a new name, enjoy the speed up!
Let me know if this doesn't work for you!
jgeewax commentedon May 21, 2015
Rather than Step 4 (delete fork, new repo) could you just do
git push origin -f? Or no?60 remaining items
fix: update ignored diffs (#206)
fix: adding deprecated tags to deprecated methods (#472)
feat: expose default client configs (#541)
chore: generate topic retention changes (#798)
fix: do not block forever if message size > flow control limits (#847)
Modifying Publish example in README to match other examples given, and (
fix: shutdown grpc stubs properly when a subscriber is stopped (#74)
fix: ensure all publishes complete before shutting down publisher (#76)
fix: changing integration test push endpoint to be valid https (#170)
fix: update ignored diffs (#206)
fix: adding deprecated tags to deprecated methods (#472)
feat: expose default client configs (#541)
chore: generate topic retention changes (#798)
fix: do not block forever if message size > flow control limits (#847)
chore: add and run synthtool (googleapis#11)