@gitkraken/core-gitlens 0.38.3 → 0.39.0

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/CHANGELOG.md CHANGED
@@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.39.0] - 2026-11-16
10
+
11
+ ### Added
12
+
13
+ - Adds `GitOptions.getQuietNetworkEnvironment`, a host hook for the ssh askpass of the network reads core runs without a person present (`branches.getDefaultBranchName`, `branches.setRemoteHeadIfMissing`, `remotes.probeRemote`). They blanked `SSH_ASKPASS` per call, so behind a `ProxyJump` host that asks for a password or a code the hop's ssh sent an empty answer to each prompt, each a failed sign-in. When the hook returns an environment, core drops its own `SSH_ASKPASS*` defaults for those reads and uses the host's (`{}` means the inherited askpass); the other quiet keys stay. Without it nothing changes (git-cli)
14
+
15
+ ## [0.38.4] - 2026-11-15
16
+
17
+ ### Added
18
+
19
+ - Adds `paths` to `diff.getDiff` and `diff.getParsedDiff`: limits the diff to those repo-relative paths, matched literally and exactly as given (a name with glob characters matches only itself, and a backslash is a file-name character rather than a separator), batched to fit the command line, with each batch's output joined in order. A host that already holds exact names, such as the ones `diff.getDiffStatus` returns, can now read the hunks of a file whose name holds a backslash on Linux or macOS, where `uris` rewrote it to a different path and found nothing. An empty list resolves `undefined` without running git, `paths` wins over `uris`, and a rename whose two sides fall in different batches reads as a delete and an add (git, git-cli)
20
+ - Adds `literalPath` to the options of `revision.getRevisionContent`: reads `path` as a repo-relative path exactly as given, with no splitting or separator rewriting, so a host can read the bytes of a file whose name holds a backslash on Linux or macOS, at a commit or from the index. Without it a `\` is still read as a separator (git, git-cli, git-github)
21
+
9
22
  ## [0.38.3] - 2026-11-15
10
23
 
11
24
  ### Fixed
@@ -1320,7 +1333,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1320
1333
 
1321
1334
  - Initial release. Bundles `@gitlens/utils`, `@gitlens/git`, `@gitlens/git-cli`, `@gitlens/ai`, and `@gitlens/git-github` into a single core npm package with subpath exports.
1322
1335
 
1323
- [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.3...HEAD
1336
+ [unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.39.0...HEAD
1337
+ [0.39.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.4...gitkraken:releases/core/v0.39.0
1338
+ [0.38.4]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.3...gitkraken:releases/core/v0.38.4
1324
1339
  [0.38.3]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.2...gitkraken:releases/core/v0.38.3
1325
1340
  [0.38.2]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.1...gitkraken:releases/core/v0.38.2
1326
1341
  [0.38.1]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.0...gitkraken:releases/core/v0.38.1
@@ -36,6 +36,14 @@ export interface GitDiffSubProvider {
36
36
  renames?: boolean;
37
37
  similarityThreshold?: number;
38
38
  uris?: (string | Uri)[];
39
+ /**
40
+ * Limits the diff to these repo-relative paths, matched literally and exactly as given (a name with glob
41
+ * characters matches only itself, a backslash is a file-name character rather than a separator, and a
42
+ * folder is everything under it). Wins over `uris`; an empty list resolves `undefined` without running
43
+ * git. Batched to fit the command line, so a rename whose two sides fall in different batches reads as a
44
+ * delete and an add
45
+ */
46
+ paths?: string[];
39
47
  /**
40
48
  * `'throw'` rejects with the failure (a `GitError` carrying git's `stderr` when git ran) rather than
41
49
  * resolving `undefined`, which is the default for every failure
@@ -56,6 +64,8 @@ export interface GitDiffSubProvider {
56
64
  renames?: boolean;
57
65
  similarityThreshold?: number;
58
66
  uris?: (string | Uri)[];
67
+ /** As on `getDiff` */
68
+ paths?: string[];
59
69
  errors?: GitErrorHandling;
60
70
  }, cancellation?: AbortSignal): Promise<ParsedGitDiff | undefined>;
61
71
  getDiffFiles?(repoPath: string, contents: string, cancellation?: AbortSignal): Promise<GitDiffFiles | undefined>;
@@ -24,7 +24,14 @@ export interface GitRevisionSubProvider {
24
24
  getBlobIds?(repoPath: string, paths: readonly string[], source: 'index' | 'working', cancellation?: AbortSignal): Promise<Map<string, string>>;
25
25
  /** The empty tree's id in this repository's object format (SHA-1 or SHA-256). */
26
26
  getEmptyTreeSha(repoPath: string): Promise<string>;
27
- getRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined>;
27
+ /**
28
+ * The bytes of `path` at `rev`. `path` is an absolute path, a URI or a repo-relative path, with `\` taken as a
29
+ * separator (what a Windows path holds), unless `literalPath` is set: then it is a repo-relative path exactly
30
+ * as given, so a file name holding a backslash on Linux or macOS is read as itself
31
+ */
32
+ getRevisionContent(repoPath: string, path: string, rev: string, options?: {
33
+ literalPath?: boolean;
34
+ }): Promise<Uint8Array | undefined>;
28
35
  getSubmoduleHead?(repoPath: string, submodulePath: string): Promise<string | undefined>;
29
36
  /**
30
37
  * Gets tracked file paths from the index (reflects working tree state, even during rebase).
@@ -196,6 +196,19 @@ export interface GitOptions {
196
196
  env?: Record<string, string | undefined>;
197
197
  /** Dynamic environment provider called for each command (e.g., host-discovered SCM credentials) */
198
198
  getEnvironment?: () => Record<string, string | undefined> | undefined;
199
+ /**
200
+ * The environment for network commands core runs without a person present (a default-branch lookup,
201
+ * a remote probe, a background `remote set-head`), which is how a host supplies an askpass that ends the asking
202
+ * ssh without answering, so a jump host isn't sent empty answers. When it returns an environment, the host owns
203
+ * the ssh askpass of those commands: core drops its own `SSH_ASKPASS*` defaults (an empty `SSH_ASKPASS`, plus
204
+ * `SSH_ASKPASS_REQUIRE=never` on the default-branch reads), so an `SSH_ASKPASS*` key the host leaves out comes
205
+ * from the inherited environment and `{}` means "use the inherited askpass".
206
+ * A key set to `undefined` leaves that variable unset; a key core doesn't set (`DISPLAY`, a helper's own
207
+ * variables) is added. `GIT_TERMINAL_PROMPT=0`, `GIT_ASKPASS=''` and `GCM_INTERACTIVE` keep core's values
208
+ * whatever it returns, as does `credential.interactive=false` on the default-branch reads (the probe sets none).
209
+ * Called per command; return the same object while nothing changes. Without it, core's defaults apply unchanged.
210
+ */
211
+ getQuietNetworkEnvironment?: () => Record<string, string | undefined> | undefined;
199
212
  /** Git command timeout in milliseconds, for runs that don't set their own. Defaults to {@link defaultGitTimeout}. Set to 0 to disable. */
200
213
  gitTimeout?: number;
201
214
  /**
@@ -300,6 +313,8 @@ export declare class Git {
300
313
  private _fullEnv;
301
314
  /** Last dynamic env reference, used to detect when getEnvironment() returns a new object */
302
315
  private _lastDynamicEnv;
316
+ /** Merged quiet-network environments, by the defaults they extend, rebuilt only when the host returns a new reference */
317
+ private readonly _quietNetworkEnvs;
303
318
  /** Bound via {@link bindChangeNotifier}; announces a `notify`-flagged run's changes. No-op until bound. */
304
319
  private _changeNotifier;
305
320
  /** Bound via {@link bindHeadReader}; reads HEAD around a `notify: 'infer'` run that moves only HEAD's branch */
@@ -348,6 +363,12 @@ export declare class Git {
348
363
  * when getEnvironment() returns a different object reference.
349
364
  */
350
365
  private getFullEnv;
366
+ /**
367
+ * Returns `defaults` with its `SSH_ASKPASS*` keys replaced by the host's quiet-network environment. Every other
368
+ * default key is pinned. Returns `defaults` itself without a host environment, and the same merged object while
369
+ * the host returns the same reference.
370
+ */
371
+ quietNetworkEnv(defaults: Record<string, string>): Record<string, string | undefined>;
351
372
  /** The environment git runs with, before a run's own `env` */
352
373
  getRunEnvironment(): Readonly<Record<string, string | undefined>>;
353
374
  /**
@@ -523,6 +523,8 @@ var Git = class {
523
523
  _fullEnv;
524
524
  /** Last dynamic env reference, used to detect when getEnvironment() returns a new object */
525
525
  _lastDynamicEnv;
526
+ /** Merged quiet-network environments, by the defaults they extend, rebuilt only when the host returns a new reference */
527
+ _quietNetworkEnvs = /* @__PURE__ */ new WeakMap();
526
528
  /** Bound via {@link bindChangeNotifier}; announces a `notify`-flagged run's changes. No-op until bound. */
527
529
  _changeNotifier;
528
530
  /** Bound via {@link bindHeadReader}; reads HEAD around a `notify: 'infer'` run that moves only HEAD's branch */
@@ -598,6 +600,25 @@ var Git = class {
598
600
  } : this.getBaseEnv();
599
601
  return this._fullEnv;
600
602
  }
603
+ /**
604
+ * Returns `defaults` with its `SSH_ASKPASS*` keys replaced by the host's quiet-network environment. Every other
605
+ * default key is pinned. Returns `defaults` itself without a host environment, and the same merged object while
606
+ * the host returns the same reference.
607
+ */
608
+ quietNetworkEnv(defaults) {
609
+ const hostEnv = this.options.getQuietNetworkEnvironment?.() ?? void 0;
610
+ if (hostEnv == null) return defaults;
611
+ let cached = this._quietNetworkEnvs.get(defaults);
612
+ if (cached?.hostEnv === hostEnv) return cached.merged;
613
+ const merged = { ...hostEnv };
614
+ for (const [key, value] of Object.entries(defaults)) if (!key.startsWith("SSH_ASKPASS")) merged[key] = value;
615
+ cached = {
616
+ hostEnv,
617
+ merged
618
+ };
619
+ this._quietNetworkEnvs.set(defaults, cached);
620
+ return merged;
621
+ }
601
622
  /** The environment git runs with, before a run's own `env` */
602
623
  getRunEnvironment() {
603
624
  return this.getFullEnv();