Skip to content

Objects return wrong SHA after calling 'date' #2

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
rainhead opened this issue Jul 22, 2009 · 2 comments
Closed

Objects return wrong SHA after calling 'date' #2

rainhead opened this issue Jul 22, 2009 · 2 comments
Assignees
Milestone

Comments

@rainhead
Copy link

foo = REPOSITORY.object('HEAD')

foo.sha => "b64400d7dc2dd23474120e12c7bca59b41be771a"

foo.date => Tue Jul 21 14:55:16 -0700 2009

foo.sha => "HEAD"

cwalsh pushed a commit to cwalsh/ruby-git that referenced this issue Jan 6, 2014
@sheerun
Copy link

sheerun commented Apr 17, 2014

Is it fixed?

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

Ok, 5 years, 5 months later...

Turns out that #object sets the sha based on the parsed reference (turning HEAD into the full object sha).

On the other hand #date delegates to the commiter and, in order to get the commiter, the objects triggers a check_commit method that fetchs metadata for the given sha and updates some of its attributes, including the sha if present.

Since HEAD is clearly not a sha, but a relative reference to one of them, the previously value should be respected.

I may add a name like attribute holding HEAD and will lock the sha to prevent these kind of substitutions.
`

singpolyma pushed a commit to singpolyma/ruby-git that referenced this issue Aug 15, 2017
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

No branches or pull requests

3 participants