Thanks to visit codestin.com
Credit goes to github.com

Skip to content

odb: only provide the empty tree #3887

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

Merged
merged 2 commits into from
Aug 8, 2016
Merged

odb: only provide the empty tree #3887

merged 2 commits into from
Aug 8, 2016

Conversation

ethomson
Copy link
Member

@ethomson ethomson commented Aug 5, 2016

Only provide the empty tree internally, which matches git's behavior. If we provide the empty blob then any users trying to write it with libgit2 would omit it from actually landing in the odb, which appear to git proper as a broken repository (missing that object).

You can see that git does provide the empty tree:

git update-index --add --cacheinfo 040000,4b825dc642cb6eb9a060e54bf8d69288fbee4904,empty
git commit -mfoo
git reset --hard HEAD
HEAD is now at 3b3a253 foo
% ls
./    ../    .git/    empty/
% ls empty 
./    ../

But the empty blob is not:

% git update-index --add --cacheinfo 100644,e69de29bb2d1d6434b8b29ae775ad8c2e48c5391,empty
% git commit -mfoo
error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for 'empty'
error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for 'empty'
error: Error building trees

Edward Thomson added 2 commits August 5, 2016 19:30
Only provide the empty tree internally, which matches git's behavior.
If we provide the empty blob then any users trying to write it with
libgit2 would omit it from actually landing in the odb, which appear
to git proper as a broken repository (missing that object).
@carlosmn carlosmn merged commit 97e57e8 into master Aug 8, 2016
@ethomson ethomson deleted the ethomson/empty_blob branch January 13, 2017 12:28
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

Successfully merging this pull request may close these issues.

2 participants