FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/examples/status.js at master · CodeHunterDev/nodegit · GitHub
CodeHunterDev
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
examples
/
status.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (20 loc) · 781 Bytes
Breadcrumbs
nodegit
/
examples
/
status.js
Copy path
File metadata and controls
24 lines (20 loc) · 781 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
var
nodegit
=
require
(
"../"
)
,
path
=
require
(
"path"
)
;
// This code shows working directory changes similar to git status
nodegit
.
Repository
.
open
(
path
.
resolve
(
__dirname
,
"../.git"
)
)
.
then
(
function
(
repo
)
{
repo
.
getStatus
(
)
.
then
(
function
(
statuses
)
{
function
statusToText
(
status
)
{
var
words
=
[
]
;
if
(
status
.
isNew
(
)
)
{
words
.
push
(
"NEW"
)
;
}
if
(
status
.
isModified
(
)
)
{
words
.
push
(
"MODIFIED"
)
;
}
if
(
status
.
isTypechange
(
)
)
{
words
.
push
(
"TYPECHANGE"
)
;
}
if
(
status
.
isRenamed
(
)
)
{
words
.
push
(
"RENAMED"
)
;
}
if
(
status
.
isIgnored
(
)
)
{
words
.
push
(
"IGNORED"
)
;
}
return
words
.
join
(
" "
)
;
}
statuses
.
forEach
(
function
(
file
)
{
console
.
log
(
file
.
path
(
)
+
" "
+
statusToText
(
file
)
)
;
}
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL