We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
With a non-empty repo:
r.head.commit => "f36d24ea4d820a9c109e35b22c8a77fed2060dcb"
But with an empty repo (no commits yet):
r = Grit::Repo.new(".") => #<Grit::Repo "/home/candlerb/tmp/tst2.git"> r.head.commit => "HEAD"
The upshot is if you use the following code for a commit, you end up with a corrupted repo:
i = r.index => #<Grit::Index:0xb70ae288 @current_tree=nil, @repo=#<Grit::Repo "/home/candlerb/tmp/tst2.git">, @tree={}> i.add("foo","aaa") => "aaa" i.commit("Message", [r.head.commit]) => "115431315faec0c3427d02dc8694f7de1a38bdc6"
$ git log error: bad parents in commit 115431315faec0c3427d02dc8694f7de1a38bdc6 fatal: bad object HEAD
Workaround:
parents = [r.head.commit] parents = nil if parents == ['HEAD'] i.commit("Message", parents)
Perhaps r.head.commit would be better as nil if it doesn't exist? And perhaps commit should validate the parent commit IDs given to it?
The text was updated successfully, but these errors were encountered:
Grit is no longer maintained. See #183 and check out libgit2/rugged.
Sorry, something went wrong.
No branches or pull requests
With a non-empty repo:
But with an empty repo (no commits yet):
The upshot is if you use the following code for a commit, you end up with a corrupted repo:
$ git log
error: bad parents in commit 115431315faec0c3427d02dc8694f7de1a38bdc6
fatal: bad object HEAD
Workaround:
Perhaps r.head.commit would be better as nil if it doesn't exist? And perhaps commit should validate the parent commit IDs given to it?
The text was updated successfully, but these errors were encountered: