|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +menu_item: api |
| 4 | +title: Blame |
| 5 | +description: Version 0.3.0 |
| 6 | +menu_item: api |
| 7 | +return_to: |
| 8 | + "API Documentation Index": /api/ |
| 9 | +sections: |
| 10 | + "file": "#file" |
| 11 | + "#buffer": "#buffer" |
| 12 | + "#getHunkByIndex": "#getHunkByIndex" |
| 13 | + "#getHunkByLine": "#getHunkByLine" |
| 14 | + "#getHunkCount": "#getHunkCount" |
| 15 | + "FLAG": "#FLAG" |
| 16 | +--- |
| 17 | + |
| 18 | +## <a name="file"></a><span>Blame.</span>file <span class="tags"><span class="async">Async</span><span class="experimental">Experimental</span></span> |
| 19 | + |
| 20 | +```js |
| 21 | +Blame.file(repo, path, options).then(function(blame) { |
| 22 | + // Use blame |
| 23 | +}); |
| 24 | +``` |
| 25 | + |
| 26 | +| Parameters | Type | | |
| 27 | +| --- | --- | --- | |
| 28 | +| repo | [Repository](/api/repository/) | repository whose history is to be walked | |
| 29 | +| path | String | path to file to consider | |
| 30 | +| options | [BlameOptions](/api/blame_options/) | options for the blame operation. If NULL, this is treated as though GIT_BLAME_OPTIONS_INIT were passed. | |
| 31 | + |
| 32 | +| Returns | | |
| 33 | +| --- | --- | |
| 34 | +| [Blame](/api/blame/) | pointer that will receive the blame object | |
| 35 | + |
| 36 | +## <a name="buffer"></a><span>Blame#</span>buffer <span class="tags"><span class="async">Async</span><span class="experimental">Experimental</span></span> |
| 37 | + |
| 38 | +```js |
| 39 | +blame.buffer(buffer, buffer_len).then(function(blame) { |
| 40 | + // Use blame |
| 41 | +}); |
| 42 | +``` |
| 43 | + |
| 44 | +| Parameters | Type | |
| 45 | +| --- | --- | --- | |
| 46 | +| buffer | String | the (possibly) modified contents of the file | |
| 47 | +| buffer_len | Number | number of valid bytes in the buffer | |
| 48 | + |
| 49 | +| Returns | | |
| 50 | +| --- | --- | |
| 51 | +| [Blame](/api/blame/) | pointer that will receive the resulting blame data | |
| 52 | + |
| 53 | +## <a name="getHunkByIndex"></a><span>Blame#</span>getHunkByIndex <span class="tags"><span class="sync">Sync</span><span class="experimental">Experimental</span></span> |
| 54 | + |
| 55 | +```js |
| 56 | +var blameHunk = blame.getHunkByIndex(index); |
| 57 | +``` |
| 58 | + |
| 59 | +| Parameters | Type | |
| 60 | +| --- | --- | --- | |
| 61 | +| index | Number | index of the hunk to retrieve | |
| 62 | + |
| 63 | +| Returns | | |
| 64 | +| --- | --- | |
| 65 | +| [BlameHunk](/api/blame_hunk/) | the hunk at the given index, or NULL on error | |
| 66 | + |
| 67 | +## <a name="getHunkByLine"></a><span>Blame#</span>getHunkByLine <span class="tags"><span class="sync">Sync</span><span class="experimental">Experimental</span></span> |
| 68 | + |
| 69 | +```js |
| 70 | +var blameHunk = blame.getHunkByLine(lineno); |
| 71 | +``` |
| 72 | + |
| 73 | +| Parameters | Type | |
| 74 | +| --- | --- | --- | |
| 75 | +| lineno | Number | the (1-based) line number to find a hunk for | |
| 76 | + |
| 77 | +| Returns | | |
| 78 | +| --- | --- | |
| 79 | +| [BlameHunk](/api/blame_hunk/) | the hunk that contains the given line, or NULL on error | |
| 80 | + |
| 81 | +## <a name="getHunkCount"></a><span>Blame#</span>getHunkCount <span class="tags"><span class="sync">Sync</span><span class="experimental">Experimental</span></span> |
| 82 | + |
| 83 | +```js |
| 84 | +var result = blame.getHunkCount(); |
| 85 | +``` |
| 86 | + |
| 87 | + |
| 88 | +| Returns | | |
| 89 | +| --- | --- | |
| 90 | +| Number | | |
| 91 | + |
| 92 | +## <a name="FLAG"></a><span>Blame.</span>FLAG <span class="tags"><span class="enum">ENUM</span></span> |
| 93 | + |
| 94 | +| Flag | Value | |
| 95 | +| --- | --- | --- | |
| 96 | +| <span>Blame.FLAG.</span>NORMAL | 0 | |
| 97 | +| <span>Blame.FLAG.</span>TRACK_COPIES_SAME_FILE | 1 | |
| 98 | +| <span>Blame.FLAG.</span>TRACK_COPIES_SAME_COMMIT_MOVES | 2 | |
| 99 | +| <span>Blame.FLAG.</span>TRACK_COPIES_SAME_COMMIT_COPIES | 4 | |
| 100 | +| <span>Blame.FLAG.</span>TRACK_COPIES_ANY_COMMIT_COPIES | 8 | |
| 101 | +| <span>Blame.FLAG.</span>FIRST_PARENT | 16 | |
| 102 | + |
0 commit comments