Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P90
[Answer: No] hash revision computation difference?
Active
Public
Actions
Authored by
ardumont
on Jun 23 2016, 11:57 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
Data Model
Subscribers
None
swh-revhash computes the raw commit hash (as in git) using our swh.model api.
```
$ swh-revhash 'tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\nparent 22c0fa5195a53f2e733ec75a9b6e9d1624a8b771\nauthor seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\ncommitter seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\n\nmaking dir structure...\n'
17a631d474f49bbebfdf3d885dcde470d7faafd7
```
Note:
swh-revhash is in swh-model/bin/ (https://forge.softwareheritage.org/diffusion/DMOD/browse/master/bin/swh-revhash).
To have the same git hash (using git), we need to remove the trailing slash...
```
$ echo -e 'tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\nparent 22c0fa5195a53f2e733ec75a9b6e9d1624a8b771\nauthor seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\ncommitter seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\n\nmaking dir structure...' | git hash-object -t commit --stdin
17a631d474f49bbebfdf3d885dcde470d7faafd7
```
--
Answer:
The problem is in the git checking step.
echo adds an extra line.
To avoid this, the command should have been:
```
$ echo -ne 'tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\nparent 22c0fa5195a53f2e733ec75a9b6e9d1624a8b771\nauthor seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\ncommitter seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\n\nmaking dir structure...\n' | git hash-object -t commit --stdin
17a631d474f49bbebfdf3d885dcde470d7faafd7
```
Event Timeline
ardumont
created this paste.
Jun 23 2016, 11:57 AM
2016-06-23 11:57:48 (UTC+2)
ardumont
edited the content of this paste.
(Show Details)
Jun 23 2016, 12:01 PM
2016-06-23 12:01:39 (UTC+2)
ardumont
changed the title of this paste from
hash revision computation difference?
to
[Answer: No] hash revision computation difference?
.
Jun 23 2016, 12:31 PM
2016-06-23 12:31:32 (UTC+2)
ardumont
edited the content of this paste.
(Show Details)
Log In to Comment