@openvcs/git-plugin 0.2.0-nightly.20260505.53 → 0.2.0-nightly.20260508.58
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/ARCHITECTURE.md +8 -0
- package/bin/git.js +7 -2
- package/bin/plugin-helpers.js +10 -5
- package/package.json +3 -3
- package/src/git.ts +7 -2
- package/src/plugin-helpers.ts +11 -7
package/ARCHITECTURE.md
CHANGED
|
@@ -29,6 +29,14 @@ through `@openvcs/sdk/runtime` delegates and exposes a single VCS backend id:
|
|
|
29
29
|
- For rename and copy records, the porcelain format includes two NUL-terminated
|
|
30
30
|
paths: the original/source path first, then the new/destination path. The
|
|
31
31
|
plugin assigns `path` to the new path and `old_path` to the original path.
|
|
32
|
+
- Unmerged porcelain states such as `UU`, `AA`, and `DD` are normalized to `U`
|
|
33
|
+
in status payloads so the client opens merge-conflict UI instead of a normal
|
|
34
|
+
diff view.
|
|
35
|
+
- File diffs first read worktree changes and fall back to `git diff --cached`
|
|
36
|
+
for staged-only files so selected staged changes still render textual hunks.
|
|
37
|
+
- Commit history uses the current `HEAD` or requested revision instead of
|
|
38
|
+
`git log --all`, so internal refs such as `refs/stash` are not shown as normal
|
|
39
|
+
history entries.
|
|
32
40
|
- Network commands (`fetch`, `push`, `pull`) omit optional arguments (remote,
|
|
33
41
|
refspec, branch) when not provided, allowing Git to use its defaults instead
|
|
34
42
|
of receiving empty string arguments.
|
package/bin/git.js
CHANGED
|
@@ -205,7 +205,7 @@ export class GitCommand {
|
|
|
205
205
|
* history without hard-capping the result set.
|
|
206
206
|
*/
|
|
207
207
|
listCommits(options = {}) {
|
|
208
|
-
const args = ['log'
|
|
208
|
+
const args = ['log'];
|
|
209
209
|
if (options.topo_order) {
|
|
210
210
|
args.push('--topo-order');
|
|
211
211
|
}
|
|
@@ -356,7 +356,12 @@ export class GitCommand {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
diffFile(path) {
|
|
359
|
-
|
|
359
|
+
const worktreeDiff = this.runChecked(['diff', '--no-ext-diff', '--', path], 'git-diff-failed')
|
|
360
|
+
.stdout;
|
|
361
|
+
if (worktreeDiff.trim().length > 0)
|
|
362
|
+
return worktreeDiff;
|
|
363
|
+
return this.runChecked(['diff', '--cached', '--no-ext-diff', '--', path], 'git-diff-failed')
|
|
364
|
+
.stdout;
|
|
360
365
|
}
|
|
361
366
|
diffCommit(commit) {
|
|
362
367
|
return this.runChecked(['diff', `${commit}^`, commit], 'git-diff-failed').stdout;
|
package/bin/plugin-helpers.js
CHANGED
|
@@ -83,6 +83,7 @@ export function parseStatusOutput(output) {
|
|
|
83
83
|
const records = output.split('\0').filter(Boolean);
|
|
84
84
|
let ahead = 0;
|
|
85
85
|
let behind = 0;
|
|
86
|
+
let branchOnRemote = false;
|
|
86
87
|
const files = [];
|
|
87
88
|
const summary = {
|
|
88
89
|
untracked: 0,
|
|
@@ -97,6 +98,8 @@ export function parseStatusOutput(output) {
|
|
|
97
98
|
const behindMatch = record.match(/behind\s+(\d+)/);
|
|
98
99
|
ahead = aheadMatch ? Number(aheadMatch[1]) : 0;
|
|
99
100
|
behind = behindMatch ? Number(behindMatch[1]) : 0;
|
|
101
|
+
const trackingMatch = record.match(/^## [^ ]+\.\.\.\S+/);
|
|
102
|
+
branchOnRemote = !!trackingMatch;
|
|
100
103
|
continue;
|
|
101
104
|
}
|
|
102
105
|
if (record.length < 4) {
|
|
@@ -113,14 +116,15 @@ export function parseStatusOutput(output) {
|
|
|
113
116
|
oldPath = payloadPath;
|
|
114
117
|
index += 1;
|
|
115
118
|
}
|
|
119
|
+
const conflicted = x === 'U' ||
|
|
120
|
+
y === 'U' ||
|
|
121
|
+
(x === 'A' && y === 'A') ||
|
|
122
|
+
(x === 'D' && y === 'D');
|
|
116
123
|
const staged = x !== ' ' && x !== '?';
|
|
117
124
|
if (x === '?' || y === '?') {
|
|
118
125
|
summary.untracked += 1;
|
|
119
126
|
}
|
|
120
|
-
else if (
|
|
121
|
-
y === 'U' ||
|
|
122
|
-
(x === 'A' && y === 'A') ||
|
|
123
|
-
(x === 'D' && y === 'D')) {
|
|
127
|
+
else if (conflicted) {
|
|
124
128
|
summary.conflicted += 1;
|
|
125
129
|
}
|
|
126
130
|
else {
|
|
@@ -134,7 +138,7 @@ export function parseStatusOutput(output) {
|
|
|
134
138
|
files.push({
|
|
135
139
|
path,
|
|
136
140
|
old_path: oldPath,
|
|
137
|
-
status: `${x}${y}`.trim() || 'M',
|
|
141
|
+
status: conflicted ? 'U' : `${x}${y}`.trim() || 'M',
|
|
138
142
|
staged,
|
|
139
143
|
resolved_conflict: false,
|
|
140
144
|
hunks: [],
|
|
@@ -146,6 +150,7 @@ export function parseStatusOutput(output) {
|
|
|
146
150
|
files,
|
|
147
151
|
ahead,
|
|
148
152
|
behind,
|
|
153
|
+
branch_on_remote: branchOnRemote,
|
|
149
154
|
},
|
|
150
155
|
};
|
|
151
156
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openvcs/git-plugin",
|
|
3
|
-
"version": "0.2.0-nightly.
|
|
3
|
+
"version": "0.2.0-nightly.20260508.58",
|
|
4
4
|
"description": "OpenVCS Git plugin - Node.js runtime",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"homepage": "https://github.com/Open-VCS/OpenVCS-Plugin-Git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"openvcs": {
|
|
19
19
|
"id": "openvcs.git",
|
|
20
20
|
"name": "Git",
|
|
21
|
-
"version": "0.2.0-nightly.
|
|
21
|
+
"version": "0.2.0-nightly.20260508.58",
|
|
22
22
|
"author": "OpenVCS Contributors",
|
|
23
23
|
"description": "Git VCS backend plugin for OpenVCS",
|
|
24
24
|
"default_enabled": true,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"build": "node ./node_modules/@openvcs/sdk/bin/openvcs.js build"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@openvcs/sdk": "edge"
|
|
49
|
+
"@openvcs/sdk": "^0.3.0-edge.20260506.51"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^25.5.0",
|
package/src/git.ts
CHANGED
|
@@ -324,7 +324,7 @@ export class GitCommand {
|
|
|
324
324
|
* history without hard-capping the result set.
|
|
325
325
|
*/
|
|
326
326
|
listCommits(options: ListCommitsOptions = {}): { commits: CommitEntry[]; exitCode: number } {
|
|
327
|
-
const args = ['log'
|
|
327
|
+
const args = ['log'];
|
|
328
328
|
|
|
329
329
|
if (options.topo_order) {
|
|
330
330
|
args.push('--topo-order');
|
|
@@ -502,7 +502,12 @@ export class GitCommand {
|
|
|
502
502
|
}
|
|
503
503
|
|
|
504
504
|
diffFile(path: string): string {
|
|
505
|
-
|
|
505
|
+
const worktreeDiff = this.runChecked(['diff', '--no-ext-diff', '--', path], 'git-diff-failed')
|
|
506
|
+
.stdout;
|
|
507
|
+
if (worktreeDiff.trim().length > 0) return worktreeDiff;
|
|
508
|
+
|
|
509
|
+
return this.runChecked(['diff', '--cached', '--no-ext-diff', '--', path], 'git-diff-failed')
|
|
510
|
+
.stdout;
|
|
506
511
|
}
|
|
507
512
|
|
|
508
513
|
diffCommit(commit: string): string {
|
package/src/plugin-helpers.ts
CHANGED
|
@@ -111,6 +111,7 @@ export function parseStatusOutput(output: string): StatusParseResult {
|
|
|
111
111
|
const records = output.split('\0').filter(Boolean);
|
|
112
112
|
let ahead = 0;
|
|
113
113
|
let behind = 0;
|
|
114
|
+
let branchOnRemote = false;
|
|
114
115
|
const files: StatusFileEntry[] = [];
|
|
115
116
|
const summary: StatusSummary = {
|
|
116
117
|
untracked: 0,
|
|
@@ -127,6 +128,8 @@ export function parseStatusOutput(output: string): StatusParseResult {
|
|
|
127
128
|
const behindMatch = record.match(/behind\s+(\d+)/);
|
|
128
129
|
ahead = aheadMatch ? Number(aheadMatch[1]) : 0;
|
|
129
130
|
behind = behindMatch ? Number(behindMatch[1]) : 0;
|
|
131
|
+
const trackingMatch = record.match(/^## [^ ]+\.\.\.\S+/);
|
|
132
|
+
branchOnRemote = !!trackingMatch;
|
|
130
133
|
continue;
|
|
131
134
|
}
|
|
132
135
|
|
|
@@ -147,16 +150,16 @@ export function parseStatusOutput(output: string): StatusParseResult {
|
|
|
147
150
|
index += 1;
|
|
148
151
|
}
|
|
149
152
|
|
|
153
|
+
const conflicted =
|
|
154
|
+
x === 'U' ||
|
|
155
|
+
y === 'U' ||
|
|
156
|
+
(x === 'A' && y === 'A') ||
|
|
157
|
+
(x === 'D' && y === 'D');
|
|
150
158
|
const staged = x !== ' ' && x !== '?';
|
|
151
159
|
|
|
152
160
|
if (x === '?' || y === '?') {
|
|
153
161
|
summary.untracked += 1;
|
|
154
|
-
} else if (
|
|
155
|
-
x === 'U' ||
|
|
156
|
-
y === 'U' ||
|
|
157
|
-
(x === 'A' && y === 'A') ||
|
|
158
|
-
(x === 'D' && y === 'D')
|
|
159
|
-
) {
|
|
162
|
+
} else if (conflicted) {
|
|
160
163
|
summary.conflicted += 1;
|
|
161
164
|
} else {
|
|
162
165
|
if (staged) {
|
|
@@ -171,7 +174,7 @@ export function parseStatusOutput(output: string): StatusParseResult {
|
|
|
171
174
|
files.push({
|
|
172
175
|
path,
|
|
173
176
|
old_path: oldPath,
|
|
174
|
-
status: `${x}${y}`.trim() || 'M',
|
|
177
|
+
status: conflicted ? 'U' : `${x}${y}`.trim() || 'M',
|
|
175
178
|
staged,
|
|
176
179
|
resolved_conflict: false,
|
|
177
180
|
hunks: [],
|
|
@@ -184,6 +187,7 @@ export function parseStatusOutput(output: string): StatusParseResult {
|
|
|
184
187
|
files,
|
|
185
188
|
ahead,
|
|
186
189
|
behind,
|
|
190
|
+
branch_on_remote: branchOnRemote,
|
|
187
191
|
},
|
|
188
192
|
};
|
|
189
193
|
}
|