FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/examples/diff-commits.js at master · nodegit/nodegit · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
nodegit
/
nodegit
Public
Notifications
You must be signed in to change notification settings
Fork
700
Star
5.8k
Code
Issues
343
Pull requests
20
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
examples
/
diff-commits.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (38 loc) · 1.24 KB
Breadcrumbs
nodegit
/
examples
/
diff-commits.js
Copy path
File metadata and controls
41 lines (38 loc) · 1.24 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
const
nodegit
=
require
(
"../"
)
;
const
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`.
(
async
(
)
=>
{
const
repo
=
await
nodegit
.
Repository
.
open
(
path
.
resolve
(
__dirname
,
"../.git"
)
)
const
commit
=
await
repo
.
getCommit
(
"59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5"
)
;
console
.
log
(
"commit "
+
commit
.
sha
(
)
)
;
console
.
log
(
"Author:"
,
commit
.
author
(
)
.
name
(
)
+
" <"
+
commit
.
author
(
)
.
email
(
)
+
">"
)
;
console
.
log
(
"Date:"
,
commit
.
date
(
)
)
;
console
.
log
(
"\n "
+
commit
.
message
(
)
)
;
const
diffList
=
await
commit
.
getDiff
(
)
;
for
(
const
diff
of
diffList
)
{
const
patches
=
await
diff
.
patches
(
)
;
for
(
const
patch
of
patches
)
{
const
hunks
=
await
patch
.
hunks
(
)
;
for
(
const
hunk
of
hunks
)
{
const
lines
=
await
hunk
.
lines
(
)
;
console
.
log
(
"diff"
,
patch
.
oldFile
(
)
.
path
(
)
,
patch
.
newFile
(
)
.
path
(
)
)
;
console
.
log
(
hunk
.
header
(
)
.
trim
(
)
)
;
for
(
const
line
of
lines
)
{
console
.
log
(
String
.
fromCharCode
(
line
.
origin
(
)
)
+
line
.
content
(
)
.
trim
(
)
)
;
}
}
}
}
}
)
(
)
;
Back
|
FazBrowse Home
|
New Git URL