Created
December 3, 2012 19:45
-
-
Save dlowe/4197434 to your computer and use it in GitHub Desktop.
repro script for "did not find object for shallow ..." bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TOPDIR=`mktemp -d -t git-repro` | |
ORIGIN=$TOPDIR/origin | |
rm -rf $ORIGIN | |
git init --bare $ORIGIN | |
## 'good' repo will commit properly | |
GOOD=$TOPDIR/good | |
rm -rf $GOOD | |
git clone file://$ORIGIN $GOOD | |
## 'evil' repo will stomp 'good' commits | |
EVIL=$TOPDIR/evil | |
rm -rf $EVIL | |
git clone file://$ORIGIN $EVIL | |
## 'shallow' repo just wants everyone to get along | |
SHALLOW=$TOPDIR/shallow | |
rm -rf $SHALLOW | |
## push 2 commits. I'm not sure why 1 does not reproduce the issue. | |
cd $GOOD | |
echo "1" >> 1 | |
git add 1 | |
git commit -a -m 1 | |
echo "2" >> 2 | |
git add 2 | |
git commit -a -m 2 | |
git push origin master | |
## shallow: ok! | |
git clone --depth 1 file://$ORIGIN $SHALLOW | |
cd $SHALLOW | |
## push --force one commit, stomping the two 'good' commits | |
cd $EVIL | |
echo "3" >> 3 | |
git add 3 | |
git commit -a -m 3 | |
git push --force origin master | |
## important: origin cleans up un-referenced blobs... | |
cd $ORIGIN | |
git gc --prune=now | |
## shallow: not ok. | |
cd $SHALLOW | |
git fetch | |
rm -rf $TOPDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment