FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

repo.branch fails on empty repo · Issue #22 · nodegit/nodegit · GitHub

Repository navigation

repo.branch fails on empty repo #22

Description

Calling repo.branch on an empty repo created with repo.init the program aborts with following message:

node: ../../src/refs.c:1067: git_reference_oid: Assertion `ref' failed.
Aborted

I tracked the bug down to repo.js line 37 ref.oid().oid.

If the repo "contains" at least one commit, the error doesnt get thrown.

Activity

  1. tbranyen commented on Apr 23, 2011

    Member

    Could you gist me the code you were running? When I patch this I want to ensure it covers what you were trying to do.

  2. payload commented on Apr 23, 2011

    Author
  3. tbranyen commented on Apr 23, 2011

    Member

    Okay I see. The expectation is that when you call git.repo().init that it will create a corresponding master branch. What git.repo().init does is a 1:1 to git init. It creates a symbolic pointer to the refs/heads/master which doesn't exist since no commits have been made. This code should not be crashing Node though. The branch callback should be called with an applicable error.

    Thanks for reporting, if you have any thoughts let me know. I'll comment back as soon as I have a patch.

  4. tbranyen commented on May 14, 2011

    Member

    Okay I thought about this more and I believe this can be considered expected behavior. Unless nodegit makes a commit for you (which is unexpected behavior) there is no way to have a master branch on repo creation.

    Sorry I'm going slow at adding in writables, but commit creation is coming soon. I'd like it to be as painless as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL