0

Is it possible to use the git blame command to get the annotations from each line in an earlier revision of a file with NodeGit?

There is an method called Blame.file(repo, path, [options]), but it isn't clear to me exactly what all the properties of the options object mean. It doesn't seems to be possible, but maybe there is some workaround? If this is not possible with NodeGit, I would appreciate recommendations of module or solutions.

I want to specify the sha1 parameter in the command below:

git blame {sha1} -- {path/to/file}

micnil
  • 4,705
  • 2
  • 28
  • 39

1 Answers1

0

You need to use the options to specify which commit you want to start from (instead of simply HEAD).

rcjsuen
  • 873
  • 1
  • 6
  • 12
  • seems legit. More specifically i tried to use ```newestCommit: oid``` in the BlameOptions. I confirmed that it worked by checking the number of lines I get for different commit hashes. I realized though that it doesn't seem to be possible to get the actual line content from the blame output (like is provided from command line), only the line annotation. To get the line contents i'd have to use something like: ```fileEntry = await commit.getEntry(filePath);``` followed by ```fileEntry.getBlob();```. – micnil Mar 28 '18 at 16:52