es-git 0.2.0 → 0.3.0-next.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1022 -4
- package/index.js +14 -1
- package/package.json +11 -11
package/index.d.ts
CHANGED
|
@@ -3,6 +3,112 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Represents a hunk of a blame operation, which is a range of lines
|
|
8
|
+
* and information about who last modified them.
|
|
9
|
+
*/
|
|
10
|
+
export interface BlameHunk {
|
|
11
|
+
/** The oid of the commit where this line was last changed. */
|
|
12
|
+
finalCommitId: string
|
|
13
|
+
/** The 1-based line number in the final file where this hunk starts. */
|
|
14
|
+
finalStartLineNumber: number
|
|
15
|
+
/** The number of lines in this hunk. */
|
|
16
|
+
linesInHunk: number
|
|
17
|
+
/** The signature of the commit where this line was last changed. */
|
|
18
|
+
finalSignature?: Signature
|
|
19
|
+
/** The path to the file where this line was originally written. */
|
|
20
|
+
path?: string
|
|
21
|
+
/** The 1-based line number in the original file where this hunk starts. */
|
|
22
|
+
origStartLineNumber: number
|
|
23
|
+
/** The oid of the commit where this line was originally written. */
|
|
24
|
+
origCommitId: string
|
|
25
|
+
/** The signature of the commit where this line was originally written. */
|
|
26
|
+
origSignature?: Signature
|
|
27
|
+
/**
|
|
28
|
+
* True if the hunk has been determined to be a boundary commit (the commit
|
|
29
|
+
* when the file was first introduced to the repository).
|
|
30
|
+
*/
|
|
31
|
+
isBoundary: boolean
|
|
32
|
+
}
|
|
33
|
+
/** Options for controlling blame behavior */
|
|
34
|
+
export interface BlameOptions {
|
|
35
|
+
/** The minimum line number to blame (1-based index) */
|
|
36
|
+
minLine?: number
|
|
37
|
+
/** The maximum line number to blame (1-based index) */
|
|
38
|
+
maxLine?: number
|
|
39
|
+
/**
|
|
40
|
+
* The oid of the newest commit to consider. The blame algorithm will stop
|
|
41
|
+
* when this commit is reached.
|
|
42
|
+
*/
|
|
43
|
+
newestCommit?: string
|
|
44
|
+
/**
|
|
45
|
+
* The oid of the oldest commit to consider. The blame algorithm will
|
|
46
|
+
* stop when this commit is reached.
|
|
47
|
+
*/
|
|
48
|
+
oldestCommit?: string
|
|
49
|
+
/**
|
|
50
|
+
* The path to the file being worked on. Path has to be relative to the
|
|
51
|
+
* repo root.
|
|
52
|
+
*/
|
|
53
|
+
path?: string
|
|
54
|
+
/**
|
|
55
|
+
* Track lines that have moved within a file. This is the git-blame -M
|
|
56
|
+
* option.
|
|
57
|
+
*/
|
|
58
|
+
trackLinesMovement?: boolean
|
|
59
|
+
/** Restrict search to commits reachable following only first parents. */
|
|
60
|
+
firstParent?: boolean
|
|
61
|
+
/** Ignore whitespace differences. */
|
|
62
|
+
ignoreWhitespace?: boolean
|
|
63
|
+
/** Track lines that have been copied from another file that exists in any commit. */
|
|
64
|
+
trackCopiesAnyCommitCopies?: boolean
|
|
65
|
+
/** Track lines that have been copied from another file that exists in the same commit. */
|
|
66
|
+
trackCopiesSameCommitCopies?: boolean
|
|
67
|
+
/** Track lines that have moved across files in the same commit. */
|
|
68
|
+
trackCopiesSameCommitMoves?: boolean
|
|
69
|
+
/** Use mailmap file to map author and committer names and email addresses to canonical real names and email addresses. */
|
|
70
|
+
useMailmap?: boolean
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Ensure the branch name is well-formed.
|
|
74
|
+
*
|
|
75
|
+
* @category Branch
|
|
76
|
+
* @signature
|
|
77
|
+
* ```ts
|
|
78
|
+
* function isValidBranchName(name: string): boolean;
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param {string} name - Branch name to check is valid.
|
|
82
|
+
* @returns Returns `true` if the given branch name is well-formed.
|
|
83
|
+
*/
|
|
84
|
+
export declare function isValidBranchName(name: string): boolean
|
|
85
|
+
export interface BranchesItem {
|
|
86
|
+
type: BranchType
|
|
87
|
+
name: string
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* - `Local` : A local branch not on a remote.
|
|
91
|
+
* - `Remote` : A branch for a remote.
|
|
92
|
+
*/
|
|
93
|
+
export type BranchType = 'Local' | 'Remote';
|
|
94
|
+
export interface BranchRenameOptions {
|
|
95
|
+
/**
|
|
96
|
+
* If the force flag is not enabled, and there's already a branch with
|
|
97
|
+
* the given name, the renaming will fail.
|
|
98
|
+
*/
|
|
99
|
+
force?: boolean
|
|
100
|
+
}
|
|
101
|
+
export interface CreateBranchOptions {
|
|
102
|
+
/**
|
|
103
|
+
* If `force` is true and a reference already exists with the given name,
|
|
104
|
+
* it'll be replaced.
|
|
105
|
+
*/
|
|
106
|
+
force?: boolean
|
|
107
|
+
}
|
|
108
|
+
export interface BranchesFilter {
|
|
109
|
+
/** Branch type to filter. */
|
|
110
|
+
type?: BranchType
|
|
111
|
+
}
|
|
6
112
|
export interface CommitOptions {
|
|
7
113
|
updateRef?: string
|
|
8
114
|
/**
|
|
@@ -20,6 +126,18 @@ export interface CommitOptions {
|
|
|
20
126
|
*/
|
|
21
127
|
committer?: SignaturePayload
|
|
22
128
|
parents?: Array<string>
|
|
129
|
+
/**
|
|
130
|
+
* GPG signature string for signed commits.
|
|
131
|
+
*
|
|
132
|
+
* If provided, this will create a signed commit.
|
|
133
|
+
*/
|
|
134
|
+
signature?: string
|
|
135
|
+
/**
|
|
136
|
+
* Custom signature field name.
|
|
137
|
+
*
|
|
138
|
+
* If not provided, the default signature field (gpgsig) will be used.
|
|
139
|
+
*/
|
|
140
|
+
signatureField?: string
|
|
23
141
|
}
|
|
24
142
|
/**
|
|
25
143
|
* - `ProgramData` : System-wide on Windows, for compatibility with portable git.
|
|
@@ -538,6 +656,33 @@ export interface IndexUpdateAllOptions {
|
|
|
538
656
|
*/
|
|
539
657
|
onMatch?: (args: IndexOnMatchCallbackArgs) => number
|
|
540
658
|
}
|
|
659
|
+
export interface AddMailmapEntryData {
|
|
660
|
+
realName?: string
|
|
661
|
+
realEmail?: string
|
|
662
|
+
replaceName?: string
|
|
663
|
+
replaceEmail: string
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Create a mailmap from the contents of a string.
|
|
667
|
+
*
|
|
668
|
+
* The format of the string should follow the rules of the mailmap file:
|
|
669
|
+
* ```
|
|
670
|
+
* # Comment line (ignored)
|
|
671
|
+
* Seokju Me <seokju.me@toss.im> Seokju Na <seokju.me@gmail.com>
|
|
672
|
+
* ```
|
|
673
|
+
*
|
|
674
|
+
* @param {string} content - Content of the mailmap file
|
|
675
|
+
* @returns A new mailmap object
|
|
676
|
+
* @throws An error if operation failed
|
|
677
|
+
*
|
|
678
|
+
* @category Mailmap
|
|
679
|
+
*
|
|
680
|
+
* @signature
|
|
681
|
+
* ```ts
|
|
682
|
+
* function createMailmapFromBuffer(content: string): Mailmap;
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
export declare function createMailmapFromBuffer(content: string): Mailmap
|
|
541
686
|
/**
|
|
542
687
|
* - `Any` : Any kind of git object
|
|
543
688
|
* - `Commit` : An object which corresponds to a git commit
|
|
@@ -1048,6 +1193,12 @@ export interface RepositoryCloneOptions {
|
|
|
1048
1193
|
/** Options which can be specified to various fetch operations. */
|
|
1049
1194
|
fetch?: FetchOptions
|
|
1050
1195
|
}
|
|
1196
|
+
export interface ExtractedSignature {
|
|
1197
|
+
/** GPG signature of the commit, or null if the commit is not signed. */
|
|
1198
|
+
signature: string
|
|
1199
|
+
/** Signed data of the commit. */
|
|
1200
|
+
signedData: string
|
|
1201
|
+
}
|
|
1051
1202
|
/**
|
|
1052
1203
|
* Creates a new repository in the specified folder.
|
|
1053
1204
|
*
|
|
@@ -1318,6 +1469,66 @@ export interface SignaturePayload {
|
|
|
1318
1469
|
email: string
|
|
1319
1470
|
timeOptions?: SignatureTimeOptions
|
|
1320
1471
|
}
|
|
1472
|
+
export interface Status {
|
|
1473
|
+
current: boolean
|
|
1474
|
+
indexNew: boolean
|
|
1475
|
+
indexModified: boolean
|
|
1476
|
+
indexDeleted: boolean
|
|
1477
|
+
indexRenamed: boolean
|
|
1478
|
+
indexTypechange: boolean
|
|
1479
|
+
wtNew: boolean
|
|
1480
|
+
wtModified: boolean
|
|
1481
|
+
wtDeleted: boolean
|
|
1482
|
+
wtTypechange: boolean
|
|
1483
|
+
wtRenamed: boolean
|
|
1484
|
+
ignored: boolean
|
|
1485
|
+
conflicted: boolean
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* - `Index` : Only gives status based on HEAD to index comparison, not looking at
|
|
1489
|
+
* working directory changes.
|
|
1490
|
+
* - `Workdir` : Only gives status based on index to working directory comparison, not
|
|
1491
|
+
* comparing the index to the HEAD.
|
|
1492
|
+
* - `IndexAndWorkdi` : The default, this roughly matches `git status --porcelain` regarding
|
|
1493
|
+
* which files are included and in what order.
|
|
1494
|
+
*/
|
|
1495
|
+
export type StatusShow = 'Index' | 'Workdir' | 'IndexAndWorkdir';
|
|
1496
|
+
export interface StatusOptions {
|
|
1497
|
+
/**
|
|
1498
|
+
* Select the files on which to report status.
|
|
1499
|
+
* The default, if unspecified, is to show the index and the working directory.
|
|
1500
|
+
*/
|
|
1501
|
+
show?: StatusShow
|
|
1502
|
+
/**
|
|
1503
|
+
* Path patterns to match (using fnmatch-style matching).
|
|
1504
|
+
* If the `disablePathspecMatch` option is given, then this is a literal
|
|
1505
|
+
* path to match. If this is not called, then there will be no patterns to
|
|
1506
|
+
* match and the entire directory will be used.
|
|
1507
|
+
*/
|
|
1508
|
+
pathspecs?: Array<string>
|
|
1509
|
+
/**
|
|
1510
|
+
* Flag whether untracked files will be included.
|
|
1511
|
+
* Untracked files will only be included if the workdir files are included
|
|
1512
|
+
* in the status "show" option.
|
|
1513
|
+
*/
|
|
1514
|
+
includeUntracked?: boolean
|
|
1515
|
+
includeIgnored?: boolean
|
|
1516
|
+
includeUnmodified?: boolean
|
|
1517
|
+
excludeSubmodules?: boolean
|
|
1518
|
+
recurseUntrackedDirs?: boolean
|
|
1519
|
+
disablePathspecMatch?: boolean
|
|
1520
|
+
recurseIgnoredDirs?: boolean
|
|
1521
|
+
renamesHeadToIndex?: boolean
|
|
1522
|
+
renamesIndexToWorkdir?: boolean
|
|
1523
|
+
sortCaseSensitively?: boolean
|
|
1524
|
+
sortCaseInsensitively?: boolean
|
|
1525
|
+
renamesFromRewrites?: boolean
|
|
1526
|
+
noRefresh?: boolean
|
|
1527
|
+
updateIndex?: boolean
|
|
1528
|
+
includeUnreadable?: boolean
|
|
1529
|
+
includeUnreadableAsUntracked?: boolean
|
|
1530
|
+
renameThreshold?: number
|
|
1531
|
+
}
|
|
1321
1532
|
/**
|
|
1322
1533
|
* Determine whether a tag name is valid, meaning that (when prefixed with refs/tags/) that
|
|
1323
1534
|
* it is a valid reference name, and that any additional tag name restrictions are imposed
|
|
@@ -1362,6 +1573,146 @@ export interface CreateLightweightTagOptions {
|
|
|
1362
1573
|
* - `PostOrder` : Runs the traversal in post-order.
|
|
1363
1574
|
*/
|
|
1364
1575
|
export type TreeWalkMode = 'PreOrder' | 'PostOrder';
|
|
1576
|
+
/** A wrapper around git2::Blame providing Node.js bindings */
|
|
1577
|
+
export declare class Blame {
|
|
1578
|
+
/**
|
|
1579
|
+
* Gets the number of hunks in the blame result
|
|
1580
|
+
*
|
|
1581
|
+
* @category Blame/Methods
|
|
1582
|
+
* @signature
|
|
1583
|
+
* ```ts
|
|
1584
|
+
* class Blame {
|
|
1585
|
+
* getHunkCount(): number;
|
|
1586
|
+
* }
|
|
1587
|
+
* ```
|
|
1588
|
+
*
|
|
1589
|
+
* @returns The number of hunks in the blame result
|
|
1590
|
+
*/
|
|
1591
|
+
getHunkCount(): number
|
|
1592
|
+
/**
|
|
1593
|
+
* Checks if the blame result is empty
|
|
1594
|
+
*
|
|
1595
|
+
* @category Blame/Methods
|
|
1596
|
+
* @signature
|
|
1597
|
+
* ```ts
|
|
1598
|
+
* class Blame {
|
|
1599
|
+
* isEmpty(): boolean;
|
|
1600
|
+
* }
|
|
1601
|
+
* ```
|
|
1602
|
+
*
|
|
1603
|
+
* @returns True if the blame result contains no hunks
|
|
1604
|
+
*/
|
|
1605
|
+
isEmpty(): boolean
|
|
1606
|
+
/**
|
|
1607
|
+
* Gets blame information for the specified index
|
|
1608
|
+
*
|
|
1609
|
+
* @category Blame/Methods
|
|
1610
|
+
* @signature
|
|
1611
|
+
* ```ts
|
|
1612
|
+
* class Blame {
|
|
1613
|
+
* getHunkByIndex(index: number): BlameHunk;
|
|
1614
|
+
* }
|
|
1615
|
+
* ```
|
|
1616
|
+
*
|
|
1617
|
+
* @param {number} index - Index of the hunk to get (0-based)
|
|
1618
|
+
* @returns Blame information for the specified index
|
|
1619
|
+
* @throws If no hunk is found at the index
|
|
1620
|
+
*/
|
|
1621
|
+
getHunkByIndex(index: number): BlameHunk
|
|
1622
|
+
/**
|
|
1623
|
+
* Gets blame information for the specified line
|
|
1624
|
+
*
|
|
1625
|
+
* @category Blame/Methods
|
|
1626
|
+
* @signature
|
|
1627
|
+
* ```ts
|
|
1628
|
+
* class Blame {
|
|
1629
|
+
* getHunkByLine(line: number): BlameHunk;
|
|
1630
|
+
* }
|
|
1631
|
+
* ```
|
|
1632
|
+
*
|
|
1633
|
+
* @param {number} line - Line number to get blame information for (1-based)
|
|
1634
|
+
* @returns Blame information for the specified line
|
|
1635
|
+
* @throws If no hunk is found for the line
|
|
1636
|
+
*/
|
|
1637
|
+
getHunkByLine(line: number): BlameHunk
|
|
1638
|
+
/**
|
|
1639
|
+
* Gets all blame hunks as an iterator
|
|
1640
|
+
*
|
|
1641
|
+
* @category Blame/Methods
|
|
1642
|
+
* @signature
|
|
1643
|
+
* ```ts
|
|
1644
|
+
* class Blame {
|
|
1645
|
+
* iter(): Generator<BlameHunk>;
|
|
1646
|
+
* }
|
|
1647
|
+
* ```
|
|
1648
|
+
*
|
|
1649
|
+
* @returns Iterator of all blame hunks
|
|
1650
|
+
* @example
|
|
1651
|
+
* ```ts
|
|
1652
|
+
* // Using for...of loop
|
|
1653
|
+
* for (const hunk of blame.iter()) {
|
|
1654
|
+
* console.log(hunk.finalCommitId);
|
|
1655
|
+
* }
|
|
1656
|
+
*
|
|
1657
|
+
* // Using spread operator to collect all hunks
|
|
1658
|
+
* const hunks = [...blame.iter()];
|
|
1659
|
+
* ```
|
|
1660
|
+
*/
|
|
1661
|
+
iter(): BlameHunks
|
|
1662
|
+
/**
|
|
1663
|
+
* Collects blame hunks by scanning file lines as an iterator
|
|
1664
|
+
*
|
|
1665
|
+
* @category Blame/Methods
|
|
1666
|
+
* @signature
|
|
1667
|
+
* ```ts
|
|
1668
|
+
* class Blame {
|
|
1669
|
+
* iterByLine(): Generator<BlameHunk>;
|
|
1670
|
+
* }
|
|
1671
|
+
* ```
|
|
1672
|
+
*
|
|
1673
|
+
* @returns Iterator of blame hunks collected by line scanning
|
|
1674
|
+
* @example
|
|
1675
|
+
* ```ts
|
|
1676
|
+
* // Using for...of loop
|
|
1677
|
+
* for (const hunk of blame.iterByLine()) {
|
|
1678
|
+
* console.log(hunk.finalCommitId);
|
|
1679
|
+
* }
|
|
1680
|
+
*
|
|
1681
|
+
* // Using spread operator to collect all hunks
|
|
1682
|
+
* const hunks = [...blame.iterByLine()];
|
|
1683
|
+
* ```
|
|
1684
|
+
*/
|
|
1685
|
+
iterByLine(): BlameHunksByLine
|
|
1686
|
+
/**
|
|
1687
|
+
* Generates blame information from an in-memory buffer
|
|
1688
|
+
*
|
|
1689
|
+
* @category Blame/Methods
|
|
1690
|
+
* @signature
|
|
1691
|
+
* ```ts
|
|
1692
|
+
* class Blame {
|
|
1693
|
+
* buffer(buffer: Buffer): Blame;
|
|
1694
|
+
* }
|
|
1695
|
+
* ```
|
|
1696
|
+
*
|
|
1697
|
+
* @example
|
|
1698
|
+
* ```ts
|
|
1699
|
+
* const buffer = Buffer.from('modified content');
|
|
1700
|
+
* const bufferBlame = blame.buffer(buffer);
|
|
1701
|
+
* ```
|
|
1702
|
+
*
|
|
1703
|
+
* @param {Buffer} buffer - Buffer containing file content to blame
|
|
1704
|
+
* @returns A new Blame object for the buffer content
|
|
1705
|
+
*/
|
|
1706
|
+
buffer(buffer: Buffer): Blame
|
|
1707
|
+
}
|
|
1708
|
+
/** An iterator over blame hunks. */
|
|
1709
|
+
export declare class BlameHunks {
|
|
1710
|
+
[Symbol.iterator](): Iterator<BlameHunk, void, void>
|
|
1711
|
+
}
|
|
1712
|
+
/** Iterator over blame hunks collected line by line. */
|
|
1713
|
+
export declare class BlameHunksByLine {
|
|
1714
|
+
[Symbol.iterator](): Iterator<BlameHunk, void, void>
|
|
1715
|
+
}
|
|
1365
1716
|
/**
|
|
1366
1717
|
* A class to represent a git [blob][1].
|
|
1367
1718
|
* [1]: https://git-scm.com/book/en/Git-Internals-Git-Objects
|
|
@@ -1428,6 +1779,148 @@ export declare class Blob {
|
|
|
1428
1779
|
*/
|
|
1429
1780
|
size(): bigint
|
|
1430
1781
|
}
|
|
1782
|
+
/**
|
|
1783
|
+
* A structure to represent a git [branch][1]
|
|
1784
|
+
*
|
|
1785
|
+
* A branch is currently just a wrapper to an underlying `Reference`. The
|
|
1786
|
+
* reference can be accessed through the `get` and `into_reference` methods.
|
|
1787
|
+
*
|
|
1788
|
+
* [1]: http://git-scm.com/book/en/Git-Branching-What-a-Branch-Is
|
|
1789
|
+
*/
|
|
1790
|
+
export declare class Branch {
|
|
1791
|
+
/**
|
|
1792
|
+
* Get the OID pointed to by a reference which is this branch.
|
|
1793
|
+
*
|
|
1794
|
+
* @category Branch/Methods
|
|
1795
|
+
* @signature
|
|
1796
|
+
* ```ts
|
|
1797
|
+
* class Branch {
|
|
1798
|
+
* referenceTarget(): string | null;
|
|
1799
|
+
* }
|
|
1800
|
+
* ```
|
|
1801
|
+
*
|
|
1802
|
+
* @returns The OID pointed to by a reference which is this branch.
|
|
1803
|
+
*/
|
|
1804
|
+
referenceTarget(): string | null
|
|
1805
|
+
/**
|
|
1806
|
+
* Delete an existing branch reference.
|
|
1807
|
+
*
|
|
1808
|
+
* @category Branch/Methods
|
|
1809
|
+
* @signature
|
|
1810
|
+
* ```ts
|
|
1811
|
+
* class Branch {
|
|
1812
|
+
* delete(): void;
|
|
1813
|
+
* }
|
|
1814
|
+
* ```
|
|
1815
|
+
*/
|
|
1816
|
+
delete(): void
|
|
1817
|
+
/**
|
|
1818
|
+
* Determine if the current local branch is pointed at by `HEAD`.
|
|
1819
|
+
*
|
|
1820
|
+
* @category Branch/Methods
|
|
1821
|
+
* @signature
|
|
1822
|
+
* ```ts
|
|
1823
|
+
* class Branch {
|
|
1824
|
+
* isHead(): boolean;
|
|
1825
|
+
* }
|
|
1826
|
+
* ```
|
|
1827
|
+
*
|
|
1828
|
+
* @returns Returns `true` if the current local branch is pointed at by `HEAD`.
|
|
1829
|
+
*/
|
|
1830
|
+
isHead(): boolean
|
|
1831
|
+
/**
|
|
1832
|
+
* Move/rename an existing local branch reference.
|
|
1833
|
+
*
|
|
1834
|
+
* @category Branch/Methods
|
|
1835
|
+
* @signature
|
|
1836
|
+
* ```ts
|
|
1837
|
+
* class Branch {
|
|
1838
|
+
* rename(newBranchName: string, options?: BranchRenameOptions | null | undefined): Branch;
|
|
1839
|
+
* }
|
|
1840
|
+
* ```
|
|
1841
|
+
*
|
|
1842
|
+
* @param {string} newBranchName - Branch name to move/rename.
|
|
1843
|
+
* @param {BranchRenameOptions} [options] - Options for move/rename branch.
|
|
1844
|
+
* @returns Move/renamed branch.
|
|
1845
|
+
*/
|
|
1846
|
+
rename(newBranchName: string, options?: BranchRenameOptions | undefined | null): Branch
|
|
1847
|
+
/**
|
|
1848
|
+
* Return the name of the given local or remote branch.
|
|
1849
|
+
*
|
|
1850
|
+
* @category Branch/Methods
|
|
1851
|
+
* @signature
|
|
1852
|
+
* ```ts
|
|
1853
|
+
* class Branch {
|
|
1854
|
+
* name(): string;
|
|
1855
|
+
* }
|
|
1856
|
+
* ```
|
|
1857
|
+
*
|
|
1858
|
+
* @returns The name of the given local or remote branch.
|
|
1859
|
+
* @throws If the name is not valid utf-8.
|
|
1860
|
+
*/
|
|
1861
|
+
name(): string
|
|
1862
|
+
/**
|
|
1863
|
+
* Return the reference supporting the remote tracking branch, given a
|
|
1864
|
+
* local branch reference.
|
|
1865
|
+
*
|
|
1866
|
+
* @category Branch/Methods
|
|
1867
|
+
* @signature
|
|
1868
|
+
* ```ts
|
|
1869
|
+
* class Branch {
|
|
1870
|
+
* findUpstream(): Branch | null;
|
|
1871
|
+
* }
|
|
1872
|
+
* ```
|
|
1873
|
+
*
|
|
1874
|
+
* @returns The reference supporting the remote tacking branch.
|
|
1875
|
+
*/
|
|
1876
|
+
findUpstream(): Branch | null
|
|
1877
|
+
/**
|
|
1878
|
+
* Return the reference supporting the remote tracking branch, given a
|
|
1879
|
+
* local branch reference.
|
|
1880
|
+
*
|
|
1881
|
+
* @category Branch/Methods
|
|
1882
|
+
* @signature
|
|
1883
|
+
* ```ts
|
|
1884
|
+
* class Branch {
|
|
1885
|
+
* getUpstream(): Branch;
|
|
1886
|
+
* }
|
|
1887
|
+
* ```
|
|
1888
|
+
*
|
|
1889
|
+
* @returns The reference supporting the remote tacking branch.
|
|
1890
|
+
* @throws Throws error if upstream does not exist.
|
|
1891
|
+
*/
|
|
1892
|
+
getUpstream(): Branch
|
|
1893
|
+
/**
|
|
1894
|
+
* Set the upstream configuration for a given local branch.
|
|
1895
|
+
*
|
|
1896
|
+
* @category Branch/Methods
|
|
1897
|
+
* @signature
|
|
1898
|
+
* ```ts
|
|
1899
|
+
* class Branch {
|
|
1900
|
+
* setUpstream(upstreamName: string): void;
|
|
1901
|
+
* }
|
|
1902
|
+
* ```
|
|
1903
|
+
*
|
|
1904
|
+
* @param {string} upstreamName - Branch name to set as upstream.
|
|
1905
|
+
*/
|
|
1906
|
+
setUpstream(upstreamName: string): void
|
|
1907
|
+
/**
|
|
1908
|
+
* Unset the upstream configuration for a given local branch.
|
|
1909
|
+
*
|
|
1910
|
+
* @category Branch/Methods
|
|
1911
|
+
* @signature
|
|
1912
|
+
* ```ts
|
|
1913
|
+
* class Branch {
|
|
1914
|
+
* unsetUpstream(): void;
|
|
1915
|
+
* }
|
|
1916
|
+
* ```
|
|
1917
|
+
*/
|
|
1918
|
+
unsetUpstream(): void
|
|
1919
|
+
}
|
|
1920
|
+
/** An iterator over the branches inside of a repository. */
|
|
1921
|
+
export declare class Branches {
|
|
1922
|
+
[Symbol.iterator](): Iterator<BranchesItem, void, void>
|
|
1923
|
+
}
|
|
1431
1924
|
/** A class to represent a git commit. */
|
|
1432
1925
|
export declare class Commit {
|
|
1433
1926
|
/**
|
|
@@ -1584,6 +2077,40 @@ export declare class Commit {
|
|
|
1584
2077
|
* @returns `GitObject` that casted from this commit.
|
|
1585
2078
|
*/
|
|
1586
2079
|
asObject(): GitObject
|
|
2080
|
+
/**
|
|
2081
|
+
* Get the author of this commit, using the mailmap to map it to the canonical name and email.
|
|
2082
|
+
*
|
|
2083
|
+
* @category Commit/Methods
|
|
2084
|
+
*
|
|
2085
|
+
* @signature
|
|
2086
|
+
* ```ts
|
|
2087
|
+
* class Commit {
|
|
2088
|
+
* authorWithMailmap(mailmap: Mailmap): Signature;
|
|
2089
|
+
* }
|
|
2090
|
+
* ```
|
|
2091
|
+
*
|
|
2092
|
+
* @param {Mailmap} mailmap - The mailmap to use for mapping
|
|
2093
|
+
* @returns Author signature of this commit with mapping applied
|
|
2094
|
+
* @throws An error if the operation failed.
|
|
2095
|
+
*/
|
|
2096
|
+
authorWithMailmap(mailmap: Mailmap): Signature
|
|
2097
|
+
/**
|
|
2098
|
+
* Get the committer of this commit, using the mailmap to map it to the canonical name and email.
|
|
2099
|
+
*
|
|
2100
|
+
* @category Commit/Methods
|
|
2101
|
+
*
|
|
2102
|
+
* @signature
|
|
2103
|
+
* ```ts
|
|
2104
|
+
* class Commit {
|
|
2105
|
+
* committerWithMailmap(mailmap: Mailmap): Signature;
|
|
2106
|
+
* }
|
|
2107
|
+
* ```
|
|
2108
|
+
*
|
|
2109
|
+
* @param {Mailmap} mailmap - The mailmap to use for mapping
|
|
2110
|
+
* @returns Committer signature of this commit with mapping applied
|
|
2111
|
+
* @throws An error if the operation failed.
|
|
2112
|
+
*/
|
|
2113
|
+
committerWithMailmap(mailmap: Mailmap): Signature
|
|
1587
2114
|
}
|
|
1588
2115
|
/** An iterator over the `ConfigEntry` values of a config. */
|
|
1589
2116
|
export declare class ConfigEntries {
|
|
@@ -2672,10 +3199,59 @@ export declare class Index {
|
|
|
2672
3199
|
export declare class IndexEntries {
|
|
2673
3200
|
[Symbol.iterator](): Iterator<IndexEntry, void, void>
|
|
2674
3201
|
}
|
|
2675
|
-
/**
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
3202
|
+
/** A wrapper around git2::Mailmap providing Node.js bindings */
|
|
3203
|
+
export declare class Mailmap {
|
|
3204
|
+
/**
|
|
3205
|
+
* Add a new Mailmap entry.
|
|
3206
|
+
*
|
|
3207
|
+
* Maps an author/committer (specified by `replace_name` and `replace_email`)
|
|
3208
|
+
* to the specified real name and email. The `replace_email` is required but
|
|
3209
|
+
* the other parameters can be null.
|
|
3210
|
+
*
|
|
3211
|
+
* If both `replace_name` and `replace_email` are provided, then the entry will
|
|
3212
|
+
* apply to those who match both. If only `replace_name` is provided,
|
|
3213
|
+
* it will apply to anyone with that name, regardless of email. If only
|
|
3214
|
+
* `replace_email` is provided, it will apply to anyone with that email,
|
|
3215
|
+
* regardless of name.
|
|
3216
|
+
*
|
|
3217
|
+
* @param {AddMailmapEntryData} entry - The mailmap entry data.
|
|
3218
|
+
* @returns {void}
|
|
3219
|
+
* @throws An error if the operation failed.
|
|
3220
|
+
*
|
|
3221
|
+
* @category Mailmap/Methods
|
|
3222
|
+
*
|
|
3223
|
+
* @signature
|
|
3224
|
+
* ```ts
|
|
3225
|
+
* class Mailmap {
|
|
3226
|
+
* addEntry(entry: AddMailmapEntryData): void;
|
|
3227
|
+
* }
|
|
3228
|
+
* ```
|
|
3229
|
+
*/
|
|
3230
|
+
addEntry(entry: AddMailmapEntryData): void
|
|
3231
|
+
/**
|
|
3232
|
+
* Resolve a signature to its canonical form using a mailmap.
|
|
3233
|
+
*
|
|
3234
|
+
* Returns a new signature with the canonical name and email.
|
|
3235
|
+
*
|
|
3236
|
+
* @param {SignaturePayload} signature - Signature to resolve
|
|
3237
|
+
* @returns The resolved signature with canonical name and email
|
|
3238
|
+
* @throws An error if the operation failed.
|
|
3239
|
+
*
|
|
3240
|
+
* @category Mailmap/Methods
|
|
3241
|
+
*
|
|
3242
|
+
* @signature
|
|
3243
|
+
* ```ts
|
|
3244
|
+
* class Mailmap {
|
|
3245
|
+
* resolveSignature(signature: SignaturePayload): Signature;
|
|
3246
|
+
* }
|
|
3247
|
+
* ```
|
|
3248
|
+
*/
|
|
3249
|
+
resolveSignature(signature: SignaturePayload): Signature
|
|
3250
|
+
}
|
|
3251
|
+
/**
|
|
3252
|
+
* A class to represent a git [object][1].
|
|
3253
|
+
*
|
|
3254
|
+
* [1]: https://git-scm.com/book/en/Git-Internals-Git-Objects
|
|
2679
3255
|
*/
|
|
2680
3256
|
export declare class GitObject {
|
|
2681
3257
|
/**
|
|
@@ -3213,6 +3789,117 @@ export declare class Remote {
|
|
|
3213
3789
|
* This class corresponds to a git repository in libgit2.
|
|
3214
3790
|
*/
|
|
3215
3791
|
export declare class Repository {
|
|
3792
|
+
/**
|
|
3793
|
+
* Creates a blame object for the file at the given path
|
|
3794
|
+
*
|
|
3795
|
+
* @category Repository/Methods
|
|
3796
|
+
* @signature
|
|
3797
|
+
* ```ts
|
|
3798
|
+
* class Repository {
|
|
3799
|
+
* blameFile(path: string, options?: BlameOptions): Blame;
|
|
3800
|
+
* }
|
|
3801
|
+
* ```
|
|
3802
|
+
*
|
|
3803
|
+
* @example
|
|
3804
|
+
* ```ts
|
|
3805
|
+
* // Blame the entire file
|
|
3806
|
+
* const blame = repo.blameFile('path/to/file.js');
|
|
3807
|
+
*
|
|
3808
|
+
* // Blame a single line
|
|
3809
|
+
* const lineBlame = repo.blameFile('path/to/file.js', { minLine: 10, maxLine: 10 });
|
|
3810
|
+
*
|
|
3811
|
+
* // Blame a range of lines
|
|
3812
|
+
* const rangeBlame = repo.blameFile('path/to/file.js', { minLine: 5, maxLine: 15 });
|
|
3813
|
+
* ```
|
|
3814
|
+
*
|
|
3815
|
+
* @param {string} path - Path to the file to blame
|
|
3816
|
+
* @param {BlameOptions} [options] - Options to control blame behavior
|
|
3817
|
+
* @returns Blame object for the specified file
|
|
3818
|
+
* @throws If the file doesn't exist or can't be opened
|
|
3819
|
+
*/
|
|
3820
|
+
blameFile(path: string, options?: BlameOptions | undefined | null): Blame
|
|
3821
|
+
/**
|
|
3822
|
+
* Create a new branch pointing at a target commit
|
|
3823
|
+
*
|
|
3824
|
+
* A new direct reference will be created pointing to this target commit.
|
|
3825
|
+
*
|
|
3826
|
+
* @category Repository/Methods
|
|
3827
|
+
* @signature
|
|
3828
|
+
* ```ts
|
|
3829
|
+
* class Repository {
|
|
3830
|
+
* createBranch(
|
|
3831
|
+
* branchName: string,
|
|
3832
|
+
* target: Commit,
|
|
3833
|
+
* options?: CreateBranchOptions | null | undefined,
|
|
3834
|
+
* ): Branch;
|
|
3835
|
+
* }
|
|
3836
|
+
* ```
|
|
3837
|
+
*
|
|
3838
|
+
* @param {string} branchName - Name for the new branch.
|
|
3839
|
+
* @param {Commit} target - Target commit which will be pointed by this branch.
|
|
3840
|
+
* @param {CreateBranchOptions} [options] - Options for create branch.
|
|
3841
|
+
* @returns {Branch} Newly created branch.
|
|
3842
|
+
*/
|
|
3843
|
+
createBranch(branchName: string, target: Commit, options?: CreateBranchOptions | undefined | null): Branch
|
|
3844
|
+
/**
|
|
3845
|
+
* Lookup a branch by its name in a repository.
|
|
3846
|
+
*
|
|
3847
|
+
* @category Repository/Methods
|
|
3848
|
+
* @signature
|
|
3849
|
+
* ```ts
|
|
3850
|
+
* class Repository {
|
|
3851
|
+
* findBranch(name: string, branchType: BranchType): Branch | null;
|
|
3852
|
+
* }
|
|
3853
|
+
* ```
|
|
3854
|
+
*
|
|
3855
|
+
* @param {string} name - A branch name.
|
|
3856
|
+
* @param {BranchType} branchType - Branch type to lookup.
|
|
3857
|
+
* @returns A found branch.
|
|
3858
|
+
*/
|
|
3859
|
+
findBranch(name: string, branchType: BranchType): Branch | null
|
|
3860
|
+
/**
|
|
3861
|
+
* Lookup a branch by its name in a repository.
|
|
3862
|
+
*
|
|
3863
|
+
* @category Repository/Methods
|
|
3864
|
+
* @signature
|
|
3865
|
+
* ```ts
|
|
3866
|
+
* class Repository {
|
|
3867
|
+
* getBranch(name: string, branchType: BranchType): Branch;
|
|
3868
|
+
* }
|
|
3869
|
+
* ```
|
|
3870
|
+
*
|
|
3871
|
+
* @param {string} name - A branch name.
|
|
3872
|
+
* @param {BranchType} branchType - Branch type to lookup.
|
|
3873
|
+
* @returns A found branch.
|
|
3874
|
+
* @throws Throws error if branch does not exist.
|
|
3875
|
+
*/
|
|
3876
|
+
getBranch(name: string, branchType: BranchType): Branch
|
|
3877
|
+
/**
|
|
3878
|
+
* Create an iterator which loops over the requested branches.
|
|
3879
|
+
*
|
|
3880
|
+
* @category Repository/Methods
|
|
3881
|
+
* @signature
|
|
3882
|
+
* ```ts
|
|
3883
|
+
* class Repository {
|
|
3884
|
+
* branches(filter?: BranchesFilter | null | undefined): Branches;
|
|
3885
|
+
* }
|
|
3886
|
+
* ```
|
|
3887
|
+
*
|
|
3888
|
+
* @param {BranchesFilter} [filter] - Filter for the branches iterator.
|
|
3889
|
+
* @returns An iterator which loops over the requested branches.
|
|
3890
|
+
* @example
|
|
3891
|
+
* ```ts
|
|
3892
|
+
* import { openRepository } from 'es-git';
|
|
3893
|
+
*
|
|
3894
|
+
* const repo = await openRepository('/path/to/repo');
|
|
3895
|
+
*
|
|
3896
|
+
* for (const branch of repo.branches()) {
|
|
3897
|
+
* console.log(branch.type); // "Local"
|
|
3898
|
+
* console.log(branch.name); // "main"
|
|
3899
|
+
* }
|
|
3900
|
+
* ```
|
|
3901
|
+
*/
|
|
3902
|
+
branches(filter?: BranchesFilter | undefined | null): Branches
|
|
3216
3903
|
/**
|
|
3217
3904
|
* Lookup a reference to one of the commits in a repository.
|
|
3218
3905
|
*
|
|
@@ -3420,6 +4107,84 @@ export declare class Repository {
|
|
|
3420
4107
|
* staged deletes, tracked files, etc.
|
|
3421
4108
|
*/
|
|
3422
4109
|
diffTreeToWorkdirWithIndex(oldTree?: Tree | undefined | null, options?: DiffOptions | undefined | null): Diff
|
|
4110
|
+
/**
|
|
4111
|
+
* Add ignore rules for a repository.
|
|
4112
|
+
*
|
|
4113
|
+
* This adds ignore rules to the repository. The rules will be used
|
|
4114
|
+
* in addition to any existing ignore rules (such as .gitignore files).
|
|
4115
|
+
*
|
|
4116
|
+
* @category Repository/Methods
|
|
4117
|
+
* @signature
|
|
4118
|
+
* ```ts
|
|
4119
|
+
* class Repository {
|
|
4120
|
+
* addIgnoreRule(rules: string): void;
|
|
4121
|
+
* }
|
|
4122
|
+
* ```
|
|
4123
|
+
*
|
|
4124
|
+
* @param {string} rules - Rules to add, separated by newlines.
|
|
4125
|
+
*
|
|
4126
|
+
* @example
|
|
4127
|
+
* ```ts
|
|
4128
|
+
* import { openRepository } from 'es-git';
|
|
4129
|
+
*
|
|
4130
|
+
* const repo = await openRepository('./path/to/repo');
|
|
4131
|
+
* repo.addIgnoreRule("node_modules/");
|
|
4132
|
+
* ```
|
|
4133
|
+
*/
|
|
4134
|
+
addIgnoreRule(rules: string): void
|
|
4135
|
+
/**
|
|
4136
|
+
* Clear ignore rules that were explicitly added.
|
|
4137
|
+
*
|
|
4138
|
+
* Resets to the default internal ignore rules.
|
|
4139
|
+
* This will not turn off rules in .gitignore files that actually exist in the filesystem.
|
|
4140
|
+
* The default internal ignores ignore ".", ".." and ".git" entries.
|
|
4141
|
+
*
|
|
4142
|
+
* @category Repository/Methods
|
|
4143
|
+
* @signature
|
|
4144
|
+
* ```ts
|
|
4145
|
+
* class Repository {
|
|
4146
|
+
* clearIgnoreRules(): void;
|
|
4147
|
+
* }
|
|
4148
|
+
* ```
|
|
4149
|
+
*
|
|
4150
|
+
* @example
|
|
4151
|
+
* ```ts
|
|
4152
|
+
* import { openRepository } from 'es-git';
|
|
4153
|
+
*
|
|
4154
|
+
* const repo = await openRepository('./path/to/repo');
|
|
4155
|
+
* repo.addIgnoreRule("*.log");
|
|
4156
|
+
* // Later, clear all added rules
|
|
4157
|
+
* repo.clearIgnoreRules();
|
|
4158
|
+
* ```
|
|
4159
|
+
*/
|
|
4160
|
+
clearIgnoreRules(): void
|
|
4161
|
+
/**
|
|
4162
|
+
* Test if the ignore rules apply to a given path.
|
|
4163
|
+
*
|
|
4164
|
+
* This function checks the ignore rules to see if they would apply to the given file.
|
|
4165
|
+
* This indicates if the file would be ignored regardless of whether the file is already in the index or committed to the repository.
|
|
4166
|
+
*
|
|
4167
|
+
* @category Repository/Methods
|
|
4168
|
+
* @signature
|
|
4169
|
+
* ```ts
|
|
4170
|
+
* class Repository {
|
|
4171
|
+
* isPathIgnored(path: string): boolean;
|
|
4172
|
+
* }
|
|
4173
|
+
* ```
|
|
4174
|
+
*
|
|
4175
|
+
* @param {string} path - The path to check.
|
|
4176
|
+
* @returns {boolean} - True if the path is ignored, false otherwise.
|
|
4177
|
+
*
|
|
4178
|
+
* @example
|
|
4179
|
+
* ```ts
|
|
4180
|
+
* import { openRepository } from 'es-git';
|
|
4181
|
+
*
|
|
4182
|
+
* const repo = await openRepository('./path/to/repo');
|
|
4183
|
+
* const isIgnored = repo.isPathIgnored("node_modules/some-package");
|
|
4184
|
+
* console.log(`Path is ${isIgnored ? "ignored" : "not ignored"}`);
|
|
4185
|
+
* ```
|
|
4186
|
+
*/
|
|
4187
|
+
isPathIgnored(path: string): boolean
|
|
3423
4188
|
/**
|
|
3424
4189
|
* Get the Index file for this repository.
|
|
3425
4190
|
*
|
|
@@ -3437,6 +4202,21 @@ export declare class Repository {
|
|
|
3437
4202
|
* @returns The index file for this repository.
|
|
3438
4203
|
*/
|
|
3439
4204
|
index(): Index
|
|
4205
|
+
/**
|
|
4206
|
+
* Gets this repository's mailmap.
|
|
4207
|
+
*
|
|
4208
|
+
* @category Repository/Methods
|
|
4209
|
+
*
|
|
4210
|
+
* @signature
|
|
4211
|
+
* ```ts
|
|
4212
|
+
* class Repository {
|
|
4213
|
+
* mailmap(): Mailmap | null;
|
|
4214
|
+
* }
|
|
4215
|
+
* ```
|
|
4216
|
+
*
|
|
4217
|
+
* @returns The mailmap object if it exists, null otherwise
|
|
4218
|
+
*/
|
|
4219
|
+
mailmap(): Mailmap | null
|
|
3440
4220
|
/**
|
|
3441
4221
|
* Lookup a reference to one of the objects in a repository.
|
|
3442
4222
|
*
|
|
@@ -3730,6 +4510,25 @@ export declare class Repository {
|
|
|
3730
4510
|
* @param {string} refname - Specified reference to point into `HEAD`.
|
|
3731
4511
|
*/
|
|
3732
4512
|
setHead(refname: string): void
|
|
4513
|
+
/**
|
|
4514
|
+
* Extract a signature from an object identified by its ID.
|
|
4515
|
+
*
|
|
4516
|
+
* This method can be used for any object that may be signed, such as commits or tags.
|
|
4517
|
+
*
|
|
4518
|
+
* @category Repository/Methods
|
|
4519
|
+
*
|
|
4520
|
+
* @signature
|
|
4521
|
+
* ```ts
|
|
4522
|
+
* class Repository {
|
|
4523
|
+
* extractSignature(oid: string): ExtractedSignature | null;
|
|
4524
|
+
* }
|
|
4525
|
+
* ```
|
|
4526
|
+
*
|
|
4527
|
+
* @param {string} oid - Object ID (SHA1) of the signed object to extract the signature from.
|
|
4528
|
+
* @returns An ExtractedSignature object containing the signature and signed data if the object is signed,
|
|
4529
|
+
* or null if the object is not signed.
|
|
4530
|
+
*/
|
|
4531
|
+
extractSignature(oid: string): ExtractedSignature | null
|
|
3733
4532
|
/**
|
|
3734
4533
|
* Execute a rev-parse operation against the `spec` listed.
|
|
3735
4534
|
*
|
|
@@ -3778,6 +4577,108 @@ export declare class Repository {
|
|
|
3778
4577
|
* @returns Revwalk to traverse the commit graph in this repository.
|
|
3779
4578
|
*/
|
|
3780
4579
|
revwalk(): Revwalk
|
|
4580
|
+
/**
|
|
4581
|
+
* Test if the ignore rules apply to a given file.
|
|
4582
|
+
*
|
|
4583
|
+
* This function checks the ignore rules to see if they would apply to the
|
|
4584
|
+
* given file. This indicates if the file would be ignored regardless of
|
|
4585
|
+
* whether the file is already in the index or committed to the repository.
|
|
4586
|
+
*
|
|
4587
|
+
* One way to think of this is if you were to do "git add ." on the
|
|
4588
|
+
* directory containing the file, would it be added or not?
|
|
4589
|
+
*
|
|
4590
|
+
* @category Repository/Methods
|
|
4591
|
+
* @signature
|
|
4592
|
+
* ```ts
|
|
4593
|
+
* class Repository {
|
|
4594
|
+
* statusShouldIgnore(path: string): boolean;
|
|
4595
|
+
* }
|
|
4596
|
+
* ```
|
|
4597
|
+
*
|
|
4598
|
+
* @param {string} path - A given file path.
|
|
4599
|
+
* @returns Returns `true` if the ignore rules apply to a given file.
|
|
4600
|
+
*/
|
|
4601
|
+
statusShouldIgnore(path: string): boolean
|
|
4602
|
+
/**
|
|
4603
|
+
* Get file status for a single file.
|
|
4604
|
+
*
|
|
4605
|
+
* This tries to get status for the filename that you give. If no files
|
|
4606
|
+
* match that name (in either the HEAD, index, or working directory), this
|
|
4607
|
+
* returns NotFound.
|
|
4608
|
+
*
|
|
4609
|
+
* If the name matches multiple files (for example, if the path names a
|
|
4610
|
+
* directory or if running on a case- insensitive filesystem and yet the
|
|
4611
|
+
* HEAD has two entries that both match the path), then this returns
|
|
4612
|
+
* Ambiguous because it cannot give correct results.
|
|
4613
|
+
*
|
|
4614
|
+
* This does not do any sort of rename detection. Renames require a set of
|
|
4615
|
+
* targets and because of the path filtering, there is not enough
|
|
4616
|
+
* information to check renames correctly. To check file status with rename
|
|
4617
|
+
* detection, there is no choice but to do a full `statuses` and scan
|
|
4618
|
+
* through looking for the path that you are interested in.
|
|
4619
|
+
*
|
|
4620
|
+
* @category Repository/Methods
|
|
4621
|
+
* @signature
|
|
4622
|
+
* ```ts
|
|
4623
|
+
* class Repository {
|
|
4624
|
+
* getStatusFile(path: string): Status;
|
|
4625
|
+
* }
|
|
4626
|
+
* ```
|
|
4627
|
+
*
|
|
4628
|
+
* @param {string} path - A single file path.
|
|
4629
|
+
* @returns The `Status` of this single file.
|
|
4630
|
+
* @throws Throws error if the status file does not exist.
|
|
4631
|
+
*/
|
|
4632
|
+
getStatusFile(path: string): Status
|
|
4633
|
+
/**
|
|
4634
|
+
* Get file status for a single file.
|
|
4635
|
+
*
|
|
4636
|
+
* This tries to get status for the filename that you give. If no files
|
|
4637
|
+
* match that name (in either the HEAD, index, or working directory), this
|
|
4638
|
+
* returns NotFound.
|
|
4639
|
+
*
|
|
4640
|
+
* If the name matches multiple files (for example, if the path names a
|
|
4641
|
+
* directory or if running on a case- insensitive filesystem and yet the
|
|
4642
|
+
* HEAD has two entries that both match the path), then this returns
|
|
4643
|
+
* Ambiguous because it cannot give correct results.
|
|
4644
|
+
*
|
|
4645
|
+
* This does not do any sort of rename detection. Renames require a set of
|
|
4646
|
+
* targets and because of the path filtering, there is not enough
|
|
4647
|
+
* information to check renames correctly. To check file status with rename
|
|
4648
|
+
* detection, there is no choice but to do a full `statuses` and scan
|
|
4649
|
+
* through looking for the path that you are interested in.
|
|
4650
|
+
*
|
|
4651
|
+
* @category Repository/Methods
|
|
4652
|
+
* @signature
|
|
4653
|
+
* ```ts
|
|
4654
|
+
* class Repository {
|
|
4655
|
+
* findStatusFile(path: string): Status | null;
|
|
4656
|
+
* }
|
|
4657
|
+
* ```
|
|
4658
|
+
*
|
|
4659
|
+
* @param {string} path - A single file path.
|
|
4660
|
+
* @returns The `Status` of this single file. If the status file does not exists, returns `null`.
|
|
4661
|
+
*/
|
|
4662
|
+
findStatusFile(path: string): Status | null
|
|
4663
|
+
/**
|
|
4664
|
+
* Gather file status information and populate the returned structure.
|
|
4665
|
+
*
|
|
4666
|
+
* Note that if a pathspec is given in the options to filter the
|
|
4667
|
+
* status, then the results from rename detection (if you enable it) may
|
|
4668
|
+
* not be accurate. To do rename detection properly, this must be called
|
|
4669
|
+
* with no pathspec so that all files can be considered.
|
|
4670
|
+
*
|
|
4671
|
+
* @category Repository/Methods
|
|
4672
|
+
* @signature
|
|
4673
|
+
* ```ts
|
|
4674
|
+
* class Repository {
|
|
4675
|
+
* statuses(): Statuses;
|
|
4676
|
+
* }
|
|
4677
|
+
* ```
|
|
4678
|
+
*
|
|
4679
|
+
* @returns A container for a list of status information about a repository.
|
|
4680
|
+
*/
|
|
4681
|
+
statuses(): Statuses
|
|
3781
4682
|
/**
|
|
3782
4683
|
* Lookup a tag object by prefix hash from the repository.
|
|
3783
4684
|
*
|
|
@@ -4223,6 +5124,123 @@ export declare class Revwalk {
|
|
|
4223
5124
|
*/
|
|
4224
5125
|
hideRef(reference: string): this
|
|
4225
5126
|
}
|
|
5127
|
+
/**
|
|
5128
|
+
* A container for a list of status information about a repository.
|
|
5129
|
+
*
|
|
5130
|
+
* Each instance appears as if it were a collection, having a length and
|
|
5131
|
+
* allowing indexing, as well as providing an iterator.
|
|
5132
|
+
*/
|
|
5133
|
+
export declare class Statuses {
|
|
5134
|
+
/**
|
|
5135
|
+
* Gets a status entry from this list at the specified index.
|
|
5136
|
+
*
|
|
5137
|
+
* @category Status/Statuses
|
|
5138
|
+
* @signature
|
|
5139
|
+
* ```ts
|
|
5140
|
+
* class Statuses {
|
|
5141
|
+
* get(index: number): StatusEntry | null;
|
|
5142
|
+
* }
|
|
5143
|
+
* ```
|
|
5144
|
+
*
|
|
5145
|
+
* @param {number} index - Index of the status entry to get.
|
|
5146
|
+
* @returns A status entry from this list at the specified index. Returns `null` if the status
|
|
5147
|
+
* entry does not exist.
|
|
5148
|
+
*/
|
|
5149
|
+
get(index: number): StatusEntry | null
|
|
5150
|
+
/**
|
|
5151
|
+
* Gets the count of status entries in this list.
|
|
5152
|
+
*
|
|
5153
|
+
* @category Status/Statuses
|
|
5154
|
+
* @signature
|
|
5155
|
+
* ```ts
|
|
5156
|
+
* class Statuses {
|
|
5157
|
+
* len(): number;
|
|
5158
|
+
* }
|
|
5159
|
+
* ```
|
|
5160
|
+
*
|
|
5161
|
+
* @returns If there are no changes in status (according to the options given
|
|
5162
|
+
* when the status list was created), this should return 0.
|
|
5163
|
+
*/
|
|
5164
|
+
len(): bigint
|
|
5165
|
+
/**
|
|
5166
|
+
* @category Status/Statuses
|
|
5167
|
+
* @signature
|
|
5168
|
+
* ```ts
|
|
5169
|
+
* class Statuses {
|
|
5170
|
+
* isEmpty(): boolean;
|
|
5171
|
+
* }
|
|
5172
|
+
* ```
|
|
5173
|
+
*
|
|
5174
|
+
* @returns Return `true` if there is no status entry in this list.
|
|
5175
|
+
*/
|
|
5176
|
+
isEmpty(): boolean
|
|
5177
|
+
/** Returns an iterator over the statuses in this list. */
|
|
5178
|
+
iter(): StatusesIter
|
|
5179
|
+
}
|
|
5180
|
+
export declare class StatusesIter {
|
|
5181
|
+
[Symbol.iterator](): Iterator<StatusEntry, void, void>
|
|
5182
|
+
}
|
|
5183
|
+
/** A structure representing an entry in the `Statuses` structure. */
|
|
5184
|
+
export declare class StatusEntry {
|
|
5185
|
+
/**
|
|
5186
|
+
* Access this entry's path name as a string.
|
|
5187
|
+
*
|
|
5188
|
+
* @category Status/StatusEntry
|
|
5189
|
+
* @signature
|
|
5190
|
+
* ```ts
|
|
5191
|
+
* class StatusEntry {
|
|
5192
|
+
* path(): string;
|
|
5193
|
+
* }
|
|
5194
|
+
* ```
|
|
5195
|
+
*
|
|
5196
|
+
* @returns The path of this entry.
|
|
5197
|
+
*/
|
|
5198
|
+
path(): string
|
|
5199
|
+
/**
|
|
5200
|
+
* Access the status for this file.
|
|
5201
|
+
*
|
|
5202
|
+
* @category Status/StatusEntry
|
|
5203
|
+
* @signature
|
|
5204
|
+
* ```ts
|
|
5205
|
+
* class StatusEntry {
|
|
5206
|
+
* status(): Status;
|
|
5207
|
+
* }
|
|
5208
|
+
* ```
|
|
5209
|
+
*
|
|
5210
|
+
* @returns Status data for this entry.
|
|
5211
|
+
*/
|
|
5212
|
+
status(): Status
|
|
5213
|
+
/**
|
|
5214
|
+
* Access detailed information about the differences between the file in
|
|
5215
|
+
* `HEAD` and the file in the index.
|
|
5216
|
+
*
|
|
5217
|
+
* @category Status/StatusEntry
|
|
5218
|
+
* @signature
|
|
5219
|
+
* ```ts
|
|
5220
|
+
* class StatusEntry {
|
|
5221
|
+
* headToIndex(): DiffDelta | null;
|
|
5222
|
+
* }
|
|
5223
|
+
* ```
|
|
5224
|
+
*
|
|
5225
|
+
* @returns The differences between the file in `HEAD` and the file in the index.
|
|
5226
|
+
*/
|
|
5227
|
+
headToIndex(): DiffDelta | null
|
|
5228
|
+
/**
|
|
5229
|
+
* Access detailed information about the differences between the file in
|
|
5230
|
+
* the index and the file in the working directory.
|
|
5231
|
+
*
|
|
5232
|
+
* @category Status/StatusEntry
|
|
5233
|
+
* @signature
|
|
5234
|
+
* ```ts
|
|
5235
|
+
* class StatusEntry {
|
|
5236
|
+
* indexToWorkdir(): DiffDelta | null;
|
|
5237
|
+
* }
|
|
5238
|
+
* ```
|
|
5239
|
+
*
|
|
5240
|
+
* @returns Differences between the file in the index and the file in the working directory.
|
|
5241
|
+
*/
|
|
5242
|
+
indexToWorkdir(): DiffDelta | null
|
|
5243
|
+
}
|
|
4226
5244
|
/**
|
|
4227
5245
|
* A class to represent a git [tag][1].
|
|
4228
5246
|
*
|
package/index.js
CHANGED
|
@@ -310,9 +310,16 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { Blob, Commit, ConfigLevel, ConfigEntries, Config, openConfig, openDefaultConfig, findGlobalConfigPath, findSystemConfigPath, findXdgConfigPath, parseConfigBool, parseConfigI32, parseConfigI64, DiffFlags, diffFlagsContains, DeltaType, DiffFormat, Diff, DiffStats, Deltas, DiffDelta, FileMode, DiffFile, IndexStage, Index, IndexEntries, ObjectType, GitObject, isValidOid, isZeroOid, zeroOid, hashObjectOid, hashFileOid, ReferenceType, Reference, isValidReferenceName, ReferenceFormat, normalizeReferenceName, Direction, CredentialType, FetchPrune, AutotagOption, RemoteRedirect, Remote, RepositoryState, RepositoryInitMode, Repository, initRepository, openRepository, discoverRepository, cloneRepository, RevparseMode, revparseModeContains, RevwalkSort, Revwalk, createSignature, isValidTagName, Tag, TreeWalkMode, Tree, TreeIter, TreeEntry } = nativeBinding
|
|
313
|
+
const { Blame, BlameHunks, BlameHunksByLine, Blob, isValidBranchName, Branch, Branches, BranchType, Commit, ConfigLevel, ConfigEntries, Config, openConfig, openDefaultConfig, findGlobalConfigPath, findSystemConfigPath, findXdgConfigPath, parseConfigBool, parseConfigI32, parseConfigI64, DiffFlags, diffFlagsContains, DeltaType, DiffFormat, Diff, DiffStats, Deltas, DiffDelta, FileMode, DiffFile, IndexStage, Index, IndexEntries, Mailmap, createMailmapFromBuffer, ObjectType, GitObject, isValidOid, isZeroOid, zeroOid, hashObjectOid, hashFileOid, ReferenceType, Reference, isValidReferenceName, ReferenceFormat, normalizeReferenceName, Direction, CredentialType, FetchPrune, AutotagOption, RemoteRedirect, Remote, RepositoryState, RepositoryInitMode, Repository, initRepository, openRepository, discoverRepository, cloneRepository, RevparseMode, revparseModeContains, RevwalkSort, Revwalk, createSignature, StatusShow, Statuses, StatusesIter, StatusEntry, isValidTagName, Tag, TreeWalkMode, Tree, TreeIter, TreeEntry } = nativeBinding
|
|
314
314
|
|
|
315
|
+
module.exports.Blame = Blame
|
|
316
|
+
module.exports.BlameHunks = BlameHunks
|
|
317
|
+
module.exports.BlameHunksByLine = BlameHunksByLine
|
|
315
318
|
module.exports.Blob = Blob
|
|
319
|
+
module.exports.isValidBranchName = isValidBranchName
|
|
320
|
+
module.exports.Branch = Branch
|
|
321
|
+
module.exports.Branches = Branches
|
|
322
|
+
module.exports.BranchType = BranchType
|
|
316
323
|
module.exports.Commit = Commit
|
|
317
324
|
module.exports.ConfigLevel = ConfigLevel
|
|
318
325
|
module.exports.ConfigEntries = ConfigEntries
|
|
@@ -338,6 +345,8 @@ module.exports.DiffFile = DiffFile
|
|
|
338
345
|
module.exports.IndexStage = IndexStage
|
|
339
346
|
module.exports.Index = Index
|
|
340
347
|
module.exports.IndexEntries = IndexEntries
|
|
348
|
+
module.exports.Mailmap = Mailmap
|
|
349
|
+
module.exports.createMailmapFromBuffer = createMailmapFromBuffer
|
|
341
350
|
module.exports.ObjectType = ObjectType
|
|
342
351
|
module.exports.GitObject = GitObject
|
|
343
352
|
module.exports.isValidOid = isValidOid
|
|
@@ -368,6 +377,10 @@ module.exports.revparseModeContains = revparseModeContains
|
|
|
368
377
|
module.exports.RevwalkSort = RevwalkSort
|
|
369
378
|
module.exports.Revwalk = Revwalk
|
|
370
379
|
module.exports.createSignature = createSignature
|
|
380
|
+
module.exports.StatusShow = StatusShow
|
|
381
|
+
module.exports.Statuses = Statuses
|
|
382
|
+
module.exports.StatusesIter = StatusesIter
|
|
383
|
+
module.exports.StatusEntry = StatusEntry
|
|
371
384
|
module.exports.isValidTagName = isValidTagName
|
|
372
385
|
module.exports.Tag = Tag
|
|
373
386
|
module.exports.TreeWalkMode = TreeWalkMode
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-git",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-next.123+6428cec",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -57,15 +57,15 @@
|
|
|
57
57
|
"vitest": "^3.0.5"
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"es-git-darwin-x64": "0.
|
|
61
|
-
"es-git-darwin-arm64": "0.
|
|
62
|
-
"es-git-win32-x64-msvc": "0.
|
|
63
|
-
"es-git-win32-arm64-msvc": "0.
|
|
64
|
-
"es-git-linux-x64-gnu": "0.
|
|
65
|
-
"es-git-linux-x64-musl": "0.
|
|
66
|
-
"es-git-android-arm64": "0.
|
|
67
|
-
"es-git-linux-arm64-gnu": "0.
|
|
68
|
-
"es-git-linux-arm64-musl": "0.
|
|
69
|
-
"es-git-android-arm-eabi": "0.
|
|
60
|
+
"es-git-darwin-x64": "0.3.0-next.123+6428cec",
|
|
61
|
+
"es-git-darwin-arm64": "0.3.0-next.123+6428cec",
|
|
62
|
+
"es-git-win32-x64-msvc": "0.3.0-next.123+6428cec",
|
|
63
|
+
"es-git-win32-arm64-msvc": "0.3.0-next.123+6428cec",
|
|
64
|
+
"es-git-linux-x64-gnu": "0.3.0-next.123+6428cec",
|
|
65
|
+
"es-git-linux-x64-musl": "0.3.0-next.123+6428cec",
|
|
66
|
+
"es-git-android-arm64": "0.3.0-next.123+6428cec",
|
|
67
|
+
"es-git-linux-arm64-gnu": "0.3.0-next.123+6428cec",
|
|
68
|
+
"es-git-linux-arm64-musl": "0.3.0-next.123+6428cec",
|
|
69
|
+
"es-git-android-arm-eabi": "0.3.0-next.123+6428cec"
|
|
70
70
|
}
|
|
71
71
|
}
|