Skip to content

init a repo and failed to create_head #105

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

Closed
yndlsds opened this issue Apr 15, 2013 · 2 comments
Closed

init a repo and failed to create_head #105

yndlsds opened this issue Apr 15, 2013 · 2 comments
Assignees

Comments

@yndlsds
Copy link

yndlsds commented Apr 15, 2013

I init a new repo, and then use the 'repo.create_head('refs/heads/master')'. But I get a gitdb.exc.Badobject:48454144. This will not be an error somehow. But it triped me.

@Byron Byron added this to the v0.3.5 - bugfixes milestone Nov 19, 2014
@Byron
Copy link
Member

Byron commented Nov 19, 2014

This might be related to git-python having issues with empty repositories. I will have a look when working on 0.3.5.

@Byron Byron self-assigned this Jan 8, 2015
Byron added a commit that referenced this issue Jan 8, 2015
…more.

Previously, an unresolvable ref name like HEAD would end up as HEX and
was presented as BadObject error, even though that exception is for
invalid shas only.
Now BadName is thrown, which converts into a more useful error message.

Improves #105
@Byron
Copy link
Member

Byron commented Jan 8, 2015

What you have been doing was equivalent to git branch master, which fails with fatal: Not a valid object name: 'master'. on the commandline as well.
However, I have added a new test-case to verify gitpython deals with empty repositories gracefully.
In addition to that, the BadObject exception is now a BadName exception, which doesn't convert perfectly nice names to some hex, which would just add to the confusion.

@Byron Byron closed this as completed Jan 8, 2015
Byron added a commit that referenced this issue Jan 15, 2015
…ng git-python.

This is the case with `git submodule add` as well. This makes sense as
an empty git repository doesn't have a commit, which needs to be specified
as SHA in the parent repositories tree entry for the respective submodule.

When manually adding the empty submodule to the .gitmodules file, git-python
will throw another error related to the inability to find the submodule
in the index.

Even if an iteration would be possible, git-python would now throw
a BadName exception, which clearly indicates that the 'HEAD' revision
is invalid (as it doesn't point to any commit).

Fixes #152
Fixes #105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants