Skip to content

Fix issue #184 (Git status crashes on empty repo) #205

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
wants to merge 7 commits into from

Conversation

othatbrian
Copy link
Contributor

When a repo is created, but before a commit is made, the index does not exist. ruby-git is trying to do a diff using HEAD; because the index doesn't exist, HEAD doesn't exist, so it explodes.

The solution below fixes this issue. Yes, I know "unless !" == "if", but I thought it was a little more clear that the conditional is there to protect against the case where the file does not exist. Feel free to change it to an "if" or move it to the front with an "&&".

I didn't specifically see anywhere else where the use of HEAD on an empty repo would occur, but I'm not terribly familiar with this project. This seemed a more direct solution that trying to implement a "GitObjectNotFound" kind of error.

@robertodecurnex robertodecurnex added this to the 1.2.9 milestone Dec 7, 2014
@robertodecurnex robertodecurnex self-assigned this Dec 7, 2014
@robertodecurnex
Copy link
Contributor

Related #184 #205 #159 #25

@othatbrian
Copy link
Contributor Author

I apologize if I'm a bit obtuse on what's happening here; I'm kind of new to contributing. It looks like you added links for several possibly related issues. #184 is the issue I attempted to fix; #205 is the fix I provided (i.e. this PR). You also mention #159 and #25. I believe those are slightly different. They are due to the first commit not returning a parent object. I made a simple change, a la filesystem semantics at the root of the filesystem, and made the initial commit be its own parent. This fix is here:

othatbrian@de1db54

Should I create a new pull request for that? (AFAICT, it fixes issues #25 and #159.)

Also, what's the status of this pull request (just for my own edification)? I see the "milestone", but I'm not familiar with what that means.

@robertodecurnex
Copy link
Contributor

Hey Brian,

I was just relating initial non/initial commit problems. I'm not expecting to fix them all with a single PR but, since they MAY be related, better to have the links at hand.

Whenever you are fixing anything else you should create different p
PRs for each fix.

If those are strongly related you can just add some comments and push the changes to the same branch.

1.2.9 would be the next release. Hope to be closing this one within the next 2 weeks at most.

Robertt

-----Original Message-----
From: Brian Stevens notifications@github.com
Date: Sun, 07 Dec 2014 16:33:39
To: schacon/ruby-gitruby-git@noreply.github.com
Reply-To: schacon/ruby-git reply@reply.github.com
Cc: Roberto Decurnexdecurnex.roberto@gmail.com
Subject: Re: [ruby-git] Fix issue #184 (Git status crashes on empty repo)
(#205)

I apologize if I'm a bit obtuse on what's happening here; I'm kind of new to contributing. It looks like you added links for several possibly related issues. #184 is the issue I attempted to fix; #205 is the fix I provided (i.e. this PR). You also mention #159 and #25. I believe those are slightly different. They are due to the first commit not returning a parent object. I made a simple change, a la filesystem semantics at the root of the filesystem, and made the initial commit be its own parent. This fix is here:

othatbrian@de1db54

Should I create a new pull request for that? (AFAICT, it fixes issues #25 and #159.)

Also, what's the status of this pull request (just for my own edification)? I see the "milestone", but I'm not familiar with what that means.


Reply to this email directly or view it on GitHub:
#205 (comment)

@stale
Copy link

stale bot commented Apr 1, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 1, 2018
@stale stale bot closed this Apr 8, 2018
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.

4 participants