I am using the https://github.com/notatestuser/gift
library and here's what I have:
gitCommit.tree().contents (err, gitTreeContents) ->
console.log gitTreeContents
This gives me the tree contents, which is an array with objects that look like:
{ repo:
{ path: '/mygitrepo',
bare: false,
dot_git: '/mygitrepo/.git',
git:
{ [Function]
cmd: [Function],
streamCmd: [Function],
list_remotes: [Function],
refs: [Function] } },
id: 'ed38d79b10503a4e7e68910f37f387f24dedd5fa',
name: 'address.js',
mode: '100644' }
So two questions. First, what is that id
referring to? It's not a commit sha, so I assume it's a treeish? Second, how can I see what the file looked like at that point in time?
Thanks
gift
is a simple wrapper over command line git. In command line git you should run a command like this: git cat-file blob <commit-sha-1>:</path/to/file>
. Take a look at http://github.com/notatestuser/gift/blob/master/src/blob.coffee it seems, it does exactly what you need.