Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaks after git garbage collection #93

Open
cjbarth opened this issue Feb 14, 2017 · 1 comment
Open

Breaks after git garbage collection #93

cjbarth opened this issue Feb 14, 2017 · 1 comment

Comments

@cjbarth
Copy link

cjbarth commented Feb 14, 2017

gift fundamentally breaks after a garbage collection. This is related to issue #92 . You can repeat this issue with the following script.

rm -rf git1
rm -rf git2

mkdir git1
cd git1
git init
echo test > f1.txt
git add f1.txt
git commit -m "Initial commit"
git branch HOTFIX/bigbug
git checkout HOTFIX/bigbug
echo tested > f1.txt
git add f1.txt
git commit -m "Fixed big bug"
git checkout master
echo tester > f2.txt
git add f2.txt
git commit -m "New file"
git branch HOTFIX/_integration
git checkout HOTFIX/_integration

git merge HOTFIX/bigbug -m "Merge bugfix"

git checkout master
git gc

cd ..

mkdir git2
cd git2
git clone ../git1

cd ../git1
git branch HOTFIX/littlebug
git branch develop

cd ../git2/git1

git branch HOTFIX/littlebug
git checkout HOTFIX/littlebug
echo littleBug > f3.txt
git add f3.txt
git commit -m "Fix little bug"
git checkout HOTFIX/_integration

# comment the following line to see this work properly
git gc


npm install gift

version='var git=require("gift"),repo=git(".");repo.branch(function(o,i){o&&console.log(o);var t={branch_name:i.name,commit_author:i.commit.author.name,commit_date:i.commit.committed_date,sha_revision:i.commit.id,short_sha_revision:i.commit.id.substr(0,7)};console.log(t)});'
echo $version > version.js
node version.js
@notatestuser
Copy link
Owner

Thanks for this comprehensive test case. I would guess that most users do not encounter this issue due to the 7,000 loose objects / 50 packfiles requirement for automatic garbage collection. However, we should most definitely fall back to looking in packed-refs.

@notatestuser notatestuser changed the title Breaks After Garbage Collection Breaks after git garbage collection Jul 12, 2017
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

No branches or pull requests

2 participants