@gitkraken/core-gitlens 0.61.1 → 0.63.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 +22 -1
- package/dist/git/cache.d.ts +1 -0
- package/dist/git/cache.js +11 -0
- package/dist/git/cache.js.map +1 -1
- package/dist/git/errors.d.ts +15 -0
- package/dist/git/errors.js +9 -1
- package/dist/git/errors.js.map +1 -1
- package/dist/git/models/pullRequest.d.ts +3 -0
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/providers/operations.d.ts +4 -3
- package/dist/git/providers/staging.d.ts +16 -8
- package/dist/git/run.types.d.ts +6 -0
- package/dist/git/service.js +6 -0
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/hiddenRefs.utils.d.ts +15 -0
- package/dist/git/utils/hiddenRefs.utils.js +68 -2
- package/dist/git/utils/hiddenRefs.utils.js.map +1 -1
- package/dist/git/utils/pullRequest.utils.d.ts +3 -6
- package/dist/git/utils/pullRequest.utils.js +6 -7
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/watching/gitIgnoreFilter.d.ts +12 -5
- package/dist/git/watching/gitIgnoreFilter.js +26 -32
- package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
- package/dist/git/watching/provider.d.ts +18 -3
- package/dist/git/watching/watchGroup.d.ts +7 -2
- package/dist/git/watching/watchGroup.js +51 -3
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +16 -2
- package/dist/git/watching/watchService.js +210 -88
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts +1 -1
- package/dist/git/watching/watcherPatterns.js +11 -5
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts +3 -6
- package/dist/git-cli/cliGitProvider.js +144 -38
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/git.js +4 -4
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/indexLock.d.ts +7 -5
- package/dist/git-cli/exec/indexLock.js +19 -15
- package/dist/git-cli/exec/indexLock.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +1 -0
- package/dist/git-cli/providers/config.js +15 -5
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/staging.d.ts +8 -8
- package/dist/git-cli/providers/staging.js +120 -25
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/git-github/api/config.d.ts +5 -0
- package/dist/plus/git-github/api/config.js.map +1 -1
- package/dist/plus/git-github/api/github.js +24 -4
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/models.d.ts +12 -0
- package/dist/plus/git-github/models.js +8 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +5 -0
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/github.js +7 -3
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/reads/etag.d.ts +5 -0
- package/dist/plus/integrations/reads/etag.js +2 -0
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/utils/env/node/exec.d.ts +2 -0
- package/dist/utils/env/node/exec.js +4 -2
- package/dist/utils/env/node/exec.js.map +1 -1
- package/docs/integrations.md +9 -9
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { iterateByDelimiter } from "../utils/string.js";
|
|
|
3
3
|
import { getScopedLogger } from "../utils/logger.scoped.js";
|
|
4
4
|
import { cancellable } from "../utils/promise.js";
|
|
5
5
|
import { Emitter } from "../utils/event.js";
|
|
6
|
+
import { isWindows } from "../utils/platform.js";
|
|
6
7
|
import { fileUri, joinUriPath, parseUri, toFsPath } from "../utils/uri.js";
|
|
7
8
|
import { joinPaths, maybeUri, normalizePath, splitPath, trimTrailingSlashes } from "../utils/path.js";
|
|
8
9
|
import "../git/models/revision.js";
|
|
@@ -44,6 +45,8 @@ import * as path from "node:path";
|
|
|
44
45
|
//#region ../git-cli/src/cliGitProvider.ts
|
|
45
46
|
/** How long reading the folders whose worktrees are ignored may take before it counts as failed (a hung mount) */
|
|
46
47
|
const ignoredWorktreeRootsTimeoutMs = 5e3;
|
|
48
|
+
const maxProtectedWatchPaths = 4096;
|
|
49
|
+
const maxProtectedWatchListingBytes = 1048576;
|
|
47
50
|
const ignoreConfigOverrideRegex = /core\.(?:excludesfile|ignorecase)/i;
|
|
48
51
|
/**
|
|
49
52
|
* A fully-wired CLI-based git provider that executes git commands via `child_process`.
|
|
@@ -78,6 +81,7 @@ var CliGitProvider = class {
|
|
|
78
81
|
_ignoredWorktreeFolders;
|
|
79
82
|
/** By common git dir, the folders whose worktrees are ignored there: a common git dir never moves while it is open */
|
|
80
83
|
_ignoredWorktreeRoots = /* @__PURE__ */ new Map();
|
|
84
|
+
_configWatchPaths = /* @__PURE__ */ new WeakMap();
|
|
81
85
|
_indexRefresher;
|
|
82
86
|
_unregisterListener;
|
|
83
87
|
_resetListener;
|
|
@@ -577,70 +581,117 @@ var CliGitProvider = class {
|
|
|
577
581
|
let filter = this._cache.gitIgnore.get(repoPath);
|
|
578
582
|
if (filter == null) {
|
|
579
583
|
const gitDirPath = this._cache.gitDir.get(repoPath)?.uri.fsPath ?? `${repoPath}/.git`;
|
|
580
|
-
const getIgnoreConfig = async () => {
|
|
581
|
-
await this._cache.ensureRegistered(repoPath);
|
|
582
|
-
return this.config.getIgnoreConfig(repoPath);
|
|
583
|
-
};
|
|
584
584
|
filter = new GitIgnoreFilter({
|
|
585
585
|
repoPath,
|
|
586
586
|
gitDirPath,
|
|
587
587
|
fs: this.context.fs,
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
-
|
|
588
|
+
getConfig: async () => {
|
|
589
|
+
await this._cache.ensureRegistered(repoPath);
|
|
590
|
+
const env = this._git.getRunEnvironment();
|
|
591
|
+
const { excludesFile, ignoreCase } = await this.config.getIgnoreConfig(repoPath);
|
|
592
|
+
return {
|
|
593
|
+
globalExcludesPath: excludesFile == null ? getDefaultGlobalExcludesPath(env) : resolveGitPathConfig(excludesFile, repoPath, env),
|
|
594
|
+
ignoreCase: parseIgnoreCase(ignoreCase)
|
|
595
|
+
};
|
|
592
596
|
},
|
|
593
597
|
getInfoExcludePath: async () => {
|
|
594
598
|
const gitDir = await this.config.getGitDir?.(repoPath);
|
|
595
599
|
if (gitDir == null) return void 0;
|
|
596
600
|
return `${(gitDir.commonUri ?? gitDir.uri).fsPath}/info/exclude`;
|
|
597
601
|
},
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
const { ignoreCase: value } = await getIgnoreConfig();
|
|
601
|
-
if (value == null) return void 0;
|
|
602
|
-
if (parseGitBoolean(value)) return true;
|
|
603
|
-
return isGitBooleanFalse(value) ? false : void 0;
|
|
604
|
-
}
|
|
602
|
+
invalidateConfig: () => this._cache.deleteIgnoreConfig(repoPath),
|
|
603
|
+
getGitIgnorePaths: () => this.getGitIgnorePaths(repoPath)
|
|
605
604
|
});
|
|
606
605
|
this._cache.gitIgnore.set(repoPath, filter);
|
|
607
606
|
}
|
|
608
607
|
return filter;
|
|
609
608
|
}
|
|
609
|
+
async getConfigWatchPaths(repoPath, env) {
|
|
610
|
+
const cached = this._configWatchPaths.get(env);
|
|
611
|
+
if (cached != null) return cached;
|
|
612
|
+
if ([
|
|
613
|
+
env.HOME,
|
|
614
|
+
env.XDG_CONFIG_HOME,
|
|
615
|
+
env.USERPROFILE,
|
|
616
|
+
env.HOMEPATH,
|
|
617
|
+
env.HOMEDRIVE
|
|
618
|
+
].some((value) => value != null && (/[\r\n]/.test(value) || value.split(path.sep).includes("..")))) return;
|
|
619
|
+
const read = async (name, limit) => {
|
|
620
|
+
const result = await this._git.run({
|
|
621
|
+
cwd: repoPath,
|
|
622
|
+
env,
|
|
623
|
+
errors: "ignore",
|
|
624
|
+
expectedExitCodes: [1]
|
|
625
|
+
}, "var", name);
|
|
626
|
+
if (result.completion.status !== "exited" || result.stderr) return void 0;
|
|
627
|
+
if (result.exitCode === 1 && !result.stdout) return (name === "GIT_CONFIG_SYSTEM" ? parseGitBoolean(env.GIT_CONFIG_NOSYSTEM) : env.HOME == null && !env.XDG_CONFIG_HOME) ? [] : void 0;
|
|
628
|
+
const output = isWindows ? result.stdout.replaceAll("\r\n", "\n") : result.stdout;
|
|
629
|
+
if (result.exitCode !== 0 || !output.endsWith("\n") || /[\r\0\ufffd]/.test(output)) return void 0;
|
|
630
|
+
const paths = output.slice(0, -1).split("\n");
|
|
631
|
+
return paths.length <= limit && paths.every((candidate) => path.isAbsolute(candidate)) ? paths : void 0;
|
|
632
|
+
};
|
|
633
|
+
const pending = Promise.all([read("GIT_CONFIG_SYSTEM", 1), read("GIT_CONFIG_GLOBAL", 2)]).then(([system, global]) => system != null && global != null ? [.../* @__PURE__ */ new Set([...system, ...global])] : void 0);
|
|
634
|
+
this._configWatchPaths.set(env, pending);
|
|
635
|
+
let paths;
|
|
636
|
+
try {
|
|
637
|
+
paths = await pending;
|
|
638
|
+
return paths;
|
|
639
|
+
} finally {
|
|
640
|
+
if (paths == null) this._configWatchPaths.delete(env);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
610
643
|
async getGitIgnoreWatchInputs(repoPath, gitDir, options) {
|
|
611
644
|
if (!this._localRepositories) return void 0;
|
|
645
|
+
await this._cache.ensureRegistered(repoPath);
|
|
646
|
+
if (options?.refreshConfig) this._cache.deleteIgnoreConfig(repoPath);
|
|
612
647
|
const gitEnv = this._git.getRunEnvironment();
|
|
613
648
|
if (isGitDirMovedByEnv(gitEnv) || gitEnv.GIT_INDEX_FILE != null || gitEnv.GIT_CONFIG != null || gitEnv.GIT_CONFIG_GLOBAL != null || gitEnv.GIT_CONFIG_SYSTEM != null || ignoreConfigOverrideRegex.test(gitEnv.GIT_CONFIG_PARAMETERS ?? "") || Object.entries(gitEnv).some(([key, value]) => key.startsWith("GIT_CONFIG_KEY_") && ignoreConfigOverrideRegex.test(value ?? ""))) return;
|
|
614
|
-
await this._cache.ensureRegistered(repoPath);
|
|
615
|
-
if (options?.refreshConfig) this._cache.ignoreConfigListing.delete(this._cache.getCommonPath(repoPath));
|
|
616
649
|
const config = await this.config.getIgnoreConfig(repoPath, { observableOnly: true });
|
|
617
650
|
if (config == null) return void 0;
|
|
618
|
-
|
|
651
|
+
const ignoreCase = parseIgnoreCase(config.ignoreCase);
|
|
652
|
+
if (config.ignoreCase != null && ignoreCase == null) return void 0;
|
|
619
653
|
if (config.excludesFile?.startsWith("%(prefix)/") || config.excludesFile?.startsWith("~") && config.excludesFile !== "~" && !config.excludesFile.startsWith("~/")) return;
|
|
620
654
|
const commonGitDirPath = (gitDir.commonUri ?? gitDir.uri).fsPath;
|
|
621
655
|
const excludesFilePath = config.excludesFile == null ? getDefaultGlobalExcludesPath(gitEnv) : resolveGitPathConfig(config.excludesFile, repoPath, gitEnv);
|
|
622
|
-
if (!path.isAbsolute(commonGitDirPath) || excludesFilePath != null && !path.isAbsolute(excludesFilePath)) return;
|
|
623
|
-
const
|
|
656
|
+
if (!path.isAbsolute(commonGitDirPath) || config.excludesFile != null && excludesFilePath == null || excludesFilePath != null && !path.isAbsolute(excludesFilePath)) return;
|
|
657
|
+
const configWatchPaths = await this.getConfigWatchPaths(repoPath, gitEnv);
|
|
658
|
+
if (configWatchPaths == null) return void 0;
|
|
659
|
+
const sharedIndex = await this._git.run({
|
|
624
660
|
cwd: repoPath,
|
|
661
|
+
env: gitEnv,
|
|
625
662
|
errors: "throw"
|
|
663
|
+
}, "rev-parse", "--shared-index-path");
|
|
664
|
+
if (sharedIndex.completion.status !== "exited" || sharedIndex.exitCode !== 0 || sharedIndex.stdout.trim()) return;
|
|
665
|
+
const tracked = await this._git.run({
|
|
666
|
+
cwd: repoPath,
|
|
667
|
+
env: gitEnv,
|
|
668
|
+
errors: "throw",
|
|
669
|
+
maxBuffer: maxProtectedWatchListingBytes
|
|
626
670
|
}, "ls-files", "-z", "--cached", "--ignored", "--exclude-standard", "--stage");
|
|
671
|
+
if (tracked.completion.status !== "exited" || tracked.exitCode !== 0 || tracked.stderr || tracked.stdout.includes("�")) return;
|
|
672
|
+
const protectedPaths = /* @__PURE__ */ new Set();
|
|
627
673
|
const ancestors = /* @__PURE__ */ new Set();
|
|
628
674
|
for (const record of iterateByDelimiter(tracked.stdout, "\0")) {
|
|
629
675
|
if (!record) continue;
|
|
630
676
|
const separator = record.indexOf(" ");
|
|
631
677
|
if (separator === -1) return void 0;
|
|
632
678
|
const entry = record.substring(separator + 1);
|
|
679
|
+
protectedPaths.add(entry);
|
|
633
680
|
if (record.startsWith("160000 ")) ancestors.add(`${entry}/`);
|
|
634
681
|
for (let slash = entry.indexOf("/"); slash !== -1; slash = entry.indexOf("/", slash + 1)) ancestors.add(entry.substring(0, slash + 1));
|
|
682
|
+
if (protectedPaths.size + ancestors.size > maxProtectedWatchPaths) return void 0;
|
|
635
683
|
}
|
|
636
684
|
const protectedDirectories = /* @__PURE__ */ new Set();
|
|
637
685
|
if (ancestors.size !== 0) {
|
|
638
686
|
if (await this.checkIgnore(repoPath, [...ancestors], protectedDirectories, { noIndex: true }) != null) return void 0;
|
|
639
687
|
}
|
|
688
|
+
if (gitEnv !== this._git.getRunEnvironment()) return void 0;
|
|
640
689
|
return {
|
|
641
690
|
infoExcludePath: path.join(commonGitDirPath, "info", "exclude"),
|
|
642
691
|
excludesFilePath: excludesFilePath ?? null,
|
|
643
|
-
ignoreCase:
|
|
692
|
+
ignoreCase: ignoreCase ?? false,
|
|
693
|
+
configWatchPaths,
|
|
694
|
+
protectedPaths: [...protectedPaths].sort(),
|
|
644
695
|
protectedDirectories: Array.from(protectedDirectories, (directory) => directory.slice(0, -1)).sort()
|
|
645
696
|
};
|
|
646
697
|
}
|
|
@@ -760,29 +811,70 @@ var CliGitProvider = class {
|
|
|
760
811
|
return /* @__PURE__ */ new Set();
|
|
761
812
|
}
|
|
762
813
|
}
|
|
763
|
-
/**
|
|
764
|
-
* `check-ignore` dies on the first path it can't answer (inside a submodule, beyond a symlink, outside the repository,
|
|
765
|
-
* or empty), where this repository ignores nothing, having answered every path before it, so the paths after it are
|
|
766
|
-
* asked again, less those in the folder of a path refused for a symlink or submodule, which share its fate. Each path
|
|
767
|
-
* is answered once, in one run plus one for each refusal. Any other failure is thrown.
|
|
768
|
-
*/
|
|
769
814
|
async getIgnoredPaths(repoPath, paths, options, cancellation) {
|
|
770
815
|
const ignored = /* @__PURE__ */ new Set();
|
|
816
|
+
const ambiguous = /* @__PURE__ */ new Set();
|
|
817
|
+
await this.collectIgnoredPaths(repoPath, paths, ignored, options, cancellation, ambiguous);
|
|
818
|
+
if (ambiguous.size) await this.collectIgnoredPaths(repoPath, [...ambiguous], ignored, {
|
|
819
|
+
...options,
|
|
820
|
+
noIndex: true
|
|
821
|
+
}, cancellation);
|
|
822
|
+
if (!ignored.size) return ignored;
|
|
823
|
+
const names = /* @__PURE__ */ new Map();
|
|
824
|
+
for (const match of ignored) names.set(match, path.relative(repoPath, path.resolve(repoPath, match)).split(path.sep).join("/"));
|
|
825
|
+
const untracked = new Set(names.values());
|
|
826
|
+
const untrackedIgnoringCase = new Set(Array.from(untracked, foldGitPathCase));
|
|
827
|
+
const prefix = [
|
|
828
|
+
"ls-files",
|
|
829
|
+
"-z",
|
|
830
|
+
"--cached"
|
|
831
|
+
];
|
|
832
|
+
const runOptions = {
|
|
833
|
+
cwd: repoPath,
|
|
834
|
+
errors: "throw",
|
|
835
|
+
cancellation,
|
|
836
|
+
priority: options?.priority
|
|
837
|
+
};
|
|
838
|
+
for (const batch of batchLiteralPathspecs([...ignored], prefix)) {
|
|
839
|
+
const result = await this._git.run({
|
|
840
|
+
...runOptions,
|
|
841
|
+
env: { GIT_ICASE_PATHSPECS: "1" }
|
|
842
|
+
}, ...prefix, "--", ...batch);
|
|
843
|
+
for (const indexed of iterateByDelimiter(result.stdout, "\0")) for (let name = indexed; name; name = name.substring(0, name.lastIndexOf("/"))) {
|
|
844
|
+
untracked.delete(name);
|
|
845
|
+
untrackedIgnoringCase.delete(foldGitPathCase(name));
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
let ignoreCase;
|
|
849
|
+
for (const [original, name] of names) {
|
|
850
|
+
if (!untracked.has(name)) {
|
|
851
|
+
ignored.delete(original);
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
if (untrackedIgnoringCase.has(foldGitPathCase(name))) continue;
|
|
855
|
+
if (ignoreCase == null) ignoreCase = (await this._git.run({
|
|
856
|
+
...runOptions,
|
|
857
|
+
expectedExitCodes: [1]
|
|
858
|
+
}, "config", "--bool", "--get", "core.ignorecase")).stdout.trim() === "true";
|
|
859
|
+
if (ignoreCase) ignored.delete(original);
|
|
860
|
+
}
|
|
861
|
+
return ignored;
|
|
862
|
+
}
|
|
863
|
+
async collectIgnoredPaths(repoPath, paths, ignored, options, cancellation, ambiguous) {
|
|
771
864
|
let pending = paths;
|
|
772
865
|
while (pending.length) {
|
|
773
|
-
const refused = await this.checkIgnore(repoPath, pending, ignored, options, cancellation);
|
|
866
|
+
const refused = await this.checkIgnore(repoPath, pending, ignored, options, cancellation, ambiguous);
|
|
774
867
|
if (refused == null) break;
|
|
775
868
|
const folder = refused.folderWide ? getRefusedFolder(pending[refused.index]) : void 0;
|
|
776
869
|
pending = pending.slice(refused.index + 1);
|
|
777
870
|
if (folder != null) pending = pending.filter((p) => !p.startsWith(folder) || hasDotSegment(p));
|
|
778
871
|
}
|
|
779
|
-
return ignored;
|
|
780
872
|
}
|
|
781
873
|
/**
|
|
782
874
|
* One `check-ignore` run over `paths`, adding the ignored ones to `ignored`. Returns the path git died on, which
|
|
783
875
|
* every path before it was answered ahead of, or `undefined` when all were answered.
|
|
784
876
|
*/
|
|
785
|
-
async checkIgnore(repoPath, paths, ignored, options, cancellation) {
|
|
877
|
+
async checkIgnore(repoPath, paths, ignored, options, cancellation, ambiguous) {
|
|
786
878
|
const lines = paths.map((p) => p.startsWith(":") ? `./${p}` : p);
|
|
787
879
|
let stdout;
|
|
788
880
|
let refusal;
|
|
@@ -794,7 +886,7 @@ var CliGitProvider = class {
|
|
|
794
886
|
priority: options?.priority,
|
|
795
887
|
stdin: `${lines.join("\0")}\0`,
|
|
796
888
|
expectedExitCodes: [1]
|
|
797
|
-
}, "check-ignore",
|
|
889
|
+
}, "check-ignore", ...options?.noIndex ? ["--no-index"] : [], "-v", "-n", "-z", "--stdin")).stdout;
|
|
798
890
|
} catch (ex) {
|
|
799
891
|
if (!(ex instanceof GitError) || ex.stderr == null || !GitErrors.pathspecRefused.test(ex.stderr)) throw ex;
|
|
800
892
|
refusal = ex;
|
|
@@ -802,12 +894,13 @@ var CliGitProvider = class {
|
|
|
802
894
|
}
|
|
803
895
|
let index = 0;
|
|
804
896
|
let field = 0;
|
|
805
|
-
let
|
|
897
|
+
let pattern = "";
|
|
806
898
|
for (const value of iterateByDelimiter(stdout, "\0")) {
|
|
807
|
-
if (field === 2)
|
|
899
|
+
if (field === 2) pattern = value;
|
|
808
900
|
else if (field === 3) {
|
|
809
|
-
|
|
810
|
-
|
|
901
|
+
const name = paths[index++];
|
|
902
|
+
if (name != null && pattern && !pattern.startsWith("!")) ignored.add(name);
|
|
903
|
+
else if (name != null && !pattern && ambiguous != null && /[*?[\\]/.test(name)) ambiguous.add(name);
|
|
811
904
|
}
|
|
812
905
|
field = (field + 1) % 4;
|
|
813
906
|
}
|
|
@@ -876,15 +969,28 @@ function getSharedRefs(changes, refs) {
|
|
|
876
969
|
* git 2.18, newer than the minimum supported version.
|
|
877
970
|
*/
|
|
878
971
|
function resolveGitPathConfig(value, repoPath, gitEnv) {
|
|
879
|
-
if (value === "~" || value.startsWith("~/"))
|
|
972
|
+
if (value === "~" || value.startsWith("~/")) {
|
|
973
|
+
const home = gitEnv.HOME;
|
|
974
|
+
if (home == null) return void 0;
|
|
975
|
+
if (value === "~") return home || void 0;
|
|
976
|
+
return path.join(home || path.sep, value.substring(2));
|
|
977
|
+
}
|
|
880
978
|
return path.resolve(repoPath, value);
|
|
881
979
|
}
|
|
980
|
+
function parseIgnoreCase(value) {
|
|
981
|
+
if (value == null) return void 0;
|
|
982
|
+
if (parseGitBoolean(value)) return true;
|
|
983
|
+
return isGitBooleanFalse(value) ? false : void 0;
|
|
984
|
+
}
|
|
985
|
+
function foldGitPathCase(name) {
|
|
986
|
+
return name.replace(/[A-Z]/g, (c) => c.toLowerCase());
|
|
987
|
+
}
|
|
882
988
|
/** Where git reads global excludes when `core.excludesFile` is unset: `$XDG_CONFIG_HOME/git/ignore`, else `$HOME/.config/git/ignore` */
|
|
883
989
|
function getDefaultGlobalExcludesPath(gitEnv) {
|
|
884
990
|
const xdgConfigHome = gitEnv.XDG_CONFIG_HOME;
|
|
885
991
|
if (xdgConfigHome) return path.join(xdgConfigHome, "git", "ignore");
|
|
886
|
-
const home = gitEnv.HOME
|
|
887
|
-
return home ? path.join(home, ".config", "git", "ignore")
|
|
992
|
+
const home = gitEnv.HOME ?? (isWindows ? homedir() : void 0);
|
|
993
|
+
return home == null ? void 0 : path.join(home || path.sep, ".config", "git", "ignore");
|
|
888
994
|
}
|
|
889
995
|
/**
|
|
890
996
|
* The folder of a path git refused for a symlink or submodule in its leading folders, where every other path is refused
|