@gitkraken/core-gitlens 0.8.0 → 0.9.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/CHANGELOG.md +43 -1
- package/dist/git/cache.d.ts +11 -0
- package/dist/git/cache.js +26 -3
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +3 -2
- package/dist/git/context.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.js +1 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/models/reflog.d.ts +6 -0
- package/dist/git/models/reflog.js.map +1 -1
- package/dist/git/models/revision.d.ts +0 -1
- package/dist/git/models/revision.js +1 -2
- package/dist/git/models/revision.js.map +1 -1
- package/dist/git/providers/commits.d.ts +20 -1
- package/dist/git/providers/operations.d.ts +13 -0
- package/dist/git/providers/provider.d.ts +14 -4
- package/dist/git/providers/refs.d.ts +10 -0
- package/dist/git/providers/revision.d.ts +2 -0
- package/dist/git/providers/staging.d.ts +2 -1
- package/dist/git/providers/stash.d.ts +3 -2
- package/dist/git/providers/status.d.ts +4 -0
- package/dist/git/run.types.d.ts +16 -0
- package/dist/git-cli/cliGitProvider.d.ts +24 -3
- package/dist/git-cli/cliGitProvider.js +79 -17
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/commandClassifier.d.ts +31 -0
- package/dist/git-cli/exec/commandClassifier.js +391 -0
- package/dist/git-cli/exec/commandClassifier.js.map +1 -0
- package/dist/git-cli/exec/git.d.ts +24 -3
- package/dist/git-cli/exec/git.js +116 -12
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/parsers/reflogParser.d.ts +7 -0
- package/dist/git-cli/parsers/reflogParser.js +11 -1
- package/dist/git-cli/parsers/reflogParser.js.map +1 -1
- package/dist/git-cli/providers/branches.js +16 -14
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts +4 -2
- package/dist/git-cli/providers/commits.js +55 -4
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/diff.js +4 -4
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +12 -0
- package/dist/git-cli/providers/operations.js +26 -3
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/patch.js +2 -5
- package/dist/git-cli/providers/patch.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts +5 -0
- package/dist/git-cli/providers/refs.js +26 -1
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/remotes.js +3 -2
- package/dist/git-cli/providers/remotes.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +2 -0
- package/dist/git-cli/providers/revision.js +11 -0
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/staging.d.ts +2 -1
- package/dist/git-cli/providers/staging.js +12 -7
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/stash.d.ts +3 -2
- package/dist/git-cli/providers/stash.js +34 -22
- package/dist/git-cli/providers/stash.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +2 -0
- package/dist/git-cli/providers/status.js +27 -9
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +13 -0
- package/dist/plus/git-github/api/github.js +36 -6
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/providers/github/commits.d.ts +4 -2
- package/dist/plus/git-github/providers/github/commits.js +3 -1
- package/dist/plus/git-github/providers/github/commits.js.map +1 -1
- package/dist/plus/git-github/providers/github/revision.d.ts +1 -0
- package/dist/plus/git-github/providers/github/revision.js +5 -0
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.d.ts +6 -0
- package/dist/plus/integrations/collectionMetadata.js +7 -4
- package/dist/plus/integrations/collectionMetadata.js.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -0
- package/dist/plus/integrations/models/gitHostIntegration.js +19 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +16 -1
- package/dist/plus/integrations/providers/github.js +39 -1
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +26 -5
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/docs/integrations.md +22 -5
- package/docs/kepler-git-write-api-parity.md +140 -14
- package/package.json +1 -1
|
@@ -14,6 +14,9 @@ no method for, or had one whose contract did not fit. Each such site stayed on `
|
|
|
14
14
|
comment naming the missing API. This document is the list of those APIs, what was added for each, and what was
|
|
15
15
|
deliberately left alone.
|
|
16
16
|
|
|
17
|
+
§1–§9 were the first round. §10–§19 are the second: the commands Kepler still ran raw once the first round
|
|
18
|
+
shipped, each because a typed method lacked one option or one behavior.
|
|
19
|
+
|
|
17
20
|
Verdict legend: **added** (a typed method now exists) · **extended** (an existing method gained the missing
|
|
18
21
|
option) · **deferred** (left on the raw escape hatch on purpose, with the reason).
|
|
19
22
|
|
|
@@ -82,13 +85,17 @@ to 60s. `clearCaches` fixed that read but fired none of the host's hooks, so not
|
|
|
82
85
|
the refs moved.
|
|
83
86
|
|
|
84
87
|
- The provider wraps `onReset` when it is constructed. On every reset it hard-evicts its own caches for those
|
|
85
|
-
types (`Cache.evictCaches`, so a later caller never joins pre-write work), drops
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
types (`Cache.evictCaches`, so a later caller never joins pre-write work), drops the written repository's
|
|
89
|
+
pending commands (its registered worktrees' included, no other repository's), then calls the host's handler.
|
|
90
|
+
Clears driven by a file watcher reach `clearCaches` directly and keep sharing in-flight reads, which is what
|
|
91
|
+
stops a burst of file events from spawning duplicate reads. A host's handler now only has host-side state to
|
|
92
|
+
update; forwarding to `clearCaches` as well is redundant but harmless.
|
|
89
93
|
- `provider.notifyChanged(repoPath, changes: RepositoryChange[], options?: { cache?: CachedGitTypes[] | 'all' })`
|
|
90
|
-
fires the same `cache.onReset`
|
|
91
|
-
|
|
94
|
+
fires the same `cache.onReset` and `repository.onChanged` a typed write would, so a raw mutation gets the
|
|
95
|
+
same treatment, host listeners included. Without `cache` it resets what `changes` map to, the same caches a
|
|
96
|
+
file watcher's change of those kinds clears; an empty `changes`, or one naming `unknown`, resets everything,
|
|
97
|
+
and `cache: 'all'` always does. A consumer naming its own changes must name every kind the write can touch
|
|
98
|
+
(a `commit` that concludes a merge is `pausedOp` too), or those caches keep their pre-write answer.
|
|
92
99
|
|
|
93
100
|
## 3. Worktree administration — added / extended
|
|
94
101
|
|
|
@@ -169,6 +176,108 @@ is the fix when the consumer made the change; `force` is for a read that must be
|
|
|
169
176
|
- `validateReference`'s `relativePath` moved into the options object, and `getBranch` / `getReference` take
|
|
170
177
|
options before `cancellation`, matching `getStatus`.
|
|
171
178
|
|
|
179
|
+
## 10. An inherited git environment — fixed
|
|
180
|
+
|
|
181
|
+
A host launched by git (a hook, a `rebase -x` step, an editor opened as `GIT_EDITOR`) inherits that
|
|
182
|
+
repository's `GIT_DIR`, `GIT_WORK_TREE`, `GIT_INDEX_FILE` and friends, and git lets them override the working
|
|
183
|
+
directory, so every command core ran targeted the launching repository. The base environment now drops
|
|
184
|
+
`GIT_DIR`, `GIT_WORK_TREE`, `GIT_INDEX_FILE`, `GIT_COMMON_DIR`, `GIT_OBJECT_DIRECTORY`,
|
|
185
|
+
`GIT_ALTERNATE_OBJECT_DIRECTORIES` and `GIT_NAMESPACE` from the inherited `process.env`, plus the state git
|
|
186
|
+
hands a child about its own command: `GIT_CONFIG_PARAMETERS` (its `-c` options), `GIT_EXEC_PATH`, `GIT_PREFIX`
|
|
187
|
+
and `GIT_REFLOG_ACTION`. None is worth keeping when set deliberately: a `GIT_DIR` would point every repository
|
|
188
|
+
the host opens at one. `GIT_AUTHOR_*` / `GIT_COMMITTER_*` are different, since a deliberate identity (direnv,
|
|
189
|
+
say) breaks nothing, so they are dropped only when git launched the host, which it always marks by exporting
|
|
190
|
+
`GIT_EXEC_PATH`: an editor opened for `commit --amend` inherits that commit's author and date. `GIT_CONFIG_COUNT` /
|
|
191
|
+
`GIT_CONFIG_KEY_<n>` / `GIT_CONFIG_VALUE_<n>` are kept: git never sets them itself, so inherited ones are the
|
|
192
|
+
user's deliberate configuration. Only the inherited environment is scrubbed; a host's `env`, `getEnvironment()`
|
|
193
|
+
and a per-call `env` can still set any of these, as temporary-index staging does with `GIT_INDEX_FILE`.
|
|
194
|
+
|
|
195
|
+
## 11. Run options on stash and clean — extended
|
|
196
|
+
|
|
197
|
+
`stash.applyStash`, `stash.saveStash` and `staging.clean` take the trailing `runOptions` (`env`,
|
|
198
|
+
`cancellation`, `timeout`) every other long-running operation already did. No typed default changed: see the
|
|
199
|
+
timeout decision below.
|
|
200
|
+
|
|
201
|
+
## 12. A raw run that announces its own change — added
|
|
202
|
+
|
|
203
|
+
`git.run({ notify })` calls the provider's `notifyChanged` once the run settles, succeeded or failed (a
|
|
204
|
+
command that fails partway may still have moved something). An explicit `RepositoryChange[]` announces exactly
|
|
205
|
+
that. `'infer'` classifies the argv: read-only and object-store-only commands announce nothing, a write
|
|
206
|
+
announces its verb's changes for the repository it ran in (the `-C` target when given). Run under `-C`, a
|
|
207
|
+
write also announces to the caller's own tree the kinds every worktree sharing that `.git` sees (`heads`,
|
|
208
|
+
`tags`, `stash`, `remotes`, `worktrees`, `config`), since the target may be a worktree the cache never
|
|
209
|
+
registered; its HEAD, index, paused operation and FETCH_HEAD are the target's alone. A write it can't
|
|
210
|
+
classify resets both trees in full. Unset, nothing is classified and the run takes the same path as before.
|
|
211
|
+
|
|
212
|
+
## 13. Fetch with explicit refspecs, and without FETCH_HEAD — extended
|
|
213
|
+
|
|
214
|
+
- `ops.fetch(repoPath, { remote, refspecs, prune? })` passes the refspecs verbatim after the remote
|
|
215
|
+
(`+refs/heads/x:refs/remotes/o/x`, `upstream:local`). It never adds `-u`, so git keeps refusing to write
|
|
216
|
+
into a checked-out branch, which a caller fast-forwarding a branch checked out nowhere relies on. A refspec
|
|
217
|
+
whose destination is a local branch or tag also announces `heads` or `tags`. The type refuses `refspecs`
|
|
218
|
+
beside `branch`, `all` or `pull`.
|
|
219
|
+
- `preserveFetchHead` passes `--no-write-fetch-head`, on every form of fetch. A checkout has one
|
|
220
|
+
`FETCH_HEAD`, and a user's own `git pull` reads it back right after its fetch, so a background fetch landing
|
|
221
|
+
in between breaks that pull. Git older than 2.29 has no such flag; there the option is ignored rather than
|
|
222
|
+
failing the fetch.
|
|
223
|
+
|
|
224
|
+
## 14. Clone into an exact folder — extended
|
|
225
|
+
|
|
226
|
+
`clone(url, parentPath, { folderName }, runOptions)`, on both core's `GitProvider` and GitLens's
|
|
227
|
+
`GlGitProvider`. `folderName` is used as given, with no numbering past a taken name, so git's own refusal of a
|
|
228
|
+
non-empty folder surfaces. Without it the folder is derived from the URL and numbered as before. `runOptions`
|
|
229
|
+
carries the clone's credentials, cancellation and timeout.
|
|
230
|
+
|
|
231
|
+
## 15. Status without untracked detail or branch state — extended
|
|
232
|
+
|
|
233
|
+
`status.getStatus(repoPath, { untracked: 'no' | 'normal' | 'all', branch: false })`. `untracked` picks git's
|
|
234
|
+
`-u` mode (default `all`, as before). `branch: false` skips `--branch`, whose ahead/behind against the upstream
|
|
235
|
+
is the slow part on a large divergence; the result's `branch`, `sha`, `upstream` and `detached` are then unset
|
|
236
|
+
and mean nothing. A narrower read gets its own dedup key, so a full-status caller never joins it and loses
|
|
237
|
+
files. `GIT_OPTIONAL_LOCKS=0` was already set on every status read, so there is no lock option.
|
|
238
|
+
|
|
239
|
+
## 16. A reflog read filtered by message — added
|
|
240
|
+
|
|
241
|
+
`refs.getReflogEntries(repoPath, ref, { grep? })` returns `{ sha, message }` per entry, newest first, where
|
|
242
|
+
`grep` is git's `--grep-reflog` pattern. It resolves `[]` when nothing matches or the ref has no reflog, and
|
|
243
|
+
rejects when the read fails, so a caller can tell "no answer" from "never read". It runs `reflog show <ref> --`,
|
|
244
|
+
not `reflog <ref>`: a branch named `delete`, `expire` or `exists` would otherwise run that subcommand, and one
|
|
245
|
+
named like a tracked file would fail as ambiguous. Core's own base-branch inference moved onto it, which
|
|
246
|
+
fixed both cases there.
|
|
247
|
+
|
|
248
|
+
## 17. Commit counts that exclude other refs — extended
|
|
249
|
+
|
|
250
|
+
`commits.getCommitCount(repoPath, rev, { excluding: { branches?, remotes?, tags?, refs?, except? } },
|
|
251
|
+
cancellation?)` counts what `rev` has that other refs don't, such as what deleting a branch would orphan.
|
|
252
|
+
`branches` / `remotes` / `tags` exclude a whole namespace, `refs` adds revisions verbatim, and `except` takes
|
|
253
|
+
full ref names back out of an excluded namespace. Core rewrites each `except` entry to the short form and
|
|
254
|
+
places it right before its own `--branches` / `--remotes` / `--tags`, because git matches `--exclude` against
|
|
255
|
+
the short name and applies it only to the next pseudo-ref option. The spelling that reads naturally,
|
|
256
|
+
`--exclude=refs/heads/x --branches`, excludes nothing. The GitHub provider returns `undefined` for an excluding
|
|
257
|
+
count, which its API cannot answer. A count is cached until a branch, remote-tracking branch or tag changes,
|
|
258
|
+
so a `refs` entry outside those namespaces (a tool's own `refs/<tool>/…`) can move without refreshing it;
|
|
259
|
+
pass its SHA instead, which keys a new read.
|
|
260
|
+
|
|
261
|
+
`commits.getLogShas` takes the same `excluding`, listing the SHAs instead of counting them; an omitted `rev` is
|
|
262
|
+
anchored to `HEAD` (a bare `--not` lists nothing), and the GitHub provider returns no SHAs.
|
|
263
|
+
|
|
264
|
+
**Breaking:** `getCommitCount` takes `options` before `cancellation`.
|
|
265
|
+
|
|
266
|
+
## 18. The empty tree in the repository's object format — added / fixed
|
|
267
|
+
|
|
268
|
+
The empty tree's id differs between SHA-1 and SHA-256 repositories, and core hardcoded the SHA-1 one as
|
|
269
|
+
`rootSha`, so every diff against a root commit's missing parent failed in a SHA-256 repository.
|
|
270
|
+
`revision.getEmptyTreeSha(repoPath)` computes it with `hash-object -t tree --stdin` (no `-w`; git knows the
|
|
271
|
+
empty tree without storing it), once per repository and shared across its worktrees. Every `rootSha` use now
|
|
272
|
+
goes through it, and `rootSha` is removed. GitHub repositories are always SHA-1.
|
|
273
|
+
|
|
274
|
+
**Breaking:** `rootSha` is removed from `@gitlens/git/models/revision`.
|
|
275
|
+
|
|
276
|
+
## 19. A link's clone of a large repository — fixed (GitLens)
|
|
277
|
+
|
|
278
|
+
Not a Kepler gap, found alongside §14: GitLens's deep-link clone ran under `gitlens.advanced.git.timeout` and
|
|
279
|
+
died partway through a large repository. It now runs uncapped, from a cancellable progress notification.
|
|
280
|
+
|
|
172
281
|
## Overlaps with existing APIs, and how each was settled
|
|
173
282
|
|
|
174
283
|
- **Refs containing a sha.** `branches.getBranchesWithCommits(repoPath, [sha], undefined, { all, mode })` and
|
|
@@ -184,6 +293,13 @@ is the fix when the consumer made the change; `force` is for a read that must be
|
|
|
184
293
|
compare-and-swap form for any namespace, and shares the branch cleanup with `deleteLocalBranch`.
|
|
185
294
|
- **Clearing caches.** `evictCaches` stays beside `clearCaches`: a write hard-evicts, a watcher clear keeps
|
|
186
295
|
sharing in-flight reads (see the decisions below).
|
|
296
|
+
- **Reflog reads.** `getReflogEntries` stays beside `commits.getIncomingActivity`, which walks `HEAD`'s reflog
|
|
297
|
+
for merges and pulls, pages, and aggregates; a message grep on it would change its paging. Core's private
|
|
298
|
+
reflog greps were folded into `getReflogEntries` rather than kept.
|
|
299
|
+
- **Dirty checks.** `getStatus({ untracked, branch: false })` stays beside `status.hasWorkingChanges`, which
|
|
300
|
+
answers yes/no with early exits; a caller counting files needs the list.
|
|
301
|
+
- **Unpushed commits.** `getCommitCount({ excluding })` stays beside `hasUnpublishedCommits` /
|
|
302
|
+
`filterUnpublishedShas`, which are early-exit probes against remotes alone and count nothing.
|
|
187
303
|
|
|
188
304
|
## Deferred, deliberately
|
|
189
305
|
|
|
@@ -191,10 +307,6 @@ is the fix when the consumer made the change; `force` is for a read that must be
|
|
|
191
307
|
`hash-object -w --stdin`, `cat-file -p`). The libraries drive these through `exec` with a scratch
|
|
192
308
|
`GIT_INDEX_FILE` and parse the results themselves; a typed surface would re-encode the same argv with more
|
|
193
309
|
room to drift. Revisit when a second consumer needs them.
|
|
194
|
-
- **A reflog read filtered by message.** Kepler reads `git reflog <branch> --grep-reflog='branch: Created from'`
|
|
195
|
-
to recover a branch's creation point. `getIncomingActivity` walks `HEAD`'s reflog for a different purpose;
|
|
196
|
-
bolting a grep onto it would change its paging. Worth its own method on `branches` once the base-branch
|
|
197
|
-
inference core already does privately is unified with it.
|
|
198
310
|
- **Generic `for-each-ref` with a caller-supplied format.** The `RefRecord` shape is private on purpose.
|
|
199
311
|
- **A typed `worktree remove` for every consumer.** Kept the raw form where a consumer classifies platform
|
|
200
312
|
failures from stderr; §3's `original` makes the typed form usable for that too.
|
|
@@ -228,12 +340,26 @@ core rejects with:
|
|
|
228
340
|
- A write hard-evicts while a watcher clear keeps sharing in-flight reads, rather than one policy for both. A
|
|
229
341
|
write is a known point after which an older read is wrong; a watcher tick has no such ordering, and sharing
|
|
230
342
|
the in-flight read is what keeps a burst of file events from multiplying git processes.
|
|
231
|
-
- `notifyChanged` on the provider
|
|
232
|
-
hooks
|
|
343
|
+
- `notifyChanged` on the provider, and `git.run({ notify })` bound to it rather than a second invalidation
|
|
344
|
+
path. The executor has no cache and no hooks, so the provider binds itself to its `Git` and a `notify` run
|
|
345
|
+
calls the same `notifyChanged`. `'infer'` classifies the argv (read-only and object-store-only commands
|
|
346
|
+
announce nothing; a `-C` write also announces to the caller's tree what every worktree sees), for a
|
|
347
|
+
consumer whose raw runs are too varied to name the changes by hand.
|
|
348
|
+
- Timeouts stay the caller's. No typed operation's default was lifted to "no timeout" for this round, even
|
|
349
|
+
for fetch or clone: GitLens passes its `gitlens.advanced.git.timeout` setting as core's default, and an
|
|
350
|
+
uncapped background fetch would hang with nothing to stop it. A caller that knows an operation is long
|
|
351
|
+
passes `timeout: 0` with a cancellation, as GitLens's deep-link clone now does.
|
|
352
|
+
- `except` takes full ref names and core converts them, rather than exposing git's short-form `--exclude`. The
|
|
353
|
+
short form is what every caller gets wrong, silently.
|
|
233
354
|
- Staging hooks skip the temporary-index case rather than firing unconditionally. A scratch index is not the
|
|
234
355
|
repository's; announcing an index change for it would invalidate status for nothing.
|
|
235
356
|
|
|
236
357
|
**Kepler-side follow-up**, once a core release carries these: serve sync-tools' `updateRef` op through
|
|
237
358
|
`updateReference` / `deleteReference` (mapping in §1), delete the review ref with `deleteReference`, drop the
|
|
238
|
-
verb classifier in `core-git-port.ts` in favour of `
|
|
239
|
-
|
|
359
|
+
verb classifier in `core-git-port.ts` in favour of `git.run({ notify: 'infer' })`, and drop its interim
|
|
360
|
+
environment scrub (§10). Then move the second round's raw sites onto their typed forms: credential fetches onto
|
|
361
|
+
`fetch({ remote, refspecs, preserveFetchHead: true })` (§13), the clone onto `clone(..., { folderName }, { env,
|
|
362
|
+
timeout: 0 })` (§14), the porcelain count onto `getStatus({ untracked: 'normal', branch: false, force: true })`
|
|
363
|
+
(§15), the creation probe onto `getReflogEntries` (§16), the unpushed count onto `getCommitCount({ excluding })`
|
|
364
|
+
(§17, which also fixes its always-zero `--exclude`), and the object-format probe onto `getEmptyTreeSha` (§18).
|
|
365
|
+
Then retire the remaining `TODO(core-gitlens)` residuals.
|
package/package.json
CHANGED