git-dedup 0.1.0 → 2.0.1
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/README.md +29 -32
- package/dist/commands/store/$default.d.ts +1 -1
- package/dist/commands/store/$default.d.ts.map +1 -1
- package/dist/commands/store/$default.js +14 -3
- package/dist/commands/store/$default.js.map +1 -1
- package/dist/commands/{cache.d.ts → store/add.d.ts} +3 -3
- package/dist/commands/store/add.d.ts.map +1 -0
- package/dist/commands/{cache.js → store/add.js} +19 -19
- package/dist/commands/store/add.js.map +1 -0
- package/dist/commands/store/fetch.d.ts.map +1 -1
- package/dist/commands/store/fetch.js +6 -1
- package/dist/commands/store/fetch.js.map +1 -1
- package/dist/commands/store/prune.d.ts +4 -0
- package/dist/commands/store/prune.d.ts.map +1 -0
- package/dist/commands/store/prune.js +9 -0
- package/dist/commands/store/prune.js.map +1 -0
- package/dist/commands/store/remove.d.ts +16 -0
- package/dist/commands/store/remove.d.ts.map +1 -0
- package/dist/commands/store/remove.js +48 -0
- package/dist/commands/store/remove.js.map +1 -0
- package/dist/context.d.ts +6 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/discover.d.ts +3 -3
- package/dist/discover.d.ts.map +1 -1
- package/dist/discover.js +44 -25
- package/dist/discover.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/stats.d.ts.map +1 -1
- package/dist/stats.js +4 -15
- package/dist/stats.js.map +1 -1
- package/package.json +8 -3
- package/dist/commands/cache.d.ts.map +0 -1
- package/dist/commands/cache.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -4
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -12
- package/dist/commands/doctor.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,29 +3,26 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/git-dedup)
|
|
4
4
|
[](https://www.npmjs.com/package/git-dedup)
|
|
5
5
|
[](https://github.com/bhouston/git-dedup/actions/workflows/ci.yml)
|
|
6
|
+
[](https://codecov.io/gh/bhouston/git-dedup)
|
|
6
7
|
[](https://github.com/bhouston/git-dedup/blob/main/LICENSE)
|
|
7
|
-
[](https://git-dedup.ben3d.ca/)
|
|
8
9
|
[](https://discord.gg/5J5Ur3F6Z2)
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
**Faster checkouts, a fraction of the disk space.**
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
git-dedup is a drop-in replacement for `git clone` built for fleets of coding agents. It automatically keeps one shared copy of Git history, so every new clone, worktree, and submodule reuses what is already on disk instead of downloading it again. Large checkouts are 6x faster, and Git data takes 70% less disk.
|
|
13
14
|
|
|
14
15
|
```sh
|
|
15
|
-
|
|
16
|
-
git-dedup clone https://github.com/you/project.git project
|
|
16
|
+
npm install --global git-dedup
|
|
17
17
|
|
|
18
|
-
#
|
|
19
|
-
git-dedup clone https://github.com/you/project.git
|
|
20
|
-
cd project-review
|
|
18
|
+
# check out a new repo automatically using the dedup store
|
|
19
|
+
git-dedup clone https://github.com/you/project.git
|
|
21
20
|
|
|
22
|
-
#
|
|
23
|
-
git
|
|
24
|
-
git diff
|
|
25
|
-
git log --oneline
|
|
21
|
+
# dedup an existing repo into the store
|
|
22
|
+
git-dedup store add ./my-existing-repo
|
|
26
23
|
```
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
That's it. git-dedup automatically consolidates the new or existing project's history into a shared store in `~/.git-dedup` or if its history already existed there, it reuses it automatically.
|
|
29
26
|
|
|
30
27
|
**[Documentation](https://git-dedup.ben3d.ca/) · [Source](https://github.com/bhouston/git-dedup) · [Agent setup](https://git-dedup.ben3d.ca/docs/agents)**
|
|
31
28
|
|
|
@@ -38,8 +35,6 @@ npm install --global git-dedup
|
|
|
38
35
|
git-dedup --help
|
|
39
36
|
```
|
|
40
37
|
|
|
41
|
-
If you previously installed `@bhouston/gitx`, install `git-dedup` and update scripts or editor settings that call `gitx`. Existing gitx stores and linked checkouts continue to work; the new CLI reuses an existing store automatically.
|
|
42
|
-
|
|
43
38
|
## Usage
|
|
44
39
|
|
|
45
40
|
```sh
|
|
@@ -48,11 +43,11 @@ git-dedup clone https://github.com/bhouston/git-dedup.git git-dedup-main
|
|
|
48
43
|
git-dedup --stats clone https://github.com/bhouston/git-dedup.git git-dedup-review
|
|
49
44
|
|
|
50
45
|
# Adopt an existing repository and its discoverable submodules.
|
|
51
|
-
git-dedup
|
|
46
|
+
git-dedup store add ./git-dedup-main --stats
|
|
52
47
|
|
|
53
48
|
# Preview, then adopt every checkout in a workspace directory.
|
|
54
|
-
git-dedup
|
|
55
|
-
git-dedup
|
|
49
|
+
git-dedup store add ~/Coding --all --dry-run
|
|
50
|
+
git-dedup store add ~/Coding --all
|
|
56
51
|
|
|
57
52
|
# Ordinary Git commands also work through git-dedup.
|
|
58
53
|
git-dedup -C git-dedup-main status
|
|
@@ -69,31 +64,33 @@ git-dedup worktree add -b review ../project-review
|
|
|
69
64
|
|
|
70
65
|
Supported updates prepare missing submodule repositories from the pool, including nested modules with `--recursive`. `git-dedup submodule add` adds the module to the store after Git creates it. `git-dedup worktree add` uses Git's common object database and initializes supported submodules in the new worktree; `--no-checkout` defers initialization.
|
|
71
66
|
|
|
72
|
-
Other Git commands and unsupported clone forms pass through to Git. Local path clones, shallow or partial clones, and SHA-256 repositories use ordinary Git behavior.
|
|
67
|
+
Other Git commands and unsupported clone forms pass through to Git. Local path clones, shallow or partial clones, and SHA-256 repositories use ordinary Git behavior. When git-dedup forwards a clone, submodule, or worktree command it would otherwise handle, it prints one `git-dedup: <reason>; using plain Git` line on stderr unless you pass `-q` or `--quiet`.
|
|
73
68
|
|
|
74
|
-
`
|
|
69
|
+
`store add` accepts a local checkout path, not a remote URL. The checkout can then depend on the shared store for Git objects. `store fetch` refreshes registered remotes.
|
|
70
|
+
|
|
71
|
+
`store add --all` scans checkout directories below the given path without following symlinks. Within a Git worktree, it follows applicable Git ignore rules and skips `.git` metadata. Outside a Git worktree, it scans all directory names until it finds a checkout. It does not initialize absent submodules. Linked worktrees sharing one Git object database are processed once. Each checkout's outcome appears separately, and a failed checkout does not stop the remaining targets.
|
|
75
72
|
|
|
76
73
|
### Store commands
|
|
77
74
|
|
|
78
|
-
| Command
|
|
79
|
-
|
|
|
80
|
-
| `git-dedup
|
|
81
|
-
| `git-dedup
|
|
82
|
-
| `git-dedup store`
|
|
83
|
-
| `git-dedup store fetch`
|
|
84
|
-
| `git-dedup store gc`
|
|
85
|
-
| `git-dedup
|
|
75
|
+
| Command | Purpose |
|
|
76
|
+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
77
|
+
| `git-dedup store add [path]` | Adopt or relink a repository and its submodules; report skipped and failed paths (`--verbose` shows full Git errors) |
|
|
78
|
+
| `git-dedup store add <directory> --all` | Discover and adopt checkouts below a directory; use `--dry-run` to preview |
|
|
79
|
+
| `git-dedup store` | Show store path, remote count, size, and Git and pool health checks |
|
|
80
|
+
| `git-dedup store fetch` | Fetch registered remotes into the pool |
|
|
81
|
+
| `git-dedup store gc` | Compact the pool without pruning consumer objects |
|
|
82
|
+
| `git-dedup store prune` | Reclaim pool objects no registered checkout uses; refuses while a checkout is missing |
|
|
83
|
+
| `git-dedup store remove <path>` | Detach a checkout: copy its objects back and unlink it from the pool |
|
|
84
|
+
| `git-dedup store remove --forget <path>` | Unregister a deleted checkout so `store prune` can run |
|
|
86
85
|
|
|
87
86
|
### Optional storage reports
|
|
88
87
|
|
|
89
88
|
```sh
|
|
90
89
|
git-dedup --stats clone https://github.com/bhouston/git-dedup.git git-dedup-extra
|
|
91
|
-
git-dedup
|
|
90
|
+
git-dedup store add ./git-dedup-extra --stats
|
|
92
91
|
```
|
|
93
92
|
|
|
94
|
-
Reports go to stderr
|
|
95
|
-
|
|
96
|
-
Measurement is opt-in and scans local `.pack`, `.idx`, and `.rev` file metadata, without traversing Git objects. It excludes loose objects. These are logical file-size estimates, not measured disk blocks reclaimed. The first use populates the pool and can increase total disk use. Plain Git fallback does not print a report.
|
|
93
|
+
Reports go to stderr. See [storage reports](https://git-dedup.ben3d.ca/docs/how-it-works#storage-reports) for what they measure.
|
|
97
94
|
|
|
98
95
|
## Configuration
|
|
99
96
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$default.d.ts","sourceRoot":"","sources":["../../../src/commands/store/$default.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"$default.d.ts","sourceRoot":"","sources":["../../../src/commands/store/$default.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,yCAAyC,CAAC;AAC/D,eAAO,MAAM,OAAO,qBAYnB,CAAC"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { humanizeBytes } from 'humanize-units';
|
|
1
2
|
import { dedup } from '../../context.js';
|
|
2
|
-
export const describe = 'Show the shared store';
|
|
3
|
+
export const describe = 'Show the shared store and its health';
|
|
3
4
|
export const handler = async () => {
|
|
4
|
-
const
|
|
5
|
-
|
|
5
|
+
const client = dedup();
|
|
6
|
+
const info = await client.storeInfo();
|
|
7
|
+
console.log(`${info.path}\nRemotes: ${info.remoteCount}\nSize: ${humanizeBytes(info.sizeBytes)}`);
|
|
8
|
+
const health = await client.doctor();
|
|
9
|
+
if (health.empty) {
|
|
10
|
+
console.log('The store is empty. Start with `git-dedup clone <url>` or `git-dedup store add [path]`.');
|
|
11
|
+
}
|
|
12
|
+
for (const check of health.checks) {
|
|
13
|
+
console.log(`${check.ok ? 'OK' : 'WARN'} ${check.name}: ${check.detail}`);
|
|
14
|
+
}
|
|
15
|
+
if (health.checks.some((check) => !check.ok))
|
|
16
|
+
process.exitCode = 1;
|
|
6
17
|
};
|
|
7
18
|
//# sourceMappingURL=$default.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$default.js","sourceRoot":"","sources":["../../../src/commands/store/$default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,CAAC,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"$default.js","sourceRoot":"","sources":["../../../src/commands/store/$default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,CAAC,MAAM,QAAQ,GAAG,sCAAsC,CAAC;AAC/D,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;IAChC,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,cAAc,IAAI,CAAC,WAAW,WAAW,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAClG,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;IACrC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,yFAAyF,CAAC,CAAC;IACzG,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACrE,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
|
-
export declare const command = "
|
|
3
|
-
export declare const describe = "
|
|
2
|
+
export declare const command = "add [path]";
|
|
3
|
+
export declare const describe = "Add a local checkout to the shared store; linked checkouts depend on it";
|
|
4
4
|
export declare const builder: (parser: Argv) => Argv<{
|
|
5
5
|
path: string | undefined;
|
|
6
6
|
} & {
|
|
@@ -19,4 +19,4 @@ export declare const handler: (args: ArgumentsCamelCase<{
|
|
|
19
19
|
dryRun: boolean;
|
|
20
20
|
verbose: boolean;
|
|
21
21
|
}>) => Promise<void>;
|
|
22
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/commands/store/add.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAMtD,eAAO,MAAM,OAAO,eAAe,CAAC;AACpC,eAAO,MAAM,QAAQ,4EAA4E,CAAC;AAClG,eAAO,MAAM,OAAO,WAAY,IAAI;;;;;;;;;;EAyB9B,CAAC;AAWP,eAAO,MAAM,OAAO,SACZ,kBAAkB,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,kBA+C7G,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { dedup } from '
|
|
2
|
-
import { printStorageReports } from '
|
|
3
|
-
import { discoverCheckouts } from '
|
|
4
|
-
export const command = '
|
|
5
|
-
export const describe = '
|
|
1
|
+
import { dedup } from '../../context.js';
|
|
2
|
+
import { printStorageReports } from '../../stats.js';
|
|
3
|
+
import { discoverCheckouts } from '../../discover.js';
|
|
4
|
+
export const command = 'add [path]';
|
|
5
|
+
export const describe = 'Add a local checkout to the shared store; linked checkouts depend on it';
|
|
6
6
|
export const builder = (parser) => parser
|
|
7
7
|
.positional('path', {
|
|
8
8
|
type: 'string',
|
|
9
|
-
describe: '
|
|
9
|
+
describe: 'Local checkout path (defaults to the current directory)',
|
|
10
10
|
})
|
|
11
11
|
.option('stats', {
|
|
12
12
|
type: 'boolean',
|
|
@@ -16,12 +16,12 @@ export const builder = (parser) => parser
|
|
|
16
16
|
.option('all', {
|
|
17
17
|
type: 'boolean',
|
|
18
18
|
default: false,
|
|
19
|
-
describe: 'Discover and
|
|
19
|
+
describe: 'Discover and add all checkouts under the directory',
|
|
20
20
|
})
|
|
21
21
|
.option('dry-run', {
|
|
22
22
|
type: 'boolean',
|
|
23
23
|
default: false,
|
|
24
|
-
describe: 'Preview checkouts discovered by --all without
|
|
24
|
+
describe: 'Preview checkouts discovered by --all without adding them',
|
|
25
25
|
})
|
|
26
26
|
.option('verbose', {
|
|
27
27
|
type: 'boolean',
|
|
@@ -32,7 +32,7 @@ function reportRepositories(result, verbose) {
|
|
|
32
32
|
for (const repository of result.repositories) {
|
|
33
33
|
if (!repository.reason)
|
|
34
34
|
continue;
|
|
35
|
-
const label = repository.status === '
|
|
35
|
+
const label = repository.status === 'added' ? 'Warning' : repository.status === 'failed' ? 'Failed' : 'Skipped';
|
|
36
36
|
console.error(`${label} ${repository.path}: ${repository.reason}`);
|
|
37
37
|
if (verbose && repository.detail)
|
|
38
38
|
console.error(repository.detail);
|
|
@@ -44,14 +44,14 @@ export const handler = async (args) => {
|
|
|
44
44
|
const reports = [];
|
|
45
45
|
const client = dedup(args.stats ? { onStorageReport: (report) => reports.push(report) } : undefined);
|
|
46
46
|
if (args.all) {
|
|
47
|
-
const targets = await discoverCheckouts(args.path ?? process.cwd());
|
|
47
|
+
const targets = await discoverCheckouts(args.path ?? process.cwd(), await client.gitPath());
|
|
48
48
|
console.log(`Discovered ${targets.length} checkout(s):`);
|
|
49
49
|
for (const target of targets)
|
|
50
50
|
console.log(` ${target.path}${target.coveredBy ? ` (submodule of ${target.coveredBy})` : ''}`);
|
|
51
51
|
if (args.dryRun)
|
|
52
52
|
return;
|
|
53
53
|
const completed = new Set();
|
|
54
|
-
let
|
|
54
|
+
let added = 0;
|
|
55
55
|
let skipped = 0;
|
|
56
56
|
let failed = 0;
|
|
57
57
|
for (const target of targets) {
|
|
@@ -60,35 +60,35 @@ export const handler = async (args) => {
|
|
|
60
60
|
continue;
|
|
61
61
|
}
|
|
62
62
|
try {
|
|
63
|
-
const result = await client.
|
|
64
|
-
|
|
63
|
+
const result = await client.add(target.path);
|
|
64
|
+
added += result.added;
|
|
65
65
|
skipped += result.skipped;
|
|
66
66
|
failed += result.failed;
|
|
67
67
|
reportRepositories(result, args.verbose);
|
|
68
68
|
completed.add(target.path);
|
|
69
|
-
console.log(`Finished ${target.path}:
|
|
69
|
+
console.log(`Finished ${target.path}: added ${result.added}, skipped ${result.skipped}, failed ${result.failed}`);
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
72
72
|
failed++;
|
|
73
73
|
const detail = error instanceof Error ? error.message : String(error);
|
|
74
|
-
console.error(`Failed ${target.path}:
|
|
74
|
+
console.error(`Failed ${target.path}: store add operation failed`);
|
|
75
75
|
if (args.verbose)
|
|
76
76
|
console.error(detail);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
console.log(`
|
|
79
|
+
console.log(`Added ${added} repository(s); skipped ${skipped}; failed ${failed}.`);
|
|
80
80
|
if (args.stats)
|
|
81
81
|
printStorageReports(reports);
|
|
82
82
|
if (failed)
|
|
83
83
|
process.exitCode = 1;
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
const result = await client.
|
|
86
|
+
const result = await client.add(args.path);
|
|
87
87
|
reportRepositories(result, args.verbose);
|
|
88
|
-
console.log(`
|
|
88
|
+
console.log(`Added ${result.added} repository(s); skipped ${result.skipped}; failed ${result.failed}.`);
|
|
89
89
|
if (args.stats)
|
|
90
90
|
printStorageReports(reports);
|
|
91
91
|
if (result.failed)
|
|
92
92
|
process.exitCode = 1;
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=
|
|
94
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/store/add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AACpC,MAAM,CAAC,MAAM,QAAQ,GAAG,yEAAyE,CAAC;AAClG,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAY,EAAE,EAAE,CACtC,MAAM;KACH,UAAU,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,yDAAyD;CACpE,CAAC;KACD,MAAM,CAAC,OAAO,EAAE;IACf,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,yCAAyC;CACpD,CAAC;KACD,MAAM,CAAC,KAAK,EAAE;IACb,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,oDAAoD;CAC/D,CAAC;KACD,MAAM,CAAC,SAAS,EAAE;IACjB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,2DAA2D;CACtE,CAAC;KACD,MAAM,CAAC,SAAS,EAAE;IACjB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,0DAA0D;CACrE,CAAC,CAAC;AAEP,SAAS,kBAAkB,CAAC,MAAsB,EAAE,OAAgB;IAClE,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC7C,IAAI,CAAC,UAAU,CAAC,MAAM;YA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C;gBACtE,OAAO,CAAC,KAAK,CAAC,UAAU,MAAM,CAAC,IAAI,8BAA8B,CAAC,CAAC;gBACnE,IAAI,IAAI,CAAC,OAAO;oBAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,2BAA2B,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC;QACnF,IAAI,IAAI,CAAC,KAAK;YAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,MAAM;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACjC,OAAO;IACT,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,KAAK,2BAA2B,MAAM,CAAC,OAAO,YAAY,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACxG,IAAI,IAAI,CAAC,KAAK;QAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/commands/store/fetch.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,QAAQ,yDAAyD,CAAC;AAC/E,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/commands/store/fetch.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,QAAQ,yDAAyD,CAAC;AAC/E,eAAO,MAAM,OAAO,qBAMnB,CAAC"}
|
|
@@ -3,6 +3,11 @@ export const command = 'fetch';
|
|
|
3
3
|
export const describe = 'Fetch registered remotes into the shared object pool';
|
|
4
4
|
export const handler = async () => {
|
|
5
5
|
const result = await dedup().fetch();
|
|
6
|
-
|
|
6
|
+
for (const remote of result.remotes)
|
|
7
|
+
if (remote.status === 'failed')
|
|
8
|
+
console.error(`Failed ${remote.key}: ${remote.reason}`);
|
|
9
|
+
console.log(`Fetched ${result.fetched} remote(s); ${result.failed} failed.`);
|
|
10
|
+
if (result.failed)
|
|
11
|
+
process.exitCode = 1;
|
|
7
12
|
};
|
|
8
13
|
//# sourceMappingURL=fetch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/commands/store/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,sDAAsD,CAAC;AAC/E,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;IAChC,MAAM,MAAM,GAAG,MAAM,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/commands/store/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,sDAAsD,CAAC;AAC/E,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;IAChC,MAAM,MAAM,GAAG,MAAM,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;IACrC,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO;QACjC,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,CAAC,KAAK,CAAC,UAAU,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,OAAO,eAAe,MAAM,CAAC,MAAM,UAAU,CAAC,CAAC;IAC7E,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune.d.ts","sourceRoot":"","sources":["../../../src/commands/store/prune.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,QAAQ,0DAA0D,CAAC;AAChF,eAAO,MAAM,OAAO,qBAGnB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { humanizeBytes } from 'humanize-units';
|
|
2
|
+
import { dedup } from '../../context.js';
|
|
3
|
+
export const command = 'prune';
|
|
4
|
+
export const describe = 'Reclaim pool objects that no registered checkout uses';
|
|
5
|
+
export const handler = async () => {
|
|
6
|
+
const result = await dedup().prune();
|
|
7
|
+
console.log(`Reclaimed ${humanizeBytes(result.reclaimedBytes)}.`);
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=prune.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune.js","sourceRoot":"","sources":["../../../src/commands/store/prune.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,uDAAuD,CAAC;AAChF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;IAChC,MAAM,MAAM,GAAG,MAAM,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,aAAa,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACpE,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
|
+
export declare const command = "remove <path>";
|
|
3
|
+
export declare const describe = "Detach a checkout and its submodules from the shared store";
|
|
4
|
+
export declare const builder: (parser: Argv) => Argv<{
|
|
5
|
+
path: string;
|
|
6
|
+
} & {
|
|
7
|
+
verbose: boolean;
|
|
8
|
+
} & {
|
|
9
|
+
forget: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const handler: (args: ArgumentsCamelCase<{
|
|
12
|
+
path: string;
|
|
13
|
+
verbose: boolean;
|
|
14
|
+
forget: boolean;
|
|
15
|
+
}>) => Promise<void>;
|
|
16
|
+
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/commands/store/remove.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAItD,eAAO,MAAM,OAAO,kBAAkB,CAAC;AACvC,eAAO,MAAM,QAAQ,+DAA+D,CAAC;AACrF,eAAO,MAAM,OAAO,WAAY,IAAI;;;;;;EAgB9B,CAAC;AAEP,eAAO,MAAM,OAAO,SAAgB,kBAAkB,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,kBAuB1G,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { dedup } from '../../context.js';
|
|
2
|
+
import { humanizeBytes } from 'humanize-units';
|
|
3
|
+
export const command = 'remove <path>';
|
|
4
|
+
export const describe = 'Detach a checkout and its submodules from the shared store';
|
|
5
|
+
export const builder = (parser) => parser
|
|
6
|
+
.positional('path', {
|
|
7
|
+
type: 'string',
|
|
8
|
+
demandOption: true,
|
|
9
|
+
describe: 'Local checkout path',
|
|
10
|
+
})
|
|
11
|
+
.option('verbose', {
|
|
12
|
+
type: 'boolean',
|
|
13
|
+
default: false,
|
|
14
|
+
describe: 'Show full Git errors for skipped and failed repositories',
|
|
15
|
+
})
|
|
16
|
+
.option('forget', {
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
default: false,
|
|
19
|
+
describe: 'Release a deleted checkout so store prune can reclaim its objects',
|
|
20
|
+
});
|
|
21
|
+
export const handler = async (args) => {
|
|
22
|
+
if (args.forget) {
|
|
23
|
+
const forgotten = await dedup().forget(args.path);
|
|
24
|
+
for (const gitdir of forgotten)
|
|
25
|
+
console.log(`Forgot ${gitdir}`);
|
|
26
|
+
if (!forgotten.length) {
|
|
27
|
+
console.error(`No registered checkout matches ${args.path}.`);
|
|
28
|
+
process.exitCode = 1;
|
|
29
|
+
}
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const result = await dedup().remove(args.path);
|
|
33
|
+
for (const repository of result.repositories) {
|
|
34
|
+
if (repository.status === 'removed')
|
|
35
|
+
console.log(`Removed ${repository.path}: objects now use ${humanizeBytes(repository.objectBytes ?? 0)}`);
|
|
36
|
+
else
|
|
37
|
+
console.error(`${repository.status === 'failed' ? 'Failed' : 'Skipped'} ${repository.path}: ${repository.reason}`);
|
|
38
|
+
if (args.verbose && repository.detail)
|
|
39
|
+
console.error(repository.detail);
|
|
40
|
+
}
|
|
41
|
+
if (!result.removed && !result.failed)
|
|
42
|
+
console.log(`Nothing to remove: ${args.path} is not linked to the store.`);
|
|
43
|
+
else
|
|
44
|
+
console.log(`Removed ${result.removed} repository(s); skipped ${result.skipped}; failed ${result.failed}.`);
|
|
45
|
+
if (result.failed)
|
|
46
|
+
process.exitCode = 1;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/commands/store/remove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,4DAA4D,CAAC;AACrF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAY,EAAE,EAAE,CACtC,MAAM;KACH,UAAU,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,qBAAqB;CAChC,CAAC;KACD,MAAM,CAAC,SAAS,EAAE;IACjB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,0DAA0D;CACrE,CAAC;KACD,MAAM,CAAC,QAAQ,EAAE;IAChB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,mEAAmE;CAC9E,CAAC,CAAC;AAEP,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,IAA6E,EAAE,EAAE;IAC7G,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,SAAS,GAAG,MAAM,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,KAAK,MAAM,MAAM,IAAI,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,kCAAkC,IAAI,CAAC,IAAI,GAAG,CA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string[]) => Promise<number>;
|
|
4
|
-
|
|
4
|
+
add: (path?: string, quiet?: boolean) => Promise<import("git-dedup-core").StoreAddResult>;
|
|
5
|
+
remove: (path?: string) => Promise<import("git-dedup-core").StoreRemoveResult>;
|
|
5
6
|
storeInfo: () => Promise<import("git-dedup-core").StoreInfo>;
|
|
6
7
|
listRemotes: () => Promise<import("git-dedup-core").StoreRemote[]>;
|
|
7
|
-
fetch: () => Promise<
|
|
8
|
-
fetched: number;
|
|
9
|
-
}>;
|
|
8
|
+
fetch: () => Promise<import("git-dedup-core").StoreFetchResult>;
|
|
10
9
|
gc: () => Promise<{
|
|
11
10
|
compacted: boolean;
|
|
12
11
|
}>;
|
|
12
|
+
prune: () => Promise<import("git-dedup-core").PruneResult>;
|
|
13
|
+
forget: (path: string) => Promise<string[]>;
|
|
13
14
|
doctor: () => Promise<import("git-dedup-core").DoctorResult>;
|
|
14
15
|
storePath: () => Promise<string>;
|
|
15
16
|
gitVersion: () => Promise<string>;
|
|
17
|
+
gitPath: () => Promise<string>;
|
|
16
18
|
};
|
|
17
19
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,KAAK,aAAc,eAAe
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,KAAK,aAAc,eAAe;;;;;;;;;;;;;;;;CAA4B,CAAC"}
|
package/dist/discover.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export interface DiscoveredCheckout {
|
|
|
2
2
|
path: string;
|
|
3
3
|
gitDir: string;
|
|
4
4
|
commonGitDir: string;
|
|
5
|
-
/** The parent repository whose
|
|
5
|
+
/** The parent repository whose store add operation visits this initialized submodule. */
|
|
6
6
|
coveredBy?: string;
|
|
7
7
|
}
|
|
8
|
-
/** Discover checkout roots without following symlinks or entering Git
|
|
9
|
-
export declare function discoverCheckouts(directory: string): Promise<DiscoveredCheckout[]>;
|
|
8
|
+
/** Discover checkout roots without following symlinks or entering ignored directories or Git metadata. */
|
|
9
|
+
export declare function discoverCheckouts(directory: string, git?: string): Promise<DiscoveredCheckout[]>;
|
|
10
10
|
//# sourceMappingURL=discover.d.ts.map
|
package/dist/discover.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAkCA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,0GAA0G;AAC1G,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAQ,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAqDrG"}
|
package/dist/discover.js
CHANGED
|
@@ -1,44 +1,63 @@
|
|
|
1
|
-
import { execFile } from 'node:child_process';
|
|
1
|
+
import { execFile, spawn } from 'node:child_process';
|
|
2
2
|
import { readdir, realpath, stat } from 'node:fs/promises';
|
|
3
3
|
import { promisify } from 'node:util';
|
|
4
4
|
import { isAbsolute, join, resolve, sep } from 'node:path';
|
|
5
5
|
const execFileAsync = promisify(execFile);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
async function isInsideWorktree(git, path) {
|
|
7
|
+
try {
|
|
8
|
+
const { stdout } = await execFileAsync(git, ['-C', path, 'rev-parse', '--is-inside-work-tree']);
|
|
9
|
+
return stdout.trim() === 'true';
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function ignoredDirectories(git, path, names) {
|
|
16
|
+
if (!names.length)
|
|
17
|
+
return new Set();
|
|
18
|
+
const output = await new Promise((done, reject) => {
|
|
19
|
+
const child = spawn(git, ['-C', path, 'check-ignore', '--no-index', '-z', '--stdin']);
|
|
20
|
+
const stdout = [];
|
|
21
|
+
const stderr = [];
|
|
22
|
+
child.stdout.on('data', (chunk) => stdout.push(chunk));
|
|
23
|
+
child.stderr.on('data', (chunk) => stderr.push(chunk));
|
|
24
|
+
child.once('error', reject);
|
|
25
|
+
child.once('close', (code) => {
|
|
26
|
+
if (code === 0 || code === 1)
|
|
27
|
+
done(Buffer.concat(stdout).toString());
|
|
28
|
+
else
|
|
29
|
+
reject(new Error(`git check-ignore failed: ${Buffer.concat(stderr).toString().trim()}`));
|
|
30
|
+
});
|
|
31
|
+
child.stdin.end(names.join('\0') + '\0');
|
|
32
|
+
});
|
|
33
|
+
return new Set(output.split('\0').filter(Boolean));
|
|
34
|
+
}
|
|
35
|
+
/** Discover checkout roots without following symlinks or entering ignored directories or Git metadata. */
|
|
36
|
+
export async function discoverCheckouts(directory, git = 'git') {
|
|
23
37
|
const root = resolve(directory);
|
|
24
38
|
if (!(await stat(root)).isDirectory())
|
|
25
39
|
throw new Error(`Not a directory: ${root}`);
|
|
26
40
|
const candidates = [];
|
|
27
|
-
const pending = [root];
|
|
41
|
+
const pending = [{ path: root, insideWorktree: await isInsideWorktree(git, root) }];
|
|
28
42
|
while (pending.length) {
|
|
29
|
-
const current = pending.pop();
|
|
43
|
+
const { path: current, insideWorktree } = pending.pop();
|
|
30
44
|
const entries = await readdir(current, { withFileTypes: true });
|
|
31
|
-
|
|
45
|
+
const hasGit = entries.some((entry) => entry.name === '.git' && (entry.isFile() || entry.isDirectory()));
|
|
46
|
+
if (hasGit)
|
|
32
47
|
candidates.push(current);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
const directories = entries.filter((entry) => entry.isDirectory() && entry.name !== '.git');
|
|
49
|
+
const excluded = insideWorktree || hasGit
|
|
50
|
+
? await ignoredDirectories(git, current, directories.map((entry) => entry.name))
|
|
51
|
+
: new Set();
|
|
52
|
+
for (const entry of directories) {
|
|
53
|
+
if (!excluded.has(entry.name))
|
|
54
|
+
pending.push({ path: join(current, entry.name), insideWorktree: insideWorktree || hasGit });
|
|
36
55
|
}
|
|
37
56
|
}
|
|
38
57
|
const unique = new Map();
|
|
39
58
|
for (const path of candidates.toSorted((a, b) => a.length - b.length || a.localeCompare(b))) {
|
|
40
59
|
try {
|
|
41
|
-
const { stdout } = await execFileAsync(
|
|
60
|
+
const { stdout } = await execFileAsync(git, [
|
|
42
61
|
'-C',
|
|
43
62
|
path,
|
|
44
63
|
'rev-parse',
|
package/dist/discover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE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C,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;aACzF,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACzF,IAAI,MAAM;YAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC;IAC5C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
import { createGitDedup } from 'git-dedup-core';
|
|
5
5
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
const packageInfo = JSON.parse(readFileSync(join(here, '../package.json'), 'utf8'));
|
|
7
|
-
const ownCommands = new Set(['
|
|
7
|
+
const ownCommands = new Set(['store', 'docgen']);
|
|
8
8
|
/** Run the git-dedup CLI. All Git commands retain their original argument array. */
|
|
9
9
|
export async function main(args = process.argv.slice(2)) {
|
|
10
10
|
const stats = args[0] === '--stats';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACrD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,iBA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Q,EAAE,yDAAyD,EAAE,CAAC;SACzG,MAAM,EAAE;SACR,cAAc,CAAC,IAAI,CAAC,CAAC;IACxB,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC;IACtC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC1B,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/stats.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI,CAwBlE"}
|
package/dist/stats.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
if (value < 1024)
|
|
3
|
-
return `${value} B`;
|
|
4
|
-
const units = ['KiB', 'MiB', 'GiB', 'TiB'];
|
|
5
|
-
let scaled = value;
|
|
6
|
-
let unit = -1;
|
|
7
|
-
do {
|
|
8
|
-
scaled /= 1024;
|
|
9
|
-
unit++;
|
|
10
|
-
} while (scaled >= 1024 && unit < units.length - 1);
|
|
11
|
-
return `${scaled.toFixed(1)} ${units[unit]}`;
|
|
12
|
-
}
|
|
1
|
+
import { humanizeBytes as bytes } from 'humanize-units';
|
|
13
2
|
/** Report logical pack bytes; no filesystem allocation estimate is available. */
|
|
14
3
|
export function printStorageReports(reports) {
|
|
15
4
|
for (const report of reports) {
|
|
16
5
|
const prefix = `git-dedup: ${report.operation} ${report.repository}: ${report.poolReused ? 'reused' : 'created'} object pool; `;
|
|
17
|
-
if (report.operation === '
|
|
6
|
+
if (report.operation === 'add') {
|
|
18
7
|
process.stderr.write(prefix +
|
|
19
8
|
`private packs ${bytes(report.beforeUniqueBytes ?? 0)} -> ${bytes(report.afterUniqueBytes ?? 0)}; ` +
|
|
20
9
|
`estimated private pack reduction ${bytes(report.estimatedSavedBytes)}\n`);
|
|
@@ -25,8 +14,8 @@ export function printStorageReports(reports) {
|
|
|
25
14
|
}
|
|
26
15
|
if (reports.length) {
|
|
27
16
|
const total = reports.reduce((sum, report) => sum + report.estimatedSavedBytes, 0);
|
|
28
|
-
if (reports[0]?.operation === '
|
|
29
|
-
process.stderr.write(`git-dedup: estimated private pack reduction ${bytes(total)}
|
|
17
|
+
if (reports[0]?.operation === 'add') {
|
|
18
|
+
process.stderr.write(`git-dedup: estimated private pack reduction ${bytes(total)}; ` +
|
|
30
19
|
'logical pack bytes only; actual disk reclaimed may differ.\n');
|
|
31
20
|
}
|
|
32
21
|
else {
|
package/dist/stats.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAExD,iFAAiF;AACjF,MAAM,UAAU,mBAAmB,CAAC,OAAwB;IAC1D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,cAAc,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,gBAAgB,CAAC;QAChI,IAAI,MAAM,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,MAAM;gBACJ,iBAAiB,KAAK,CAAC,MAAM,CAAC,iBAAiB,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,gBAAgB,IAAI,CAAC,CAAC,IAAI;gBACnG,oCAAoC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAC5E,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,2CAA2C,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;QACnF,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,KAAK,KAAK,EAAE,CAAC;YACpC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,+CAA+C,KAAK,CAAC,KAAK,CAAC,IAAI;gBAC7D,8DAA8D,CACjE,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mFAAmF,CAAC,CAAC;QAC5G,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-dedup",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Faster checkouts, a fraction of the disk space: share one copy of Git history across clones, worktrees, and submodules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
7
7
|
"clone",
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"README.md",
|
|
30
30
|
"LICENSE"
|
|
31
31
|
],
|
|
32
|
+
"os": [
|
|
33
|
+
"darwin",
|
|
34
|
+
"linux"
|
|
35
|
+
],
|
|
32
36
|
"type": "module",
|
|
33
37
|
"exports": {
|
|
34
38
|
".": {
|
|
@@ -42,9 +46,10 @@
|
|
|
42
46
|
"dependencies": {
|
|
43
47
|
"@clidoc/core": "^0.1.0",
|
|
44
48
|
"@clidoc/yargs": "^1.1.0",
|
|
49
|
+
"humanize-units": "^2.0.4",
|
|
45
50
|
"yargs": "^18.0.0",
|
|
46
51
|
"yargs-file-commands": "^2.1.0",
|
|
47
|
-
"git-dedup-core": "0.1
|
|
52
|
+
"git-dedup-core": "2.0.1"
|
|
48
53
|
},
|
|
49
54
|
"devDependencies": {
|
|
50
55
|
"@types/node": "^24.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/commands/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAMtD,eAAO,MAAM,OAAO,iBAAiB,CAAC;AACtC,eAAO,MAAM,QAAQ,qDAAqD,CAAC;AAC3E,eAAO,MAAM,OAAO,WAAY,IAAI;;;;;;;;;;EAyB9B,CAAC;AAWP,eAAO,MAAM,OAAO,SACZ,kBAAkB,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,kBA+C7G,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/commands/cache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,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AAC;QACrF,IAAI,IAAI,CAAC,KAAK;YAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,MAAM;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACjC,OAAO;IACT,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,MAAM,2BAA2B,MAAM,CAAC,OAAO,YAAY,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1G,IAAI,IAAI,CAAC,KAAK;QAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,WAAW,CAAC;AAChC,eAAO,MAAM,QAAQ,6CAA6C,CAAC;AACnE,eAAO,MAAM,OAAO,qBAMnB,CAAC"}
|
package/dist/commands/doctor.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { dedup } from '../context.js';
|
|
2
|
-
export const command = 'doctor';
|
|
3
|
-
export const describe = 'Check Git and shared store configuration';
|
|
4
|
-
export const handler = async () => {
|
|
5
|
-
const result = await dedup().doctor();
|
|
6
|
-
for (const check of result.checks) {
|
|
7
|
-
console.log(`${check.ok ? 'OK' : 'WARN'} ${check.name}: ${check.detail}`);
|
|
8
|
-
}
|
|
9
|
-
if (result.checks.some((check) => !check.ok))
|
|
10
|
-
process.exitCode = 1;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=doctor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAChC,MAAM,CAAC,MAAM,QAAQ,GAAG,0CAA0C,CAAC;AACnE,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;IAChC,MAAM,MAAM,GAAG,MAAM,KAAK,EAAE,CAAC,MAAM,EAAE,CAAC;IACtC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACrE,CAAC,CAAC"}
|