FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/example/walk-history.js at emscripten · elfscript/nodegit · GitHub
elfscript
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
example
/
walk-history.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (22 loc) · 905 Bytes
Breadcrumbs
nodegit
/
example
/
walk-history.js
Copy path
File metadata and controls
28 lines (22 loc) · 905 Bytes
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
var
git
=
require
(
'../'
)
,
path
=
require
(
'path'
)
,
sort
=
git
.
RevWalk
.
Sort
;
// This code walks the history of the master branch and prints results
// that look very similar to calling `git log` from the command line
git
.
Repo
.
open
(
path
.
resolve
(
__dirname
,
'../.git'
)
,
function
(
error
,
repo
)
{
if
(
error
)
throw
error
;
repo
.
getMaster
(
function
(
error
,
branch
)
{
if
(
error
)
throw
error
;
// History returns an event.
var
history
=
branch
.
history
(
sort
.
Time
)
;
// History emits 'commit' event for each commit in the branch's history
history
.
on
(
'commit'
,
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
(
)
)
;
}
)
;
// Don't forget to call `start()`!
history
.
start
(
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL