Skip to content

hash-object is different from ruby's implemention #1080

@jingsam

Description

@jingsam

In https://github.com/progit/progit2/blob/master/book/10-git-internals/sections/objects.asc#object-storage, we use ruby to hash what is up, doc? and we get:

bd9dbf5aae1a3862dd1526723246b20206e5fc37

However, I hash this string with hash-object, from which I got a different hash:

$ echo "what is up, doc?" | git hash-object --stdin -w
7108f7ecb345ee9d0084193f147cdad4d2998293
$ git cat-file -p 7108f7ecb345ee9d0084193f147cdad4d2998293
what is up, doc?

Test on:
macOS 10.13.5
git version 2.15.1 (Apple Git-101)
config:

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
	precomposeunicode = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions