@openvcs/git-plugin 0.2.0-edge.20260507.57 → 0.2.0-edge.20260510.62

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.
@@ -7,6 +7,11 @@ import { GitCommand } from './git.js';
7
7
  function asOptionalBoolean(value) {
8
8
  return typeof value === 'boolean' ? value : undefined;
9
9
  }
10
+ /** Splits Git diff stdout into lines without manufacturing a blank entry for empty output. */
11
+ function splitDiffLines(output) {
12
+ const normalized = output.trimEnd();
13
+ return normalized.length > 0 ? normalized.split('\n') : [];
14
+ }
10
15
  /** Reduces a file status string to the primary status code needed for discard routing. */
11
16
  function getPrimaryDiscardStatus(status) {
12
17
  const normalized = asTrimmedString(status);
@@ -159,7 +164,15 @@ export class GitVcsDelegates extends VcsDelegateBase {
159
164
  }
160
165
  createBranch(params, _context) {
161
166
  const git = this.requireGit(params.session_id);
162
- git.createBranch(asTrimmedString(params.name));
167
+ const name = asTrimmedString(params.name);
168
+ const checkout = params.checkout === true;
169
+ if (checkout) {
170
+ git.createBranch(name);
171
+ git.checkoutBranch(name);
172
+ }
173
+ else {
174
+ git.createBranch(name);
175
+ }
163
176
  return null;
164
177
  }
165
178
  checkoutBranch(params, _context) {
@@ -252,11 +265,11 @@ export class GitVcsDelegates extends VcsDelegateBase {
252
265
  }
253
266
  diffFile(params, _context) {
254
267
  const git = this.requireGit(params.session_id);
255
- return git.diffFile(asTrimmedString(params.path)).split('\n');
268
+ return splitDiffLines(git.diffFile(asTrimmedString(params.path)));
256
269
  }
257
270
  diffCommit(params, _context) {
258
271
  const git = this.requireGit(params.session_id);
259
- return git.diffCommit(asTrimmedString(params.rev)).split('\n');
272
+ return splitDiffLines(git.diffCommit(asTrimmedString(params.rev)));
260
273
  }
261
274
  getConflictDetails(params, _context) {
262
275
  const git = this.requireGit(params.session_id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openvcs/git-plugin",
3
- "version": "0.2.0-edge.20260507.57",
3
+ "version": "0.2.0-edge.20260510.62",
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-edge.20260507.57",
21
+ "version": "0.2.0-edge.20260510.62",
22
22
  "author": "OpenVCS Contributors",
23
23
  "description": "Git VCS backend plugin for OpenVCS",
24
24
  "default_enabled": true,
@@ -35,6 +35,12 @@ function asOptionalBoolean(value: unknown): boolean | undefined {
35
35
  return typeof value === 'boolean' ? value : undefined;
36
36
  }
37
37
 
38
+ /** Splits Git diff stdout into lines without manufacturing a blank entry for empty output. */
39
+ function splitDiffLines(output: string): string[] {
40
+ const normalized = output.trimEnd();
41
+ return normalized.length > 0 ? normalized.split('\n') : [];
42
+ }
43
+
38
44
  /** Reduces a file status string to the primary status code needed for discard routing. */
39
45
  function getPrimaryDiscardStatus(status: string): string {
40
46
  const normalized = asTrimmedString(status);
@@ -261,7 +267,15 @@ export class GitVcsDelegates extends VcsDelegateBase<GitRuntimeDependencies> {
261
267
  _context: PluginRuntimeContext,
262
268
  ): null {
263
269
  const git = this.requireGit(params.session_id);
264
- git.createBranch(asTrimmedString(params.name));
270
+ const name = asTrimmedString(params.name);
271
+ const checkout = params.checkout === true;
272
+
273
+ if (checkout) {
274
+ git.createBranch(name);
275
+ git.checkoutBranch(name);
276
+ } else {
277
+ git.createBranch(name);
278
+ }
265
279
  return null;
266
280
  }
267
281
 
@@ -416,7 +430,7 @@ export class GitVcsDelegates extends VcsDelegateBase<GitRuntimeDependencies> {
416
430
  _context: PluginRuntimeContext,
417
431
  ): string[] {
418
432
  const git = this.requireGit(params.session_id);
419
- return git.diffFile(asTrimmedString(params.path)).split('\n');
433
+ return splitDiffLines(git.diffFile(asTrimmedString(params.path)));
420
434
  }
421
435
 
422
436
  override diffCommit(
@@ -424,7 +438,7 @@ export class GitVcsDelegates extends VcsDelegateBase<GitRuntimeDependencies> {
424
438
  _context: PluginRuntimeContext,
425
439
  ): string[] {
426
440
  const git = this.requireGit(params.session_id);
427
- return git.diffCommit(asTrimmedString(params.rev)).split('\n');
441
+ return splitDiffLines(git.diffCommit(asTrimmedString(params.rev)));
428
442
  }
429
443
 
430
444
  override getConflictDetails(