GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — nodegit/examples/diff-commits.js at master · startupengine/nodegit

Expand file tree

/

diff-commits.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
41 lines (38 loc) · 1.31 KB
/

diff-commits.js

Copy path

File metadata and controls

41 lines (38 loc) · 1.31 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var nodegit = require("../");
var path = require("path");
// This code examines the diffs between a particular commit and all of its
// parents. Since this commit is not a merge, it only has one parent. This is
// similar to doing `git show`.
nodegit.Repository.open(path.resolve(__dirname, "../.git"))
.then(function(repo) {
return repo.getCommit("59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5");
})
.then(function(commit) {
console.log("commit " + commit.sha());
console.log("Author:", commit.author().name() +
" <" + commit.author().email() + ">");
console.log("Date:", commit.date());
console.log("\n " + commit.message());
return commit.getDiff();
})
.done(function(diffList) {
diffList.forEach(function(diff) {
diff.patches().then(function(patches) {
patches.forEach(function(patch) {
patch.hunks().then(function(hunks) {
hunks.forEach(function(hunk) {
hunk.lines().then(function(lines) {
console.log("diff", patch.oldFile().path(),
patch.newFile().path());
console.log(hunk.header().trim());
lines.forEach(function(line) {
console.log(String.fromCharCode(line.origin()) +
line.content().trim());
});
});
});
});
});
});
});
});
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.