Skip to content

Commit 717ede0

Browse files
committed
Bringing site up-to-date with latest
1 parent 9d67b0f commit 717ede0

File tree

13 files changed

+354
-51
lines changed

13 files changed

+354
-51
lines changed

api/index.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ sections:
8888
"Signature": "#Signature"
8989
"Stash": "#Stash"
9090
"Status": "#Status"
91+
"StatusEntry": "#StatusEntry"
9192
"StatusList": "#StatusList"
9293
"StatusOptions": "#StatusOptions"
9394
"Strarray": "#Strarray"
@@ -1445,6 +1446,7 @@ sections:
14451446

14461447
| Class Methods | |
14471448
| --- | ---: |
1449+
| [<span>Status.</span>byIndex <span>(statuslist, idx)</span>](/api/status/#byIndex) | <span class="tags"><span class="sync">Sync</span></span> |
14481450
| [<span>Status.</span>file <span>(status_flags, repo, path)</span>](/api/status/#file) | <span class="tags"><span class="sync">Sync</span></span> |
14491451
| [<span>Status.</span>foreach <span>(repo, callback, payload)</span>](/api/status/#foreach) | <span class="tags"><span class="async">Async</span></span> |
14501452
| [<span>Status.</span>foreachExt <span>(repo, opts, callback, payload)</span>](/api/status/#foreachExt) | <span class="tags"><span class="async">Async</span></span> |
@@ -1457,17 +1459,26 @@ sections:
14571459
| [<span>Status.</span>STATUS](/api/status/#STATUS)| |
14581460

14591461

1462+
## <a name='StatusEntry'></a>[StatusEntry](/api/status_entry/)
1463+
1464+
| Instance Variables | |
1465+
| --- | ---: |
1466+
| [<span>StatusEntry#</span>headToIndex](/api/status_entry/#headToIndex) | |
1467+
| [<span>StatusEntry#</span>indexToWorkdir](/api/status_entry/#indexToWorkdir) | |
1468+
| [<span>StatusEntry#</span>status](/api/status_entry/#status) | |
1469+
1470+
14601471
## <a name='StatusList'></a>[StatusList](/api/status_list/)
14611472

14621473
| Class Methods | |
14631474
| --- | ---: |
1464-
| [<span>StatusList.</span>create <span>(repo, opts)</span>](/api/status_list/#create) | <span class="tags"><span class="sync">Sync</span><span class="experimental">Experimental</span></span> |
1475+
| [<span>StatusList.</span>create <span>(repo, opts)</span>](/api/status_list/#create) | <span class="tags"><span class="async">Async</span></span> |
14651476

14661477
| Instance Methods | |
14671478
| --- | ---: |
1468-
| [<span>StatusList#</span>entrycount <span>()</span>](/api/status_list/#entrycount) | <span class="tags"><span class="sync">Sync</span><span class="experimental">Experimental</span></span> |
1469-
| [<span>StatusList#</span>free <span>()</span>](/api/status_list/#free) | <span class="tags"><span class="sync">Sync</span><span class="experimental">Experimental</span></span> |
1470-
| [<span>StatusList#</span>getPerfdata <span>()</span>](/api/status_list/#getPerfdata) | <span class="tags"><span class="async">Async</span><span class="experimental">Experimental</span></span> |
1479+
| [<span>StatusList#</span>entrycount <span>()</span>](/api/status_list/#entrycount) | <span class="tags"><span class="sync">Sync</span></span> |
1480+
| [<span>StatusList#</span>free <span>()</span>](/api/status_list/#free) | <span class="tags"><span class="sync">Sync</span></span> |
1481+
| [<span>StatusList#</span>getPerfdata <span>()</span>](/api/status_list/#getPerfdata) | <span class="tags"><span class="async">Async</span></span> |
14711482

14721483

14731484
## <a name='StatusOptions'></a>[StatusOptions](/api/status_options/)

api/status/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ menu_item: api
77
return_to:
88
"API Documentation Index": /api/
99
sections:
10+
"byIndex": "#byIndex"
1011
"file": "#file"
1112
"foreach": "#foreach"
1213
"foreachExt": "#foreachExt"
@@ -16,6 +17,21 @@ sections:
1617
"STATUS": "#STATUS"
1718
---
1819

20+
## <a name="byIndex"></a><span>Status.</span>byIndex <span class="tags"><span class="sync">Sync</span></span>
21+
22+
```js
23+
var statusEntry = Status.byIndex(statuslist, idx);
24+
```
25+
26+
| Parameters | Type | |
27+
| --- | --- | --- |
28+
| statuslist | [StatusList](/api/status_list/) | Existing status list object |
29+
| idx | Number | Position of the entry |
30+
31+
| Returns | |
32+
| --- | --- |
33+
| [StatusEntry](/api/status_entry/) | |
34+
1935
## <a name="file"></a><span>Status.</span>file <span class="tags"><span class="sync">Sync</span></span>
2036

2137
```js

api/status_entry/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: default
3+
menu_item: api
4+
title: StatusEntry
5+
description: Version 0.3.0
6+
menu_item: api
7+
return_to:
8+
"API Documentation Index": /api/
9+
sections:
10+
"Instance Variables": "#ivars"
11+
---
12+
13+
## <a name="ivars"></a>Instance Variables
14+
15+
| Variable | Type |
16+
| --- | --- |
17+
| <a name="headToIndex"></a>headToIndex | DiffDelta |
18+
| <a name="indexToWorkdir"></a>indexToWorkdir | DiffDelta |
19+
| <a name="status"></a>status | Number |
20+

api/status_list/index.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ sections:
1313
"#getPerfdata": "#getPerfdata"
1414
---
1515

16-
## <a name="create"></a><span>StatusList.</span>create <span class="tags"><span class="sync">Sync</span><span class="experimental">Experimental</span></span>
16+
## <a name="create"></a><span>StatusList.</span>create <span class="tags"><span class="async">Async</span></span>
1717

1818
```js
19-
var statusList = StatusList.create(repo, opts);
19+
StatusList.create(repo, opts).then(function(statusList) {
20+
// Use statusList
21+
});
2022
```
2123

2224
| Parameters | Type | |
@@ -28,7 +30,7 @@ var statusList = StatusList.create(repo, opts);
2830
| --- | --- |
2931
| [StatusList](/api/status_list/) | |
3032

31-
## <a name="entrycount"></a><span>StatusList#</span>entrycount <span class="tags"><span class="sync">Sync</span><span class="experimental">Experimental</span></span>
33+
## <a name="entrycount"></a><span>StatusList#</span>entrycount <span class="tags"><span class="sync">Sync</span></span>
3234

3335
```js
3436
var result = statusList.entrycount();
@@ -38,13 +40,13 @@ var result = statusList.entrycount();
3840
| --- | --- |
3941
| Number | the number of status entries |
4042

41-
## <a name="free"></a><span>StatusList#</span>free <span class="tags"><span class="sync">Sync</span><span class="experimental">Experimental</span></span>
43+
## <a name="free"></a><span>StatusList#</span>free <span class="tags"><span class="sync">Sync</span></span>
4244

4345
```js
4446
statusList.free();
4547
```
4648

47-
## <a name="getPerfdata"></a><span>StatusList#</span>getPerfdata <span class="tags"><span class="async">Async</span><span class="experimental">Experimental</span></span>
49+
## <a name="getPerfdata"></a><span>StatusList#</span>getPerfdata <span class="tags"><span class="async">Async</span></span>
4850

4951
```js
5052
statusList.getPerfdata().then(function(diffPerfdata) {

css/main.scss

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,19 @@ $key-color: #F1595F;
1919
"syntax-highlighting"
2020
;
2121

22-
// Give quotes a GH-like appearance
22+
// Give quotes a GH-like appearance.
2323
blockquote {
2424
border-left: 3px solid #EDEDED;
2525
padding-left: 12px;
2626
}
27+
28+
// Thin gray line.
29+
hr {
30+
border: none;
31+
border-bottom: 1px solid #EDEDED;
32+
}
33+
34+
// Better separation from HR in Guides.
35+
.main h3 {
36+
margin-top: 15px;
37+
}

guides/cloning/gh-two-factor/index.md

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
Cloning
2-
=======
1+
---
2+
layout: full
3+
menu_item: guides
4+
title: GitHub Two Factor Auth Guide
5+
description: How to clone with GitHub Two Factor Authorization
6+
---
37

48
**In order to run examples, you will need to [Install NodeGit](../../install)
59
first.**
610

7-
[Return to cloning examples](../)
11+
[Return to cloning guides](../)
812

9-
HTTP/HTTPS clone
10-
----------------
13+
* * *
14+
15+
GitHub Two Factor Auth
16+
----------------------
1117

1218
This guide explains how to clone a repository, and in the case of failure,
1319
attempt to open the existing path.
@@ -29,16 +35,35 @@ However, in your project you will most likely be using the following command:
2935
var Git = require("nodegit");
3036
```
3137

38+
### GitHub Personal OAuth Token
39+
40+
Before you can clone a repository, you'll need a GitHub OAuth application
41+
token. You can find more information on generating one here:
42+
43+
[Creating an access token for command-line use](
44+
https://help.github.com/articles/creating-an-access-token-for-command-line-use/
45+
)
46+
47+
Once you have this token you'll assign it to a variable in your project, for
48+
this example, we'll call it `GITHUB_TOKEN`.
49+
50+
``` javascript
51+
var GITHUB_TOKEN = "<GH_TOKEN>";
52+
```
53+
54+
Keep this variable a secret. If you accidentally commit this key to a public
55+
GitHub repository they will immediately revoke it.
56+
3257
### Clone URL
3358

3459
The first argument to the `clone` method is a URL.
3560

36-
In this example we're going to clone one of our test repositories from GitHub.
37-
You could easily substitute this with any valid http or https Git repository
38-
URL.
61+
In this example we're going to clone one of our private test repositories from
62+
GitHub. You could easily substitute this with any valid http or https Git
63+
repository URL.
3964

4065
``` javascript
41-
var cloneURL = "https://github.com/nodegit/test";
66+
var cloneURL = "https://github.com/nodegit/private";
4267
```
4368

4469
### Clone path
@@ -70,7 +95,7 @@ var cloneOptions = {};
7095

7196
Unfortunately in OS X there is a problem where libgit2 is unable to look up
7297
GitHub certificates correctly. In order to bypass this problem, we're going
73-
to bypass the certificate check.
98+
to passthrough the certificate check.
7499

75100
*Note: this is not a problem with Windows or Linux*
76101

@@ -80,22 +105,38 @@ cloneOptions.remoteCallbacks = {
80105
};
81106
```
82107

83-
### Invoking the clone method
108+
#### GitHub credentials for Two Factor Auth
84109

85-
The way NodeGit is structured is that all [libgit2](http://libgit2.org) C
86-
methods are dynamically generated into C++. Since we're taking a
87-
class-oriented approach, we make a top level class named `Clone`. This class
88-
has a static method `clone` that we can use to bring down a repository.
110+
In order to authorize the clone operation, we'll need to respond to a low-level
111+
callback that expects credentials to be passed.
112+
113+
This function will be attached below the above `certificateCheck`, and will
114+
respond back with the OAuth token.
115+
116+
The `remoteCallbacks` object now looks like this:
117+
118+
``` javascript
119+
cloneOptions.remoteCallbacks = {
120+
certificateCheck: function() { return 1; },
121+
credentials: function() {
122+
return Git.Cred.userpassPlaintextNew(GITHUB_TOKEN, "x-oauth-basic");
123+
}
124+
};
125+
```
126+
127+
### Invoking the clone method
89128

90-
While it may look a bit verbose, it is symptomatic of a rigid convention.
129+
You can easily invoke our top-level Clone as a function passing along the three
130+
aforementioned arguments.
91131

92132
``` javascript
93133
var cloneRepository = Git.Clone(cloneURL, localPath, cloneOptions);
94134
```
95135

96-
Notice how we store the return value from `Clone.clone`. This is a [Promise]()
97-
to represent the asynchronous operation. It offers finer control flow by
98-
allowing us to capture errors and fallback if there is a clone failure.
136+
Notice how we store the return value from `Git.Clone`. This is a
137+
[Promise](https://www.promisejs.org/) to represent the asynchronous operation.
138+
It offers finer control flow by allowing us to capture errors and fallback if
139+
there is a clone failure.
99140

100141
### Handling clone failure
101142

guides/cloning/http/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Require in NodeGit, since we want to use the local copy, we"re using a
1+
// Require in NodeGit, since we want to use the local copy, we're using a
22
// relative path. In your project, you will use:
33
//
44
// var NodeGit = require("nodegit");

guides/cloning/http/index.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
---
22
layout: full
33
menu_item: guides
4-
title: HTTP Clone Guide
5-
description: How to clone with HTTP
4+
title: HTTP/HTTPS Guide
5+
description: How to clone with HTTP/HTTPS
66
---
77

88
**In order to run examples, you will need to [Install NodeGit](../../install)
99
first.**
1010

1111
[Return to cloning guides](../)
1212

13-
HTTP/HTTPS clone
14-
----------------
13+
* * *
14+
15+
HTTP/HTTPS
16+
----------
1517

1618
This guide explains how to clone a repository, and in the case of failure,
1719
attempt to open the existing path.
@@ -70,11 +72,13 @@ The third argument to the `clone` method is an optional simple object.
7072
var cloneOptions = {};
7173
```
7274

75+
**If you are using HTTP the OS X issue below does not affect you.**
76+
7377
#### GitHub certificate issue in OS X
7478

7579
Unfortunately in OS X there is a problem where libgit2 is unable to look up
7680
GitHub certificates correctly. In order to bypass this problem, we're going
77-
to bypass the certificate check.
81+
to passthrough the certificate check.
7882

7983
*Note: this is not a problem with Windows or Linux*
8084

@@ -86,20 +90,17 @@ cloneOptions.remoteCallbacks = {
8690

8791
### Invoking the clone method
8892

89-
The way NodeGit is structured is that all [libgit2](http://libgit2.org) C
90-
methods are dynamically generated into C++. Since we're taking a
91-
class-oriented approach, we make a top level class named `Clone`. This class
92-
has a static method `clone` that we can use to bring down a repository.
93-
94-
While it may look a bit verbose, it is symptomatic of a rigid convention.
93+
You can easily invoke our top-level Clone as a function passing along the three
94+
aforementioned arguments.
9595

9696
``` javascript
9797
var cloneRepository = Git.Clone(cloneURL, localPath, cloneOptions);
9898
```
9999

100-
Notice how we store the return value from `Clone.clone`. This is a [Promise]()
101-
to represent the asynchronous operation. It offers finer control flow by
102-
allowing us to capture errors and fallback if there is a clone failure.
100+
Notice how we store the return value from `Git.Clone`. This is a
101+
[Promise](https://www.promisejs.org/) to represent the asynchronous operation.
102+
It offers finer control flow by allowing us to capture errors and fallback if
103+
there is a clone failure.
103104

104105
### Handling clone failure
105106

guides/cloning/index.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
2-
layout: default
2+
layout: full
33
menu_item: guides
4-
return_to:
5-
"All Guides": ../
64
title: Cloning Guides
75
description: How to clone repositories
86
---
97

10-
### [HTTP/HTTPS clone](http/)
8+
[Return to all guides](../)
9+
10+
* * *
11+
12+
### [HTTP/HTTPS](http/)
1113

1214
> Emulates `git clone https://github.com/nodegit/test`
1315

0 commit comments

Comments
 (0)