@statewalker/vcs-commands 0.9.0 → 0.11.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/README.md +1 -1
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-backend.d.ts +2 -0
- package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-modes.d.ts +6 -2
- package/dist/commands/add-patch/patch-modes.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-session.d.ts +4 -0
- package/dist/commands/add-patch/patch-session.d.ts.map +1 -1
- package/dist/commands/am/am-command.d.ts +41 -2
- package/dist/commands/am/am-command.d.ts.map +1 -1
- package/dist/commands/apply/index.d.ts +1 -1
- package/dist/commands/apply/index.d.ts.map +1 -1
- package/dist/commands/archive/archive-command.d.ts +169 -0
- package/dist/commands/archive/archive-command.d.ts.map +1 -0
- package/dist/commands/archive/archive-entry.d.ts +60 -0
- package/dist/commands/archive/archive-entry.d.ts.map +1 -0
- package/dist/commands/archive/index.d.ts +8 -0
- package/dist/commands/archive/index.d.ts.map +1 -0
- package/dist/commands/archive/remote-archive-command.d.ts +56 -0
- package/dist/commands/archive/remote-archive-command.d.ts.map +1 -0
- package/dist/commands/archive/tar-archive.d.ts +31 -0
- package/dist/commands/archive/tar-archive.d.ts.map +1 -0
- package/dist/commands/archive/tar-commit-id.d.ts +13 -0
- package/dist/commands/archive/tar-commit-id.d.ts.map +1 -0
- package/dist/commands/archive/upload-archive-writer.d.ts +48 -0
- package/dist/commands/archive/upload-archive-writer.d.ts.map +1 -0
- package/dist/commands/archive/zip-archive.d.ts +42 -0
- package/dist/commands/archive/zip-archive.d.ts.map +1 -0
- package/dist/commands/attributes-source.d.ts +10 -0
- package/dist/commands/attributes-source.d.ts.map +1 -1
- package/dist/commands/blame-command.d.ts +43 -1
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/bundle/bundle-create-command.d.ts +67 -0
- package/dist/commands/bundle/bundle-create-command.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-format.d.ts +89 -0
- package/dist/commands/bundle/bundle-format.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-list.d.ts +92 -0
- package/dist/commands/bundle/bundle-list.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-read-commands.d.ts +81 -0
- package/dist/commands/bundle/bundle-read-commands.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-support.d.ts +32 -0
- package/dist/commands/bundle/bundle-support.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-transport.d.ts +38 -0
- package/dist/commands/bundle/bundle-transport.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-uri-host.d.ts +43 -0
- package/dist/commands/bundle/bundle-uri-host.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-uri.d.ts +55 -0
- package/dist/commands/bundle/bundle-uri.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-verify.d.ts +63 -0
- package/dist/commands/bundle/bundle-verify.d.ts.map +1 -0
- package/dist/commands/bundle/index.d.ts +14 -0
- package/dist/commands/bundle/index.d.ts.map +1 -0
- package/dist/commands/cat-file/batch-format.d.ts +58 -0
- package/dist/commands/cat-file/batch-format.d.ts.map +1 -0
- package/dist/commands/cat-file/cat-file-command.d.ts +144 -0
- package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -0
- package/dist/commands/cat-file/index.d.ts +3 -0
- package/dist/commands/cat-file/index.d.ts.map +1 -0
- package/dist/commands/check-attr-command.d.ts +66 -0
- package/dist/commands/check-attr-command.d.ts.map +1 -0
- package/dist/commands/check-ignore-command.d.ts +58 -0
- package/dist/commands/check-ignore-command.d.ts.map +1 -0
- package/dist/commands/check-ref-format-command.d.ts +60 -0
- package/dist/commands/check-ref-format-command.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/checkout-index-command.d.ts +96 -0
- package/dist/commands/checkout-index-command.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +10 -0
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts +28 -0
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +9 -1
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/config-command.d.ts +2 -0
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/daemon-access-hook.d.ts +36 -0
- package/dist/commands/daemon-access-hook.d.ts.map +1 -0
- package/dist/commands/default-branch.d.ts +54 -0
- package/dist/commands/default-branch.d.ts.map +1 -1
- package/dist/commands/diff-command.d.ts +132 -5
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/diff-external.d.ts +43 -0
- package/dist/commands/diff-external.d.ts.map +1 -0
- package/dist/commands/diff-plumbing/diff-pairs-command.d.ts +27 -0
- package/dist/commands/diff-plumbing/diff-pairs-command.d.ts.map +1 -0
- package/dist/commands/diff-plumbing/diff-plumbing-command.d.ts +129 -0
- package/dist/commands/diff-plumbing/diff-plumbing-command.d.ts.map +1 -0
- package/dist/commands/diff-plumbing/index.d.ts +3 -0
- package/dist/commands/diff-plumbing/index.d.ts.map +1 -0
- package/dist/commands/diff-textconv.d.ts +5 -1
- package/dist/commands/diff-textconv.d.ts.map +1 -1
- package/dist/commands/fast-export/fast-export-command.d.ts +135 -0
- package/dist/commands/fast-export/fast-export-command.d.ts.map +1 -0
- package/dist/commands/fast-export/fast-import-command.d.ts +182 -0
- package/dist/commands/fast-export/fast-import-command.d.ts.map +1 -0
- package/dist/commands/fast-export/fast-stream-support.d.ts +64 -0
- package/dist/commands/fast-export/fast-stream-support.d.ts.map +1 -0
- package/dist/commands/fast-export/index.d.ts +4 -0
- package/dist/commands/fast-export/index.d.ts.map +1 -0
- package/dist/commands/fetch-command.d.ts +65 -0
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/fetch-multiple-command.d.ts.map +1 -1
- package/dist/commands/format-rev-command.d.ts +60 -0
- package/dist/commands/format-rev-command.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-command.d.ts.map +1 -1
- package/dist/commands/fsck/fsck-msg-ids.d.ts +18 -3
- package/dist/commands/fsck/fsck-msg-ids.d.ts.map +1 -1
- package/dist/commands/fsmonitor-ipc.d.ts +30 -0
- package/dist/commands/fsmonitor-ipc.d.ts.map +1 -0
- package/dist/commands/fsmonitor-refresh.d.ts +69 -0
- package/dist/commands/fsmonitor-refresh.d.ts.map +1 -0
- package/dist/commands/gc-command.d.ts +5 -0
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +32 -0
- package/dist/commands/git-hooks.d.ts.map +1 -1
- package/dist/commands/git-paths.d.ts +26 -0
- package/dist/commands/git-paths.d.ts.map +1 -0
- package/dist/commands/grep/grep-command.d.ts +2 -1
- package/dist/commands/grep/grep-command.d.ts.map +1 -1
- package/dist/commands/history-command.d.ts +156 -0
- package/dist/commands/history-command.d.ts.map +1 -0
- package/dist/commands/http-config.d.ts +38 -0
- package/dist/commands/http-config.d.ts.map +1 -0
- package/dist/commands/index-adder.d.ts +12 -1
- package/dist/commands/index-adder.d.ts.map +1 -1
- package/dist/commands/index-host.d.ts.map +1 -1
- package/dist/commands/index.d.ts +45 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +6 -5
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/last-modified-command.d.ts +102 -0
- package/dist/commands/last-modified-command.d.ts.map +1 -0
- package/dist/commands/lfs/go-url.d.ts +43 -0
- package/dist/commands/lfs/go-url.d.ts.map +1 -0
- package/dist/commands/lfs/index.d.ts +3 -0
- package/dist/commands/lfs/index.d.ts.map +1 -0
- package/dist/commands/lfs/lfs-config.d.ts +174 -0
- package/dist/commands/lfs/lfs-config.d.ts.map +1 -0
- package/dist/commands/lfs/lfs-endpoint-command.d.ts +83 -0
- package/dist/commands/lfs/lfs-endpoint-command.d.ts.map +1 -0
- package/dist/commands/local-transport.d.ts.map +1 -1
- package/dist/commands/log-command.d.ts +26 -0
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +28 -1
- package/dist/commands/log-output.d.ts.map +1 -1
- package/dist/commands/ls-files-command.d.ts +153 -0
- package/dist/commands/ls-files-command.d.ts.map +1 -0
- package/dist/commands/ls-remote-command.d.ts +5 -0
- package/dist/commands/ls-remote-command.d.ts.map +1 -1
- package/dist/commands/ls-tree-command.d.ts +105 -0
- package/dist/commands/ls-tree-command.d.ts.map +1 -0
- package/dist/commands/maintenance-run-command.d.ts +122 -0
- package/dist/commands/maintenance-run-command.d.ts.map +1 -0
- package/dist/commands/merge-command.d.ts +7 -0
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-config.d.ts +7 -0
- package/dist/commands/merge-config.d.ts.map +1 -1
- package/dist/commands/merge-drivers.d.ts +67 -5
- package/dist/commands/merge-drivers.d.ts.map +1 -1
- package/dist/commands/merge-support.d.ts +6 -0
- package/dist/commands/merge-support.d.ts.map +1 -1
- package/dist/commands/merge-tree-command.d.ts +122 -0
- package/dist/commands/merge-tree-command.d.ts.map +1 -0
- package/dist/commands/mktag-command.d.ts +51 -0
- package/dist/commands/mktag-command.d.ts.map +1 -0
- package/dist/commands/object-store/count-objects-command.d.ts +58 -0
- package/dist/commands/object-store/count-objects-command.d.ts.map +1 -0
- package/dist/commands/object-store/index.d.ts +5 -0
- package/dist/commands/object-store/index.d.ts.map +1 -0
- package/dist/commands/object-store/objects-directory.d.ts +12 -0
- package/dist/commands/object-store/objects-directory.d.ts.map +1 -0
- package/dist/commands/object-store/prune-command.d.ts +38 -0
- package/dist/commands/object-store/prune-command.d.ts.map +1 -0
- package/dist/commands/object-store/show-index-command.d.ts +23 -0
- package/dist/commands/object-store/show-index-command.d.ts.map +1 -0
- package/dist/commands/ort-merge.d.ts +24 -0
- package/dist/commands/ort-merge.d.ts.map +1 -1
- package/dist/commands/patch-id-command.d.ts +30 -0
- package/dist/commands/patch-id-command.d.ts.map +1 -0
- package/dist/commands/patch-id.d.ts +24 -0
- package/dist/commands/patch-id.d.ts.map +1 -1
- package/dist/commands/plumbing-command.d.ts +66 -0
- package/dist/commands/plumbing-command.d.ts.map +1 -0
- package/dist/commands/plumbing-input.d.ts +38 -0
- package/dist/commands/plumbing-input.d.ts.map +1 -0
- package/dist/commands/promisor-remote-reply.d.ts +35 -0
- package/dist/commands/promisor-remote-reply.d.ts.map +1 -0
- package/dist/commands/promisor-remote.d.ts.map +1 -1
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +17 -2
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +108 -2
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/refs-command.d.ts +81 -0
- package/dist/commands/refs-command.d.ts.map +1 -0
- package/dist/commands/remote-object-info-command.d.ts +55 -0
- package/dist/commands/remote-object-info-command.d.ts.map +1 -0
- package/dist/commands/remote-transport.d.ts +40 -3
- package/dist/commands/remote-transport.d.ts.map +1 -1
- package/dist/commands/repack-command.d.ts +115 -0
- package/dist/commands/repack-command.d.ts.map +1 -0
- package/dist/commands/replace-command.d.ts +143 -0
- package/dist/commands/replace-command.d.ts.map +1 -0
- package/dist/commands/replay-command.d.ts +117 -0
- package/dist/commands/replay-command.d.ts.map +1 -0
- package/dist/commands/repo-command.d.ts +158 -0
- package/dist/commands/repo-command.d.ts.map +1 -0
- package/dist/commands/request-pull-command.d.ts +82 -0
- package/dist/commands/request-pull-command.d.ts.map +1 -0
- package/dist/commands/rerere-command.d.ts +36 -0
- package/dist/commands/rerere-command.d.ts.map +1 -0
- package/dist/commands/rerere.d.ts +102 -0
- package/dist/commands/rerere.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +19 -2
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/rev-filter/commit-grep.d.ts +3 -1
- package/dist/commands/rev-filter/commit-grep.d.ts.map +1 -1
- package/dist/commands/rev-list-command.d.ts +3 -0
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/rev-parse-command.d.ts +5 -0
- package/dist/commands/rev-parse-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +10 -0
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +5 -0
- package/dist/commands/revision-range.d.ts.map +1 -1
- package/dist/commands/revision-resolver.d.ts +27 -1
- package/dist/commands/revision-resolver.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +18 -0
- package/dist/commands/sequencer-pick.d.ts.map +1 -1
- package/dist/commands/serve-repository.d.ts +23 -1
- package/dist/commands/serve-repository.d.ts.map +1 -1
- package/dist/commands/session-id.d.ts +18 -0
- package/dist/commands/session-id.d.ts.map +1 -0
- package/dist/commands/show-branch-command.d.ts +59 -0
- package/dist/commands/show-branch-command.d.ts.map +1 -0
- package/dist/commands/show-ref-command.d.ts +112 -0
- package/dist/commands/show-ref-command.d.ts.map +1 -0
- package/dist/commands/signature-check.d.ts +9 -2
- package/dist/commands/signature-check.d.ts.map +1 -1
- package/dist/commands/signing.d.ts +30 -2
- package/dist/commands/signing.d.ts.map +1 -1
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-export-command.d.ts +115 -0
- package/dist/commands/stash-export-command.d.ts.map +1 -0
- package/dist/commands/status-command.d.ts +16 -2
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/stripspace-command.d.ts +44 -0
- package/dist/commands/stripspace-command.d.ts.map +1 -0
- package/dist/commands/submodule-add-command.d.ts +22 -1
- package/dist/commands/submodule-add-command.d.ts.map +1 -1
- package/dist/commands/submodule-auth.d.ts +3 -1
- package/dist/commands/submodule-auth.d.ts.map +1 -1
- package/dist/commands/submodule-commands.d.ts +9 -1
- package/dist/commands/submodule-commands.d.ts.map +1 -1
- package/dist/commands/submodule-update-command.d.ts +27 -1
- package/dist/commands/submodule-update-command.d.ts.map +1 -1
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/textconv-cache.d.ts +58 -0
- package/dist/commands/textconv-cache.d.ts.map +1 -0
- package/dist/commands/tree-restore.d.ts +5 -0
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/unpack-objects-command.d.ts +47 -0
- package/dist/commands/unpack-objects-command.d.ts.map +1 -0
- package/dist/commands/update-index-command.d.ts +131 -0
- package/dist/commands/update-index-command.d.ts.map +1 -0
- package/dist/commands/uri-protocols.d.ts +13 -0
- package/dist/commands/uri-protocols.d.ts.map +1 -0
- package/dist/commands/url-parse-command.d.ts +30 -0
- package/dist/commands/url-parse-command.d.ts.map +1 -0
- package/dist/commands/var-command.d.ts +42 -0
- package/dist/commands/var-command.d.ts.map +1 -0
- package/dist/{commands-CNvli5bl.js → commands-bQQ9OmCh.js} +52514 -44630
- package/dist/errors/command-errors.d.ts +33 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/index.js +39 -1
- package/dist/{fsck-CPeDh9fh.js → fsck-BHT9bUS-.js} +184 -143
- package/dist/git-command.d.ts +66 -4
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +532 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/guarded-transport-command.d.ts +3 -1
- package/dist/guarded-transport-command.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/maintenance-run-command-Cx2PlGV9.js +13544 -0
- package/dist/{remote-transport-CCmBadm-.js → remote-transport-BrQZfyHu.js} +1009 -10
- package/dist/results/cherry-pick-result.d.ts +6 -0
- package/dist/results/cherry-pick-result.d.ts.map +1 -1
- package/dist/results/diff-entry.d.ts +10 -0
- package/dist/results/diff-entry.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/diff-output.d.ts +49 -3
- package/dist/results/diff-output.d.ts.map +1 -1
- package/dist/results/fetch-result.d.ts +12 -0
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.js +2 -2
- package/dist/results/merge-result.d.ts +5 -0
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +5 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/rebase-result.d.ts +7 -0
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/revert-result.d.ts +6 -0
- package/dist/results/revert-result.d.ts.map +1 -1
- package/dist/results/stash-result.d.ts +5 -0
- package/dist/results/stash-result.d.ts.map +1 -1
- package/dist/{results-BDuEgdLU.js → results-CNHQnU5Y.js} +13707 -10608
- package/dist/transport-command.d.ts +79 -1
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/commands/add-command.ts +3 -0
- package/src/commands/add-patch/patch-backend.ts +4 -1
- package/src/commands/add-patch/patch-modes.ts +26 -2
- package/src/commands/add-patch/patch-session.ts +6 -0
- package/src/commands/am/am-command.ts +193 -22
- package/src/commands/apply/index.ts +1 -0
- package/src/commands/archive/archive-command.ts +1148 -0
- package/src/commands/archive/archive-entry.ts +93 -0
- package/src/commands/archive/index.ts +7 -0
- package/src/commands/archive/remote-archive-command.ts +140 -0
- package/src/commands/archive/tar-archive.ts +207 -0
- package/src/commands/archive/tar-commit-id.ts +72 -0
- package/src/commands/archive/upload-archive-writer.ts +213 -0
- package/src/commands/archive/zip-archive.ts +317 -0
- package/src/commands/attributes-source.ts +26 -12
- package/src/commands/blame-command.ts +118 -19
- package/src/commands/bundle/bundle-create-command.ts +405 -0
- package/src/commands/bundle/bundle-format.ts +228 -0
- package/src/commands/bundle/bundle-list.ts +276 -0
- package/src/commands/bundle/bundle-read-commands.ts +157 -0
- package/src/commands/bundle/bundle-support.ts +85 -0
- package/src/commands/bundle/bundle-transport.ts +107 -0
- package/src/commands/bundle/bundle-uri-host.ts +204 -0
- package/src/commands/bundle/bundle-uri.ts +236 -0
- package/src/commands/bundle/bundle-verify.ts +152 -0
- package/src/commands/bundle/index.ts +14 -0
- package/src/commands/cat-file/batch-format.ts +193 -0
- package/src/commands/cat-file/cat-file-command.ts +895 -0
- package/src/commands/cat-file/index.ts +2 -0
- package/src/commands/check-attr-command.ts +333 -0
- package/src/commands/check-ignore-command.ts +261 -0
- package/src/commands/check-ref-format-command.ts +129 -0
- package/src/commands/checkout-command.ts +61 -22
- package/src/commands/checkout-index-command.ts +568 -0
- package/src/commands/checkout-paths.ts +7 -0
- package/src/commands/cherry-pick-command.ts +21 -1
- package/src/commands/clone-command.ts +249 -9
- package/src/commands/commit-command.ts +22 -4
- package/src/commands/config-command.ts +9 -0
- package/src/commands/daemon-access-hook.ts +78 -0
- package/src/commands/default-branch.ts +118 -1
- package/src/commands/diff-command.ts +592 -47
- package/src/commands/diff-external.ts +131 -0
- package/src/commands/diff-plumbing/diff-pairs-command.ts +193 -0
- package/src/commands/diff-plumbing/diff-plumbing-command.ts +424 -0
- package/src/commands/diff-plumbing/index.ts +2 -0
- package/src/commands/diff-textconv.ts +5 -1
- package/src/commands/fast-export/fast-export-command.ts +911 -0
- package/src/commands/fast-export/fast-import-command.ts +1553 -0
- package/src/commands/fast-export/fast-stream-support.ts +162 -0
- package/src/commands/fast-export/index.ts +3 -0
- package/src/commands/fetch-command.ts +312 -8
- package/src/commands/fetch-multiple-command.ts +4 -1
- package/src/commands/format-rev-command.ts +267 -0
- package/src/commands/fsck/fsck-command.ts +47 -20
- package/src/commands/fsck/fsck-msg-ids.ts +19 -3
- package/src/commands/fsck/fsck-pack.ts +2 -2
- package/src/commands/fsmonitor-ipc.ts +121 -0
- package/src/commands/fsmonitor-refresh.ts +320 -0
- package/src/commands/gc-command.ts +10 -0
- package/src/commands/git-hooks.ts +123 -6
- package/src/commands/git-paths.ts +136 -0
- package/src/commands/grep/grep-command.ts +38 -15
- package/src/commands/history-command.ts +617 -0
- package/src/commands/http-config.ts +139 -0
- package/src/commands/index-adder.ts +37 -3
- package/src/commands/index-host.ts +6 -1
- package/src/commands/index.ts +46 -0
- package/src/commands/init-command.ts +14 -0
- package/src/commands/last-modified-command.ts +804 -0
- package/src/commands/lfs/go-url.ts +370 -0
- package/src/commands/lfs/index.ts +2 -0
- package/src/commands/lfs/lfs-config.ts +738 -0
- package/src/commands/lfs/lfs-endpoint-command.ts +180 -0
- package/src/commands/local-transport.ts +252 -4
- package/src/commands/log-command.ts +104 -5
- package/src/commands/log-output.ts +66 -5
- package/src/commands/ls-files-command.ts +1177 -0
- package/src/commands/ls-remote-command.ts +6 -0
- package/src/commands/ls-tree-command.ts +708 -0
- package/src/commands/maintenance-run-command.ts +949 -0
- package/src/commands/merge-command.ts +78 -32
- package/src/commands/merge-config.ts +23 -1
- package/src/commands/merge-drivers.ts +109 -20
- package/src/commands/merge-support.ts +29 -5
- package/src/commands/merge-tree-command.ts +786 -0
- package/src/commands/mktag-command.ts +149 -0
- package/src/commands/object-store/count-objects-command.ts +404 -0
- package/src/commands/object-store/index.ts +4 -0
- package/src/commands/object-store/objects-directory.ts +24 -0
- package/src/commands/object-store/prune-command.ts +129 -0
- package/src/commands/object-store/show-index-command.ts +151 -0
- package/src/commands/ort-merge.ts +92 -25
- package/src/commands/patch-id-command.ts +65 -0
- package/src/commands/patch-id.ts +218 -0
- package/src/commands/plumbing-command.ts +141 -0
- package/src/commands/plumbing-input.ts +87 -0
- package/src/commands/promisor-remote-reply.ts +276 -0
- package/src/commands/promisor-remote.ts +25 -2
- package/src/commands/pull-command.ts +2 -0
- package/src/commands/push-command.ts +87 -5
- package/src/commands/rebase-command.ts +507 -19
- package/src/commands/refs-command.ts +274 -0
- package/src/commands/remote-object-info-command.ts +109 -0
- package/src/commands/remote-transport.ts +116 -1
- package/src/commands/repack-command.ts +383 -0
- package/src/commands/replace-command.ts +816 -0
- package/src/commands/replay-command.ts +674 -0
- package/src/commands/repo-command.ts +1066 -0
- package/src/commands/request-pull-command.ts +356 -0
- package/src/commands/rerere-command.ts +179 -0
- package/src/commands/rerere.ts +925 -0
- package/src/commands/reset-command.ts +75 -3
- package/src/commands/rev-filter/commit-grep.ts +7 -2
- package/src/commands/rev-list-command.ts +9 -0
- package/src/commands/rev-parse-command.ts +49 -5
- package/src/commands/revert-command.ts +21 -1
- package/src/commands/revision-range.ts +7 -2
- package/src/commands/revision-resolver.ts +97 -14
- package/src/commands/sequencer-pick.ts +47 -0
- package/src/commands/serve-repository.ts +65 -0
- package/src/commands/session-id.ts +31 -0
- package/src/commands/show-branch-command.ts +981 -0
- package/src/commands/show-command.ts +1 -1
- package/src/commands/show-ref-command.ts +439 -0
- package/src/commands/signature-check.ts +37 -5
- package/src/commands/signing.ts +176 -23
- package/src/commands/stash-apply-command.ts +3 -0
- package/src/commands/stash-export-command.ts +397 -0
- package/src/commands/status-command.ts +74 -8
- package/src/commands/stripspace-command.ts +118 -0
- package/src/commands/submodule-add-command.ts +40 -2
- package/src/commands/submodule-auth.ts +61 -6
- package/src/commands/submodule-commands.ts +12 -2
- package/src/commands/submodule-update-command.ts +47 -1
- package/src/commands/tag-command.ts +33 -11
- package/src/commands/textconv-cache.ts +143 -0
- package/src/commands/tree-restore.ts +14 -0
- package/src/commands/unpack-objects-command.ts +235 -0
- package/src/commands/update-index-command.ts +1148 -0
- package/src/commands/uri-protocols.ts +13 -0
- package/src/commands/url-parse-command.ts +67 -0
- package/src/commands/var-command.ts +219 -0
- package/src/errors/command-errors.ts +45 -0
- package/src/git-command.ts +177 -3
- package/src/git.ts +808 -1
- package/src/guarded-transport-command.ts +6 -1
- package/src/results/cherry-pick-result.ts +6 -0
- package/src/results/diff-entry.ts +12 -0
- package/src/results/diff-formatter.ts +7 -4
- package/src/results/diff-output.ts +117 -11
- package/src/results/diff-pickaxe.ts +1 -1
- package/src/results/fetch-result.ts +12 -0
- package/src/results/merge-result.ts +5 -0
- package/src/results/push-result.ts +5 -0
- package/src/results/rebase-result.ts +7 -0
- package/src/results/revert-result.ts +6 -0
- package/src/results/stash-result.ts +6 -0
- package/src/transport-command.ts +182 -1
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { compareGitPaths, decodeGitPath, encodeGitPath } from "@statewalker/vcs-utils/encoding";
|
|
16
16
|
import {
|
|
17
17
|
type AttributesIndex,
|
|
18
|
+
basicStatMatches,
|
|
18
19
|
collectChunks,
|
|
19
20
|
compareWithWorktree,
|
|
20
21
|
expandUserPath,
|
|
@@ -67,12 +68,15 @@ import {
|
|
|
67
68
|
type DiffDriver,
|
|
68
69
|
type DiffFilePair,
|
|
69
70
|
type DiffOutputOptions,
|
|
71
|
+
type DiffSideSpec,
|
|
70
72
|
type DiffstatFile,
|
|
71
73
|
type DiffstatOptions,
|
|
72
74
|
diffDriverOf,
|
|
75
|
+
externalDiffMetainfo,
|
|
73
76
|
formatNameOnly,
|
|
74
77
|
formatNameStatus,
|
|
75
78
|
formatNumstat,
|
|
79
|
+
formatRawPair,
|
|
76
80
|
formatShortstat,
|
|
77
81
|
formatStat,
|
|
78
82
|
formatSummary,
|
|
@@ -95,8 +99,20 @@ import {
|
|
|
95
99
|
readDiffColorSettings,
|
|
96
100
|
whitespaceRuleError,
|
|
97
101
|
} from "./diff-color-config.js";
|
|
98
|
-
import {
|
|
99
|
-
|
|
102
|
+
import {
|
|
103
|
+
ExternalDiffDiedError,
|
|
104
|
+
type ExternalDiffProgram,
|
|
105
|
+
ExternalDiffTempFiles,
|
|
106
|
+
externalDiffProgramOf,
|
|
107
|
+
} from "./diff-external.js";
|
|
108
|
+
import { type TextconvRequest, type TextconvRunner, textconvRunnerOf } from "./diff-textconv.js";
|
|
109
|
+
import {
|
|
110
|
+
DO_MATCH_DIRECTORY,
|
|
111
|
+
DO_MATCH_LEADING_PATHSPEC,
|
|
112
|
+
matchPathspec,
|
|
113
|
+
type PathspecItem,
|
|
114
|
+
parsePathspecItem,
|
|
115
|
+
} from "./pathspec.js";
|
|
100
116
|
import { PathspecAttributes } from "./pathspec-attributes.js";
|
|
101
117
|
import { revisionMergeBases } from "./rev-parse-command.js";
|
|
102
118
|
import { readSubmoduleDirt, type SubmoduleDirt } from "./status-command.js";
|
|
@@ -112,6 +128,7 @@ import {
|
|
|
112
128
|
showSubmoduleDiffSummary,
|
|
113
129
|
submoduleHeader,
|
|
114
130
|
} from "./submodule-summary.js";
|
|
131
|
+
import { TextconvCaches } from "./textconv-cache.js";
|
|
115
132
|
|
|
116
133
|
/** An index without in-tree attributes files: the attribute stack of a diff of two trees. */
|
|
117
134
|
const WITHOUT_INDEX_ATTRIBUTES: { direction: "checkin"; index: AttributesIndex } = {
|
|
@@ -152,6 +169,11 @@ function prefetchIds(entries: readonly DiffEntry[]): ObjectId[] {
|
|
|
152
169
|
}
|
|
153
170
|
|
|
154
171
|
export type DiffOutputFormat =
|
|
172
|
+
/**
|
|
173
|
+
* `--raw` (diff.c's `diff_flush_raw`): `:<old mode> <new mode> <old id> <new id> <status>`,
|
|
174
|
+
* a tab and the path(s); ids abbreviated unless {@link DiffTextOptions.rawFullIds}
|
|
175
|
+
*/
|
|
176
|
+
| "raw"
|
|
155
177
|
| "patch"
|
|
156
178
|
| "stat"
|
|
157
179
|
| "numstat"
|
|
@@ -208,6 +230,16 @@ export interface DiffTextOptions
|
|
|
208
230
|
abbrev?: number;
|
|
209
231
|
/** `--stat=...` widths (default width 80, as git without a terminal) */
|
|
210
232
|
stat?: DiffstatOptions;
|
|
233
|
+
/**
|
|
234
|
+
* `-z`: the `raw`, `name-only`, `name-status` and `numstat` outputs end each field with a
|
|
235
|
+
* NUL instead of a tab or a newline, paths unquoted; the separator before a patch is a NUL
|
|
236
|
+
*/
|
|
237
|
+
nullTerminated?: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* The `raw` output's ids in full, as the plumbing commands print them (`opt->abbrev = 0`)
|
|
240
|
+
* unless `--abbrev` is given ({@link abbrev}); default false (`git diff --raw` abbreviates)
|
|
241
|
+
*/
|
|
242
|
+
rawFullIds?: boolean;
|
|
211
243
|
/**
|
|
212
244
|
* Score renames counting a last line without a newline, as git 2.50 and later (default
|
|
213
245
|
* true); false scores them as older git
|
|
@@ -260,6 +292,15 @@ export interface DiffTextOptions
|
|
|
260
292
|
* `installTextconvRunner`, without one no textconv applies
|
|
261
293
|
*/
|
|
262
294
|
textconv?: boolean;
|
|
295
|
+
/**
|
|
296
|
+
* `--ext-diff` / `--no-ext-diff`: run external diff programs (`GIT_EXTERNAL_DIFF`,
|
|
297
|
+
* `diff.external`, `diff.<driver>.command`) instead of the builtin patch. Default false;
|
|
298
|
+
* `Git.diff()` (porcelain `git diff`) turns it on, as git, while `git log`/`show` and the
|
|
299
|
+
* plumbing diffs need it asked. The programs run through the host's `hookRunner`, their
|
|
300
|
+
* sides written in its `tempDirectory` through `hostFilesOf`; without those the builtin
|
|
301
|
+
* patch is shown. See `diff-external.ts`.
|
|
302
|
+
*/
|
|
303
|
+
extDiff?: boolean;
|
|
263
304
|
/**
|
|
264
305
|
* `-R`: the two sides swapped (an addition shows as a deletion, the new side first), their
|
|
265
306
|
* prefixes with them (`diff --git b/f a/f`). Combined diffs of conflicted paths are not swapped.
|
|
@@ -524,6 +565,8 @@ function reverseEntry(entry: DiffEntry): DiffEntry {
|
|
|
524
565
|
if (entry.readOld) out.readNew = entry.readOld;
|
|
525
566
|
if (entry.score !== undefined) out.score = entry.score;
|
|
526
567
|
if (entry.lineRanges) out.lineRanges = entry.lineRanges;
|
|
568
|
+
if (entry.newIdNull || entry.newIdUnknown) out.oldIdNull = true;
|
|
569
|
+
if (entry.oldIdNull) out.newIdNull = true;
|
|
527
570
|
return out;
|
|
528
571
|
}
|
|
529
572
|
|
|
@@ -557,6 +600,25 @@ interface Side {
|
|
|
557
600
|
* side holds (`show_modified`), and no exact rename pairs with it.
|
|
558
601
|
*/
|
|
559
602
|
unknownId?: boolean;
|
|
603
|
+
/**
|
|
604
|
+
* Plumbing (`diff-files`, `diff-index`): a file whose stat differs from its entry, which
|
|
605
|
+
* git takes as changed without hashing it (`ie_match_stat`): its raw id is the null id
|
|
606
|
+
*/
|
|
607
|
+
rawNull?: boolean;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** What {@link DiffCommand.setQueue} runs over a queue given */
|
|
611
|
+
export interface PresetQueueOptions {
|
|
612
|
+
/**
|
|
613
|
+
* Run diffcore's rename and break detection over it as over a comparison's queue
|
|
614
|
+
* (`diffcore_std`), with `-M`/`-C`/`-B` as the text options give them (no `diff.renames`)
|
|
615
|
+
*/
|
|
616
|
+
diffcore?: boolean;
|
|
617
|
+
/**
|
|
618
|
+
* `--find-copies-harder`'s sources besides the queue's: every file of the old side (the
|
|
619
|
+
* old tree, the index of `diff-files`)
|
|
620
|
+
*/
|
|
621
|
+
copySources?: () => Promise<Map<string, { mode: number; id: ObjectId }>>;
|
|
560
622
|
}
|
|
561
623
|
|
|
562
624
|
/** diffcore's settings of one run (see `DiffCommand.diffcoreSettings`) */
|
|
@@ -593,6 +655,9 @@ function submoduleIgnoreValue(
|
|
|
593
655
|
|
|
594
656
|
const S_IFMT = 0o170000;
|
|
595
657
|
const GITLINK = 0o160000;
|
|
658
|
+
const SYMLINK = 0o120000;
|
|
659
|
+
/** A mode as git's `%06o` prints it */
|
|
660
|
+
const octal6 = (mode: number) => mode.toString(8).padStart(6, "0");
|
|
596
661
|
const encoder = new TextEncoder();
|
|
597
662
|
|
|
598
663
|
/** The chunks as one array. */
|
|
@@ -756,6 +821,10 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
756
821
|
private changesFound = false;
|
|
757
822
|
/** git's `check_failed`: `--check` found an error in the last call */
|
|
758
823
|
private checkFailed = false;
|
|
824
|
+
/** git's `diff_path_counter`: the external diff calls made so far */
|
|
825
|
+
private externalCounter = 0;
|
|
826
|
+
/** What external diff programs wrote on stderr in the last call */
|
|
827
|
+
private externalStderr: Uint8Array[] = [];
|
|
759
828
|
/** The revisions given resolved (ranges, `--merge-base`) */
|
|
760
829
|
private sidesResolved = false;
|
|
761
830
|
/** The compiled pickaxe (`-S`, `-G`, `--find-object`), once the options are checked */
|
|
@@ -944,6 +1013,18 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
944
1013
|
return this.configWarnings;
|
|
945
1014
|
}
|
|
946
1015
|
|
|
1016
|
+
/** What the external diff programs of the last call wrote on stderr (git passes it through) */
|
|
1017
|
+
get programStderr(): Uint8Array {
|
|
1018
|
+
const total = this.externalStderr.reduce((n, c) => n + c.length, 0);
|
|
1019
|
+
const out = new Uint8Array(total);
|
|
1020
|
+
let at = 0;
|
|
1021
|
+
for (const chunk of this.externalStderr) {
|
|
1022
|
+
out.set(chunk, at);
|
|
1023
|
+
at += chunk.length;
|
|
1024
|
+
}
|
|
1025
|
+
return out;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
947
1028
|
/**
|
|
948
1029
|
* git_diff_ui_config, which `git diff` (and log, show) runs before any option is read:
|
|
949
1030
|
* `diff.submodule`, its warnings, and the failure of a variable without a value.
|
|
@@ -1114,13 +1195,70 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1114
1195
|
*
|
|
1115
1196
|
* @internal
|
|
1116
1197
|
*/
|
|
1117
|
-
setQueue(entries: DiffEntry[]): this {
|
|
1198
|
+
setQueue(entries: DiffEntry[], options: PresetQueueOptions = {}): this {
|
|
1118
1199
|
this.checkCallable();
|
|
1119
1200
|
this.presetQueue = entries;
|
|
1201
|
+
this.presetQueueOptions = options;
|
|
1120
1202
|
return this;
|
|
1121
1203
|
}
|
|
1122
1204
|
|
|
1123
1205
|
private presetQueue?: DiffEntry[];
|
|
1206
|
+
private presetQueueOptions: PresetQueueOptions = {};
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* How a comparison of trees walks them (tree-diff.c): `recursive` lists the blobs below the
|
|
1210
|
+
* subtrees that differ (`-r`, the porcelain's default), `flat` the differing entries of the
|
|
1211
|
+
* top tree, subtrees as entries of mode 040000 (plumbing's default without `-r`), and
|
|
1212
|
+
* `show-trees` the blobs and the subtrees on the way to them (`-t`)
|
|
1213
|
+
*
|
|
1214
|
+
* @internal
|
|
1215
|
+
*/
|
|
1216
|
+
setTreeWalk(walk: "recursive" | "flat" | "show-trees"): this {
|
|
1217
|
+
this.checkCallable();
|
|
1218
|
+
this.treeWalk = walk;
|
|
1219
|
+
return this;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
private treeWalk: "recursive" | "flat" | "show-trees" = "recursive";
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* Compare the worktree as the plumbing commands do (`diff-files`, `diff-index` without
|
|
1226
|
+
* `--cached`): no refresh, a file whose stat differs from its entry is a change even when
|
|
1227
|
+
* its content is the same, and its raw id is the null id (not hashed); an unmerged path's
|
|
1228
|
+
* raw line gives the worktree file's mode
|
|
1229
|
+
*
|
|
1230
|
+
* @internal
|
|
1231
|
+
*/
|
|
1232
|
+
setPlumbingWorktree(plumbing: boolean): this {
|
|
1233
|
+
this.checkCallable();
|
|
1234
|
+
this.plumbingWorktree = plumbing;
|
|
1235
|
+
return this;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
private plumbingWorktree = false;
|
|
1239
|
+
|
|
1240
|
+
/** The sides an unmerged path's raw line shows (diff_unmerge's pair), by path */
|
|
1241
|
+
private readonly unmergedRaw = new Map<
|
|
1242
|
+
string,
|
|
1243
|
+
{ oldMode?: number; oldId?: ObjectId; newMode?: number }
|
|
1244
|
+
>();
|
|
1245
|
+
|
|
1246
|
+
/** {@link setQueue}'s diffcore run, when asked */
|
|
1247
|
+
private async presetDiffcore(entries: DiffEntry[]): Promise<DiffEntry[]> {
|
|
1248
|
+
const options = this.presetQueueOptions;
|
|
1249
|
+
if (!options.diffcore) return entries;
|
|
1250
|
+
const core = this.diffcoreSettings(false);
|
|
1251
|
+
if (this.textOptions.diffFilter !== undefined) parseDiffFilter(this.textOptions.diffFilter);
|
|
1252
|
+
if (!core.breaks && !core.detect) return entries;
|
|
1253
|
+
const queue = [...entries];
|
|
1254
|
+
const sources = options.copySources;
|
|
1255
|
+
await this.diffcore(queue, core, async () => {
|
|
1256
|
+
const out = new Map<string, Side>();
|
|
1257
|
+
if (sources) for (const [path, side] of await sources()) out.set(path, side);
|
|
1258
|
+
return out;
|
|
1259
|
+
});
|
|
1260
|
+
return queue;
|
|
1261
|
+
}
|
|
1124
1262
|
|
|
1125
1263
|
/**
|
|
1126
1264
|
* diffcore's filtering stages over a queue a caller found (the pickaxe, `-O`,
|
|
@@ -1229,7 +1367,13 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1229
1367
|
this.setCallable(false);
|
|
1230
1368
|
this.dirtyThisCall = this.dirtySubmodules ?? true;
|
|
1231
1369
|
const run = async () => {
|
|
1232
|
-
|
|
1370
|
+
let entries: DiffEntry[];
|
|
1371
|
+
if (this.presetQueue) {
|
|
1372
|
+
await this.preparePickaxe();
|
|
1373
|
+
entries = await this.presetDiffcore(this.presetQueue);
|
|
1374
|
+
} else {
|
|
1375
|
+
entries = (await this.collect(this.renames ?? false, false, this.pickaxeReads)).entries;
|
|
1376
|
+
}
|
|
1233
1377
|
// diffcore_pickaxe, diffcore_apply_filter (the entries stay in path order, unswapped)
|
|
1234
1378
|
const picked = await this.picked(entries);
|
|
1235
1379
|
const filter = this.textOptions.diffFilter;
|
|
@@ -1272,7 +1416,13 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1272
1416
|
PREFETCH_FORMATS.has(format) || this.pickaxeReads,
|
|
1273
1417
|
);
|
|
1274
1418
|
const sink = new ByteSink();
|
|
1275
|
-
|
|
1419
|
+
try {
|
|
1420
|
+
await this.writeFormats(sink, [format], collected);
|
|
1421
|
+
} catch (error) {
|
|
1422
|
+
// what git wrote on stdout before an external diff made it die
|
|
1423
|
+
if (error instanceof ExternalDiffDiedError) error.output = sink.bytes();
|
|
1424
|
+
throw error;
|
|
1425
|
+
}
|
|
1276
1426
|
return sink.bytes();
|
|
1277
1427
|
});
|
|
1278
1428
|
}
|
|
@@ -1303,14 +1453,14 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1303
1453
|
this.changesFound = false;
|
|
1304
1454
|
const options = this.outputOptions();
|
|
1305
1455
|
Object.assign(options, this.prefixes());
|
|
1456
|
+
this.resetExternal();
|
|
1306
1457
|
for (const entry of entries) {
|
|
1307
1458
|
if (entry.unmerged) {
|
|
1308
1459
|
this.changesFound = true;
|
|
1309
1460
|
break;
|
|
1310
1461
|
}
|
|
1311
|
-
const
|
|
1312
|
-
await
|
|
1313
|
-
if (scratch.length > 0) {
|
|
1462
|
+
const pair = this.withTextconvInputs(diffEntryToPair(entry, this.blobs), entry);
|
|
1463
|
+
if (await this.patchOf(new ByteSink(), pair, options, entries.length, true)) {
|
|
1314
1464
|
this.changesFound = true;
|
|
1315
1465
|
break;
|
|
1316
1466
|
}
|
|
@@ -1383,7 +1533,7 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1383
1533
|
let collected: { entries: DiffEntry[]; combined: CombinedEntry[] };
|
|
1384
1534
|
if (this.presetQueue) {
|
|
1385
1535
|
await this.preparePickaxe();
|
|
1386
|
-
collected = { entries: this.presetQueue, combined: [] };
|
|
1536
|
+
collected = { entries: await this.presetDiffcore(this.presetQueue), combined: [] };
|
|
1387
1537
|
} else if (follow !== undefined) {
|
|
1388
1538
|
const spec = this.pathspecItems;
|
|
1389
1539
|
this.pathspecItems = [parsePathspecItem(`:(literal)${follow}`)];
|
|
@@ -1479,6 +1629,7 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1479
1629
|
// diffcore_std's has_changes; with diff_from_contents, what the outputs show (below)
|
|
1480
1630
|
const fromContents = this.fromContents;
|
|
1481
1631
|
this.changesFound = !fromContents && entries.length > 0;
|
|
1632
|
+
this.resetExternal();
|
|
1482
1633
|
const options = this.outputOptions();
|
|
1483
1634
|
Object.assign(options, this.prefixes());
|
|
1484
1635
|
if (this.textOptions.reverse) {
|
|
@@ -1492,6 +1643,8 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1492
1643
|
const unmerged = new Set<DiffFilePair>();
|
|
1493
1644
|
/** The pairs with their full paths, for what git does not shorten (`--summary`) */
|
|
1494
1645
|
const fullPairs = new Map<DiffFilePair, DiffFilePair>();
|
|
1646
|
+
/** The entry of each pair (an unmerged path's sides, for the raw output) */
|
|
1647
|
+
const entryOfPair = new Map<DiffFilePair, DiffEntry>();
|
|
1495
1648
|
const prefix = this.relativePrefix;
|
|
1496
1649
|
for (const entry of entries) {
|
|
1497
1650
|
// an unmerged path: only its name is printed
|
|
@@ -1532,12 +1685,15 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1532
1685
|
: {}),
|
|
1533
1686
|
};
|
|
1534
1687
|
fullPairs.set(shown, pair);
|
|
1688
|
+
entryOfPair.set(shown, entry);
|
|
1535
1689
|
if (entry.unmerged) unmerged.add(shown);
|
|
1536
1690
|
pairs.push(shown);
|
|
1537
1691
|
}
|
|
1538
1692
|
const full = (pair: DiffFilePair) => fullPairs.get(pair) ?? pair;
|
|
1539
1693
|
const quote = options.quotePath;
|
|
1694
|
+
const z = this.textOptions.nullTerminated === true;
|
|
1540
1695
|
const order: DiffOutputFormat[] = [
|
|
1696
|
+
"raw",
|
|
1541
1697
|
"name-only",
|
|
1542
1698
|
"name-status",
|
|
1543
1699
|
"numstat",
|
|
@@ -1589,7 +1745,8 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1589
1745
|
for (const format of order) {
|
|
1590
1746
|
if (!formats.includes(format)) continue;
|
|
1591
1747
|
if (format === "patch" && separator) {
|
|
1592
|
-
|
|
1748
|
+
// DIFF_SYMBOL_SEPARATOR: the line termination (a NUL under -z)
|
|
1749
|
+
sink.text(z ? "\0" : "\n");
|
|
1593
1750
|
// attach the patch instead of inlining it
|
|
1594
1751
|
if (this.textOptions.statSep) sink.text(this.textOptions.statSep);
|
|
1595
1752
|
}
|
|
@@ -1631,9 +1788,10 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1631
1788
|
options.abbrevLengths = await this.idAbbreviator().lengths(ids, options.abbrev);
|
|
1632
1789
|
}
|
|
1633
1790
|
// diff_flush_patch_all_file_pairs: moved lines are looked for over every pair
|
|
1791
|
+
// (diff_setup_done: not with an external diff program)
|
|
1634
1792
|
const moved = this.colorSettings;
|
|
1635
1793
|
const out =
|
|
1636
|
-
moved?.colors && moved.colorMoved !== "no"
|
|
1794
|
+
moved?.colors && moved.colorMoved !== "no" && !this.externalProgram()
|
|
1637
1795
|
? new MovedLineBuffer(moved.colorMoved, moved.colorMovedWs)
|
|
1638
1796
|
: sink;
|
|
1639
1797
|
for (const pair of this.withHeaderOnlyPairs(pairs, full, headers)) {
|
|
@@ -1642,9 +1800,29 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1642
1800
|
if (this.includesConflictHeaders(headers)) {
|
|
1643
1801
|
writeHeaderOnlyPatch(out, pair, headers?.get(pair) ?? [], options);
|
|
1644
1802
|
}
|
|
1645
|
-
} else
|
|
1646
|
-
|
|
1647
|
-
|
|
1803
|
+
} else {
|
|
1804
|
+
const isUnmerged = unmerged.has(pair);
|
|
1805
|
+
const external = await this.externalDiffFor(pair, options, isUnmerged);
|
|
1806
|
+
if (external) {
|
|
1807
|
+
// run_external_diff's found_changes, by the program's exit code
|
|
1808
|
+
if (
|
|
1809
|
+
await this.runExternalDiff(
|
|
1810
|
+
out,
|
|
1811
|
+
external,
|
|
1812
|
+
pair,
|
|
1813
|
+
options,
|
|
1814
|
+
pairs.length,
|
|
1815
|
+
false,
|
|
1816
|
+
isUnmerged,
|
|
1817
|
+
)
|
|
1818
|
+
) {
|
|
1819
|
+
this.changesFound = true;
|
|
1820
|
+
}
|
|
1821
|
+
continue;
|
|
1822
|
+
}
|
|
1823
|
+
if (isUnmerged) out.text(`* Unmerged path ${pair.new?.path ?? pair.old?.path}\n`);
|
|
1824
|
+
else await writePairPatch(out, pair, options);
|
|
1825
|
+
}
|
|
1648
1826
|
// builtin_diff's found_changes: the pair showed something
|
|
1649
1827
|
if (out.length > before) this.changesFound = true;
|
|
1650
1828
|
}
|
|
@@ -1653,11 +1831,45 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1653
1831
|
}
|
|
1654
1832
|
break;
|
|
1655
1833
|
}
|
|
1834
|
+
case "raw": {
|
|
1835
|
+
// flush_one_pair: --name-status wins over --raw (diff_flush_raw prints the
|
|
1836
|
+
// status alone), and --raw over --name-only
|
|
1837
|
+
// diff_setup_done: the name formats and --check turn --raw off
|
|
1838
|
+
if (formats.some((f) => f === "name-status" || f === "name-only" || f === "check")) {
|
|
1839
|
+
continue;
|
|
1840
|
+
}
|
|
1841
|
+
if (pairs.length > 0) this.changesFound = true;
|
|
1842
|
+
const abbreviate = await this.rawAbbreviator(pairs);
|
|
1843
|
+
const raw = {
|
|
1844
|
+
quotePath: quote,
|
|
1845
|
+
nullTerminated: z,
|
|
1846
|
+
abbreviate,
|
|
1847
|
+
nullId: this.objectFormat.nullId,
|
|
1848
|
+
};
|
|
1849
|
+
for (const pair of pairs) {
|
|
1850
|
+
const entry = entryOfPair.get(pair);
|
|
1851
|
+
if (unmerged.has(pair) && entry) {
|
|
1852
|
+
// diff_unmerge: the null ids, the sides' modes as the comparison knew them
|
|
1853
|
+
const path = entry.newPath ?? entry.oldPath ?? "";
|
|
1854
|
+
const side = (mode: number | undefined, id: string | undefined) =>
|
|
1855
|
+
contentSide(path, mode ?? 0, id ?? this.objectFormat.nullId, async () => NO_BYTES);
|
|
1856
|
+
const u: DiffFilePair = {
|
|
1857
|
+
status: "M",
|
|
1858
|
+
old: side(entry.oldMode, entry.oldId),
|
|
1859
|
+
new: side(entry.newMode, undefined),
|
|
1860
|
+
};
|
|
1861
|
+
sink.text(formatRawPair(u, raw, "U"));
|
|
1862
|
+
} else sink.text(formatRawPair(pair, raw));
|
|
1863
|
+
}
|
|
1864
|
+
break;
|
|
1865
|
+
}
|
|
1656
1866
|
case "name-only": {
|
|
1657
1867
|
const names = await this.shownNames(pairs, unmerged, options);
|
|
1658
1868
|
// flush_one_pair: found_changes for each name listed
|
|
1659
1869
|
if (names.length > 0) this.changesFound = true;
|
|
1660
|
-
|
|
1870
|
+
if (z) {
|
|
1871
|
+
for (const p of names) sink.text(`${p.new?.path ?? p.old?.path ?? ""}\0`);
|
|
1872
|
+
} else sink.text(formatNameOnly(names, { quotePath: quote }));
|
|
1661
1873
|
break;
|
|
1662
1874
|
}
|
|
1663
1875
|
case "name-status": {
|
|
@@ -1665,7 +1877,15 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1665
1877
|
// flush_one_pair: found_changes for each name listed
|
|
1666
1878
|
if (names.length > 0) this.changesFound = true;
|
|
1667
1879
|
for (const pair of names) {
|
|
1668
|
-
if (
|
|
1880
|
+
if (z) {
|
|
1881
|
+
const raw = {
|
|
1882
|
+
nullTerminated: true,
|
|
1883
|
+
nameStatus: true,
|
|
1884
|
+
abbreviate: (id: string) => id,
|
|
1885
|
+
nullId: this.objectFormat.nullId,
|
|
1886
|
+
};
|
|
1887
|
+
sink.text(formatRawPair(pair, raw, unmerged.has(pair) ? "U" : undefined));
|
|
1888
|
+
} else if (unmerged.has(pair)) {
|
|
1669
1889
|
sink.text(`U\t${quotePath(pair.new?.path ?? pair.old?.path ?? "", quote)}\n`);
|
|
1670
1890
|
} else sink.text(formatNameStatus([pair], { quotePath: quote }));
|
|
1671
1891
|
}
|
|
@@ -1705,6 +1925,25 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1705
1925
|
return pairs.length;
|
|
1706
1926
|
}
|
|
1707
1927
|
|
|
1928
|
+
/**
|
|
1929
|
+
* The raw output's ids: full under {@link DiffTextOptions.rawFullIds} without `--abbrev`,
|
|
1930
|
+
* else each abbreviated as git's `diff_aligned_abbrev` (unique, at least `--abbrev` digits)
|
|
1931
|
+
*/
|
|
1932
|
+
private async rawAbbreviator(pairs: DiffFilePair[]): Promise<(id: string) => string> {
|
|
1933
|
+
const o = this.textOptions;
|
|
1934
|
+
if (o.rawFullIds && o.abbrev === undefined) return (id) => id;
|
|
1935
|
+
const nullId = this.objectFormat.nullId;
|
|
1936
|
+
const ids = new Set<string>([nullId]);
|
|
1937
|
+
for (const p of pairs) {
|
|
1938
|
+
if (p.old && !p.old.rawNullId) ids.add(p.old.id);
|
|
1939
|
+
if (p.new && !p.new.rawNullId) ids.add(p.new.id);
|
|
1940
|
+
}
|
|
1941
|
+
const min = abbrevOption(o.abbrev);
|
|
1942
|
+
if (min !== undefined && min >= this.objectFormat.hexLength) return (id) => id;
|
|
1943
|
+
const lengths = await this.idAbbreviator().lengths(ids, min);
|
|
1944
|
+
return (id) => id.slice(0, lengths.get(id) ?? min ?? 7);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1708
1947
|
/**
|
|
1709
1948
|
* create_filepairs_for_header_only_notifications: the pairs, and the paths with headers
|
|
1710
1949
|
* none of them names first (as strings), sorted by first name (diffcore_fix_diff_index)
|
|
@@ -1896,12 +2135,17 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1896
2135
|
* the path's `diff.<driver>.textconv` over the blob as checkout writes it, or undefined
|
|
1897
2136
|
* when no textconv applies (not a regular file, no driver, no command or no runner
|
|
1898
2137
|
* installed, `textconv: false`). The attributes are the worktree's alone (git show reads
|
|
1899
|
-
* no index).
|
|
2138
|
+
* no index). With the blob's `id`, the driver's textconv cache applies
|
|
2139
|
+
* (`diff.<driver>.cachetextconv`). `worktreeFile`: `read` gives a file as it lies in the
|
|
2140
|
+
* worktree (blame's working-tree file, `--contents <file>`), converted as it is, never
|
|
2141
|
+
* smudged nor cached (git's prepare_temp_file reuses the file; its object id is unknown).
|
|
1900
2142
|
*/
|
|
1901
2143
|
async textconvBlob(
|
|
1902
2144
|
path: string,
|
|
1903
2145
|
mode: number,
|
|
1904
2146
|
read: () => Promise<Uint8Array>,
|
|
2147
|
+
id?: string,
|
|
2148
|
+
options: { worktreeFile?: boolean } = {},
|
|
1905
2149
|
): Promise<Uint8Array | undefined> {
|
|
1906
2150
|
if ((mode & S_IFMT) !== 0o100000) return undefined;
|
|
1907
2151
|
const runner =
|
|
@@ -1920,13 +2164,29 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1920
2164
|
const driver = diffDriverOf(attrs?.get("diff"), (key) => this.config.value(key));
|
|
1921
2165
|
const command = driver?.textconvCommand;
|
|
1922
2166
|
if (!driver || command === undefined) return undefined;
|
|
1923
|
-
return
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
2167
|
+
return this.runTextconv(
|
|
2168
|
+
runner,
|
|
2169
|
+
{
|
|
2170
|
+
driver: driver.name ?? "",
|
|
2171
|
+
command,
|
|
2172
|
+
path,
|
|
2173
|
+
content: options.worktreeFile ? await read() : await this.smudged(path, mode, read),
|
|
2174
|
+
cache: driver.cacheTextconv ?? false,
|
|
2175
|
+
},
|
|
2176
|
+
options.worktreeFile ? undefined : id,
|
|
2177
|
+
);
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
/** The textconv caches of this command (git's per-process caches) */
|
|
2181
|
+
private textconvCaches = new TextconvCaches(() => this.notesContext());
|
|
2182
|
+
|
|
2183
|
+
/** diff.c's fill_textconv: the runner's output, through the driver's notes cache */
|
|
2184
|
+
private runTextconv(
|
|
2185
|
+
runner: TextconvRunner,
|
|
2186
|
+
request: TextconvRequest,
|
|
2187
|
+
id: string | undefined,
|
|
2188
|
+
): Promise<Uint8Array> {
|
|
2189
|
+
return this.textconvCaches.run(runner, request, id);
|
|
1930
2190
|
}
|
|
1931
2191
|
|
|
1932
2192
|
/** A blob's content as checkout writes it to the worktree (the worktree's smudge filter) */
|
|
@@ -1960,13 +2220,200 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
1960
2220
|
shown.push(pair);
|
|
1961
2221
|
continue;
|
|
1962
2222
|
}
|
|
1963
|
-
|
|
1964
|
-
await writePairPatch(scratch, pair, options);
|
|
1965
|
-
if (scratch.length > 0) shown.push(pair);
|
|
2223
|
+
if (await this.patchOf(new ByteSink(), pair, options, pairs.length, true)) shown.push(pair);
|
|
1966
2224
|
}
|
|
1967
2225
|
return shown;
|
|
1968
2226
|
}
|
|
1969
2227
|
|
|
2228
|
+
/** The host environment the working copy's configuration was opened with */
|
|
2229
|
+
private get hostEnvironment(): GitHostEnvironment | undefined {
|
|
2230
|
+
return (this.workingCopy.config as { environment?: GitHostEnvironment })?.environment;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
/** diff_setup_done: the external diff calls of a new output start from 1 */
|
|
2234
|
+
private resetExternal(): void {
|
|
2235
|
+
this.externalCounter = 0;
|
|
2236
|
+
this.externalStderr = [];
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
/**
|
|
2240
|
+
* diff.c's `external_diff()` where external diffs are allowed (`--ext-diff`, porcelain
|
|
2241
|
+
* `git diff`): `GIT_EXTERNAL_DIFF`, else `diff.external` of the UI configuration
|
|
2242
|
+
*/
|
|
2243
|
+
private externalProgram(): ExternalDiffProgram | undefined {
|
|
2244
|
+
if (!this.textOptions.extDiff) return undefined;
|
|
2245
|
+
const config = this.config;
|
|
2246
|
+
return externalDiffProgramOf(
|
|
2247
|
+
this.hostEnvironment,
|
|
2248
|
+
this.textOptions.uiConfig === false ? undefined : (key) => config.value(key),
|
|
2249
|
+
);
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
/**
|
|
2253
|
+
* The program run_diff_cmd runs for a pair, if any: the pair's `diff.<driver>.command`
|
|
2254
|
+
* (attributes of its first path), else {@link externalProgram}; none without a runner to
|
|
2255
|
+
* run it or a place to write its files. `split`: a change between a file and a symbolic
|
|
2256
|
+
* link that only a driver's program takes (run_diff splits it in two when no
|
|
2257
|
+
* `GIT_EXTERNAL_DIFF`/`diff.external` is set).
|
|
2258
|
+
*/
|
|
2259
|
+
private async externalDiffFor(
|
|
2260
|
+
pair: DiffFilePair,
|
|
2261
|
+
options: DiffOutputOptions,
|
|
2262
|
+
unmerged: boolean,
|
|
2263
|
+
): Promise<(ExternalDiffProgram & { split: boolean }) | undefined> {
|
|
2264
|
+
if (!this.textOptions.extDiff) return undefined;
|
|
2265
|
+
const environment = this.hostEnvironment;
|
|
2266
|
+
if (!environment?.hookRunner || !environment.hostFilesOf) return undefined;
|
|
2267
|
+
const { old: one, new: two } = pair;
|
|
2268
|
+
if ((one && (one.mode & S_IFMT) === 0o040000) || (two && (two.mode & S_IFMT) === 0o040000)) {
|
|
2269
|
+
return undefined;
|
|
2270
|
+
}
|
|
2271
|
+
const global = this.externalProgram();
|
|
2272
|
+
const split =
|
|
2273
|
+
!global && !unmerged && !!one && !!two && (one.mode & S_IFMT) !== (two.mode & S_IFMT);
|
|
2274
|
+
const side = one ?? two;
|
|
2275
|
+
const attrPath = side?.attrPath ?? side?.path;
|
|
2276
|
+
const driver = attrPath ? await options.driver?.(attrPath) : undefined;
|
|
2277
|
+
if (driver?.externalCommand !== undefined) {
|
|
2278
|
+
return {
|
|
2279
|
+
command: driver.externalCommand,
|
|
2280
|
+
trustExitCode: driver.trustExitCode ?? false,
|
|
2281
|
+
split,
|
|
2282
|
+
};
|
|
2283
|
+
}
|
|
2284
|
+
return global && { ...global, split: false };
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* A pair's patch, through its external program or the builtin one: whether it shows a
|
|
2289
|
+
* change (git's `found_changes`). `quiet`: nothing is written (diff_flush_patch_quietly).
|
|
2290
|
+
*/
|
|
2291
|
+
private async patchOf(
|
|
2292
|
+
out: ByteSink,
|
|
2293
|
+
pair: DiffFilePair,
|
|
2294
|
+
options: DiffOutputOptions,
|
|
2295
|
+
total: number,
|
|
2296
|
+
quiet: boolean,
|
|
2297
|
+
): Promise<boolean> {
|
|
2298
|
+
const external = await this.externalDiffFor(pair, options, false);
|
|
2299
|
+
if (external) return this.runExternalDiff(out, external, pair, options, total, quiet);
|
|
2300
|
+
const before = out.length;
|
|
2301
|
+
await writePairPatch(out, pair, options);
|
|
2302
|
+
return out.length > before;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
/**
|
|
2306
|
+
* diff.c's run_external_diff for a pair (both halves of a split one): the program's stdout
|
|
2307
|
+
* into `out` (nothing when `quiet`), its stderr kept; whether the pair counts as changed.
|
|
2308
|
+
* Without `trustExitCode` a quiet check does not run the program and counts a change.
|
|
2309
|
+
*
|
|
2310
|
+
* @throws ExternalDiffDiedError on an exit code git does not accept
|
|
2311
|
+
*/
|
|
2312
|
+
private async runExternalDiff(
|
|
2313
|
+
out: ByteSink,
|
|
2314
|
+
program: ExternalDiffProgram & { split: boolean },
|
|
2315
|
+
pair: DiffFilePair,
|
|
2316
|
+
options: DiffOutputOptions,
|
|
2317
|
+
total: number,
|
|
2318
|
+
quiet: boolean,
|
|
2319
|
+
unmerged = false,
|
|
2320
|
+
): Promise<boolean> {
|
|
2321
|
+
if (!program.trustExitCode && quiet) return true;
|
|
2322
|
+
const { old: one, new: two } = pair;
|
|
2323
|
+
const name = one?.path ?? two?.path ?? "";
|
|
2324
|
+
// a split pair: the old side against nothing, then nothing against the new side
|
|
2325
|
+
const calls: Array<[DiffSideSpec | undefined, DiffSideSpec | undefined]> = program.split
|
|
2326
|
+
? [
|
|
2327
|
+
[one, undefined],
|
|
2328
|
+
[undefined, two],
|
|
2329
|
+
]
|
|
2330
|
+
: [[one, two]];
|
|
2331
|
+
let found = false;
|
|
2332
|
+
for (const [a, b] of calls) {
|
|
2333
|
+
const temps = new ExternalDiffTempFiles(this.hostEnvironment ?? {});
|
|
2334
|
+
try {
|
|
2335
|
+
const args = [name];
|
|
2336
|
+
// an unmerged path: its name alone
|
|
2337
|
+
if (!unmerged) {
|
|
2338
|
+
args.push(...(await this.externalSide(a, temps)), ...(await this.externalSide(b, temps)));
|
|
2339
|
+
const otherPath = two?.path ?? name;
|
|
2340
|
+
if (!program.split && otherPath !== name) {
|
|
2341
|
+
args.push(otherPath);
|
|
2342
|
+
const xfrm = externalDiffMetainfo(pair, options);
|
|
2343
|
+
if (xfrm !== undefined) args.push(xfrm);
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
const env = {
|
|
2347
|
+
GIT_DIFF_PATH_COUNTER: String(++this.externalCounter),
|
|
2348
|
+
GIT_DIFF_PATH_TOTAL: String(total),
|
|
2349
|
+
};
|
|
2350
|
+
const ran = await this.hooks.runProgram("external-diff", program.command, args, env);
|
|
2351
|
+
if (!ran) throw new ExternalDiffDiedError(name);
|
|
2352
|
+
if (!quiet && ran.stdout.length > 0) out.push(ran.stdout);
|
|
2353
|
+
if (ran.stderr.length > 0) this.externalStderr.push(ran.stderr);
|
|
2354
|
+
if (ran.exitCode === 0) {
|
|
2355
|
+
if (!program.trustExitCode) found = true;
|
|
2356
|
+
} else if (program.trustExitCode && ran.exitCode === 1) found = true;
|
|
2357
|
+
else throw new ExternalDiffDiedError(name);
|
|
2358
|
+
} finally {
|
|
2359
|
+
await temps.removeAll();
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
return found;
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
/**
|
|
2366
|
+
* prepare_temp_file: the three arguments naming one side. An absent side is `/dev/null . .`;
|
|
2367
|
+
* the worktree's file is passed by its path from the top (the null id when the comparison
|
|
2368
|
+
* did not hash it, a symbolic link's target in a temporary file); a stored side whose
|
|
2369
|
+
* index entry the worktree's file still matches is passed as that file
|
|
2370
|
+
* (`reuse_worktree_file`, only when the diff reads the index); any other side is a
|
|
2371
|
+
* temporary file of its content as checkout writes it.
|
|
2372
|
+
*/
|
|
2373
|
+
private async externalSide(
|
|
2374
|
+
side: DiffSideSpec | undefined,
|
|
2375
|
+
temps: ExternalDiffTempFiles,
|
|
2376
|
+
): Promise<string[]> {
|
|
2377
|
+
if (!side) return ["/dev/null", ".", "."];
|
|
2378
|
+
const nullId = this.objectFormat.nullId;
|
|
2379
|
+
const path = side.attrPath ?? side.path;
|
|
2380
|
+
const mode = octal6(side.mode);
|
|
2381
|
+
const gitlink = (side.mode & S_IFMT) === GITLINK;
|
|
2382
|
+
const fromWorktree = side.idValid === false;
|
|
2383
|
+
const worktree = this.worktreeIfAny;
|
|
2384
|
+
if (!gitlink && worktree && (fromWorktree || (await this.reusesWorktreeFile(path, side)))) {
|
|
2385
|
+
const current = await worktree.getEntry(path);
|
|
2386
|
+
if (!current || current.isDirectory) return ["/dev/null", ".", "."];
|
|
2387
|
+
if ((current.mode & S_IFMT) !== SYMLINK) return [path, fromWorktree ? nullId : side.id, mode];
|
|
2388
|
+
const target = await collectChunks(worktree.readContent(path));
|
|
2389
|
+
return [
|
|
2390
|
+
await temps.write(path, target),
|
|
2391
|
+
fromWorktree ? nullId : side.id,
|
|
2392
|
+
fromWorktree ? octal6(SYMLINK) : mode,
|
|
2393
|
+
];
|
|
2394
|
+
}
|
|
2395
|
+
const content = gitlink ? await side.read() : await (side.readTextconvInput ?? side.read)();
|
|
2396
|
+
return [await temps.write(path, content), side.id, mode];
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
/** reuse_worktree_file: the index's entry of `path` holds the side and its file matches it */
|
|
2400
|
+
private async reusesWorktreeFile(path: string, side: DiffSideSpec): Promise<boolean> {
|
|
2401
|
+
// a diff of two trees reads no index (`istate->cache` empty)
|
|
2402
|
+
if (this.newTree !== undefined || !this.worktreeIfAny) return false;
|
|
2403
|
+
const entry = await this.staging.getEntry(path);
|
|
2404
|
+
if (!entry || entry.stage !== 0 || entry.objectId !== side.id) return false;
|
|
2405
|
+
if ((entry.mode & S_IFMT) !== 0o100000) return false;
|
|
2406
|
+
if (entry.assumeValid || entry.skipWorktree) return false;
|
|
2407
|
+
const worktree = this.worktreeIfAny;
|
|
2408
|
+
const current = await worktree.getEntry(path);
|
|
2409
|
+
if (!current) return false;
|
|
2410
|
+
// ie_match_stat: the stat data, and the content of a racily clean entry
|
|
2411
|
+
const trust = worktreeModeTrust(this.workingCopy, worktree);
|
|
2412
|
+
const indexTime = this.staging.getUpdateTime();
|
|
2413
|
+
const compared = await compareWithWorktree(worktree, entry, { trust, indexTime }, current);
|
|
2414
|
+
return compared.kind === undefined;
|
|
2415
|
+
}
|
|
2416
|
+
|
|
1970
2417
|
private get config(): RemoteConfigStore {
|
|
1971
2418
|
return RemoteConfigStore.from(this.workingCopy);
|
|
1972
2419
|
}
|
|
@@ -2102,7 +2549,8 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2102
2549
|
const cache = found.cacheTextconv ?? false;
|
|
2103
2550
|
return {
|
|
2104
2551
|
...found,
|
|
2105
|
-
textconv: (content, path) =>
|
|
2552
|
+
textconv: (content, path, id) =>
|
|
2553
|
+
this.runTextconv(runner, { driver: name, command, path, content, cache }, id),
|
|
2106
2554
|
};
|
|
2107
2555
|
};
|
|
2108
2556
|
const driver = filter?.attributes
|
|
@@ -2129,6 +2577,7 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2129
2577
|
ignoreConfigNoPrefix: _ignoreConfigNoPrefix,
|
|
2130
2578
|
orderFile: _orderFile,
|
|
2131
2579
|
textconv: _textconv,
|
|
2580
|
+
extDiff: _extDiff,
|
|
2132
2581
|
abbrev: _abbrev,
|
|
2133
2582
|
diffFilter: _diffFilter,
|
|
2134
2583
|
relative: _relative,
|
|
@@ -2165,6 +2614,7 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2165
2614
|
: {};
|
|
2166
2615
|
const ignoreRegex = this.ignoreRegex();
|
|
2167
2616
|
const abbrev = abbrevOption(this.textOptions.abbrev);
|
|
2617
|
+
const diffOpts = this.hostEnvironment?.diffVariables?.GIT_DIFF_OPTS;
|
|
2168
2618
|
return {
|
|
2169
2619
|
context: intValue(get("diff.context")) ?? 3,
|
|
2170
2620
|
interHunkContext: intValue(get("diff.interHunkContext")) ?? 0,
|
|
@@ -2189,6 +2639,7 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2189
2639
|
? { defaultWordRegex: get("diff.wordRegex") as string }
|
|
2190
2640
|
: {}),
|
|
2191
2641
|
whitespaceRule,
|
|
2642
|
+
...(diffOpts !== undefined ? { diffOpts } : {}),
|
|
2192
2643
|
};
|
|
2193
2644
|
}
|
|
2194
2645
|
|
|
@@ -2419,7 +2870,9 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2419
2870
|
const unmerged = new Map<string, DiffEntry[]>();
|
|
2420
2871
|
const combined: CombinedEntry[] = [];
|
|
2421
2872
|
if (this.newTree) {
|
|
2422
|
-
if (this.pickaxe && !this.pickaxe.readsContent) this.
|
|
2873
|
+
if ((this.pickaxe && !this.pickaxe.readsContent) || this.treeWalk === "show-trees") {
|
|
2874
|
+
this.treeSides = new Map();
|
|
2875
|
+
}
|
|
2423
2876
|
[oldSide, newSide] = await this.treePairSides(
|
|
2424
2877
|
this.oldTree ?? "HEAD",
|
|
2425
2878
|
this.oldTree === undefined,
|
|
@@ -2429,7 +2882,12 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2429
2882
|
oldSide = await this.treeSide(this.oldTree ?? "HEAD", this.oldTree === undefined);
|
|
2430
2883
|
const index = await this.indexSide();
|
|
2431
2884
|
newSide = index.sides;
|
|
2432
|
-
for (const path of index.unmerged.keys())
|
|
2885
|
+
for (const path of index.unmerged.keys()) {
|
|
2886
|
+
unmerged.set(path, []);
|
|
2887
|
+
// diff_unmerge's raw line: the tree's side, nothing for the index
|
|
2888
|
+
const side = oldSide.get(path);
|
|
2889
|
+
if (side) this.unmergedRaw.set(path, { oldMode: side.mode, oldId: side.id });
|
|
2890
|
+
}
|
|
2433
2891
|
} else if (worktree) {
|
|
2434
2892
|
const run = async () => {
|
|
2435
2893
|
if (this.oldTree) {
|
|
@@ -2450,6 +2908,12 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2450
2908
|
continue;
|
|
2451
2909
|
}
|
|
2452
2910
|
unmerged.set(path, ours ? await this.againstStage(ours, wt.compare) : []);
|
|
2911
|
+
if (this.plumbingWorktree) {
|
|
2912
|
+
// run_diff_files: the unmerged line gives the worktree file's mode
|
|
2913
|
+
const lowest = ours ?? stages.get(1) ?? stages.get(3);
|
|
2914
|
+
const file = lowest ? await wt.compare(lowest) : undefined;
|
|
2915
|
+
if (file) this.unmergedRaw.set(path, { newMode: file.mode });
|
|
2916
|
+
}
|
|
2453
2917
|
}
|
|
2454
2918
|
return [indexSides, wt.sides] as const;
|
|
2455
2919
|
};
|
|
@@ -2519,6 +2983,7 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2519
2983
|
sides.get(oldSide) ?? new Map(),
|
|
2520
2984
|
sides.get(newSide) ?? new Map(),
|
|
2521
2985
|
new Map(),
|
|
2986
|
+
this.treeWalk === "show-trees",
|
|
2522
2987
|
);
|
|
2523
2988
|
if (trees.length === 0) return entries;
|
|
2524
2989
|
const keyOf = (e: DiffEntry) => e.newPath ?? e.oldPath ?? "";
|
|
@@ -2707,7 +3172,10 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2707
3172
|
},
|
|
2708
3173
|
];
|
|
2709
3174
|
}
|
|
2710
|
-
|
|
3175
|
+
const statDirty = side.rawNull && this.plumbingWorktree;
|
|
3176
|
+
if (side.id === stage.objectId && side.mode === stage.mode && !side.dirty && !statDirty) {
|
|
3177
|
+
return [];
|
|
3178
|
+
}
|
|
2711
3179
|
return [
|
|
2712
3180
|
{
|
|
2713
3181
|
changeType: ChangeType.MODIFY,
|
|
@@ -2720,6 +3188,7 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2720
3188
|
...(side.read ? { readNew: side.read } : {}),
|
|
2721
3189
|
...(side.dirty ? { newDirtySubmodule: true } : {}),
|
|
2722
3190
|
...(side.dirt ? { newSubmoduleDirt: side.dirt } : {}),
|
|
3191
|
+
...(side.rawNull ? { newIdNull: true } : {}),
|
|
2723
3192
|
},
|
|
2724
3193
|
];
|
|
2725
3194
|
}
|
|
@@ -2730,12 +3199,15 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2730
3199
|
return typeof relative === "string" && relative !== "" ? relative : undefined;
|
|
2731
3200
|
}
|
|
2732
3201
|
|
|
2733
|
-
private matches(path: string): boolean {
|
|
3202
|
+
private matches(path: string, tree = false): boolean {
|
|
2734
3203
|
if (this.pathFilter && !path.startsWith(this.pathFilter)) return false;
|
|
2735
3204
|
// diff_queue_addremove / diff_change / diff_unmerge: outside the prefix, nothing is queued
|
|
2736
3205
|
const prefix = this.relativePrefix;
|
|
2737
3206
|
if (prefix !== undefined && !path.startsWith(prefix)) return false;
|
|
2738
|
-
|
|
3207
|
+
// tree_entry_interesting: a subtree shown (`-t`, without `-r`) is one the pathspec
|
|
3208
|
+
// matches or leads to
|
|
3209
|
+
const flags = tree ? DO_MATCH_DIRECTORY | DO_MATCH_LEADING_PATHSPEC : 0;
|
|
3210
|
+
return !this.pathspecItems || matchPathspec(this.pathspecItems, path, flags) > 0;
|
|
2739
3211
|
}
|
|
2740
3212
|
|
|
2741
3213
|
/**
|
|
@@ -2746,24 +3218,36 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2746
3218
|
oldSide: Map<string, Side>,
|
|
2747
3219
|
newSide: Map<string, Side>,
|
|
2748
3220
|
unmerged: Map<string, DiffEntry[]>,
|
|
3221
|
+
trees = false,
|
|
2749
3222
|
): DiffEntry[] {
|
|
2750
3223
|
const paths = new Set<string>([...oldSide.keys(), ...newSide.keys(), ...unmerged.keys()]);
|
|
2751
|
-
|
|
3224
|
+
// a subtree listed as an entry (`flat`) is keyed `<path>/`: it sorts as tree-diff.c
|
|
3225
|
+
// walks it and pairs with no blob of its name
|
|
3226
|
+
const sorted = [...paths]
|
|
3227
|
+
.filter((p) =>
|
|
3228
|
+
p.endsWith("/") ? this.matches(p.slice(0, -1), true) : this.matches(p, trees),
|
|
3229
|
+
)
|
|
3230
|
+
.sort(compareBytes);
|
|
2752
3231
|
const entries: DiffEntry[] = [];
|
|
2753
|
-
for (const
|
|
2754
|
-
const
|
|
3232
|
+
for (const key of sorted) {
|
|
3233
|
+
const path = key.endsWith("/") ? key.slice(0, -1) : key;
|
|
3234
|
+
const extra = unmerged.get(key);
|
|
2755
3235
|
if (extra) {
|
|
3236
|
+
const raw = this.unmergedRaw.get(path);
|
|
2756
3237
|
entries.push({
|
|
2757
3238
|
changeType: ChangeType.MODIFY,
|
|
2758
3239
|
oldPath: path,
|
|
2759
3240
|
newPath: path,
|
|
2760
3241
|
unmerged: true,
|
|
3242
|
+
...(raw?.oldMode !== undefined ? { oldMode: raw.oldMode as FileModeValue } : {}),
|
|
3243
|
+
...(raw?.oldId !== undefined ? { oldId: raw.oldId } : {}),
|
|
3244
|
+
...(raw?.newMode !== undefined ? { newMode: raw.newMode as FileModeValue } : {}),
|
|
2761
3245
|
});
|
|
2762
3246
|
entries.push(...extra);
|
|
2763
3247
|
continue;
|
|
2764
3248
|
}
|
|
2765
|
-
const a = oldSide.get(
|
|
2766
|
-
const b = newSide.get(
|
|
3249
|
+
const a = oldSide.get(key);
|
|
3250
|
+
const b = newSide.get(key);
|
|
2767
3251
|
if (a && !b) {
|
|
2768
3252
|
entries.push({
|
|
2769
3253
|
changeType: ChangeType.DELETE,
|
|
@@ -2781,8 +3265,17 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2781
3265
|
...(b.dirty ? { newDirtySubmodule: true } : {}),
|
|
2782
3266
|
...(b.dirt ? { newSubmoduleDirt: b.dirt } : {}),
|
|
2783
3267
|
...(b.unknownId ? { newIdUnknown: true } : {}),
|
|
3268
|
+
...(b.rawNull ? { newIdNull: true } : {}),
|
|
2784
3269
|
});
|
|
2785
|
-
} else if (
|
|
3270
|
+
} else if (
|
|
3271
|
+
a &&
|
|
3272
|
+
b &&
|
|
3273
|
+
(a.id !== b.id ||
|
|
3274
|
+
a.mode !== b.mode ||
|
|
3275
|
+
b.dirty ||
|
|
3276
|
+
b.unknownId ||
|
|
3277
|
+
(b.rawNull && this.plumbingWorktree))
|
|
3278
|
+
) {
|
|
2786
3279
|
// show_modified: a side of the null id differs from any (`M sub` even where the
|
|
2787
3280
|
// submodule is back at the tree's commit)
|
|
2788
3281
|
entries.push({
|
|
@@ -2797,6 +3290,7 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
2797
3290
|
...(b.dirty ? { newDirtySubmodule: true } : {}),
|
|
2798
3291
|
...(b.dirt ? { newSubmoduleDirt: b.dirt } : {}),
|
|
2799
3292
|
...(b.unknownId ? { newIdUnknown: true } : {}),
|
|
3293
|
+
...(b.rawNull ? { newIdNull: true } : {}),
|
|
2800
3294
|
});
|
|
2801
3295
|
}
|
|
2802
3296
|
}
|
|
@@ -3231,6 +3725,11 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
3231
3725
|
// them (100664 is 100644)
|
|
3232
3726
|
if (xe.id === ye.id && xe.mode === ye.mode) continue;
|
|
3233
3727
|
const path = prefix ? `${prefix}/${xe.name}` : xe.name;
|
|
3728
|
+
if (isTreeMode(xe.mode) && isTreeMode(ye.mode) && this.treeWalk === "flat") {
|
|
3729
|
+
oldSide.set(`${path}/`, { mode: xe.mode, id: xe.id });
|
|
3730
|
+
newSide.set(`${path}/`, { mode: ye.mode, id: ye.id });
|
|
3731
|
+
continue;
|
|
3732
|
+
}
|
|
3234
3733
|
if (isTreeMode(xe.mode) && isTreeMode(ye.mode)) {
|
|
3235
3734
|
this.addTreeSide(path, xe.mode, xe.id, oldSide);
|
|
3236
3735
|
this.addTreeSide(path, ye.mode, ye.id, newSide);
|
|
@@ -3274,7 +3773,10 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
3274
3773
|
} else {
|
|
3275
3774
|
if (!x.sameAs(y)) {
|
|
3276
3775
|
const path = pathOf(x.name());
|
|
3277
|
-
if (x.isTree && y.isTree) {
|
|
3776
|
+
if (x.isTree && y.isTree && this.treeWalk === "flat") {
|
|
3777
|
+
oldSide.set(`${path}/`, { mode: x.mode, id: x.id() });
|
|
3778
|
+
newSide.set(`${path}/`, { mode: y.mode, id: y.id() });
|
|
3779
|
+
} else if (x.isTree && y.isTree) {
|
|
3278
3780
|
this.addTreeSide(path, x.mode, x.id(), oldSide);
|
|
3279
3781
|
this.addTreeSide(path, y.mode, y.id(), newSide);
|
|
3280
3782
|
await this.diffRawTrees(x.id(), y.id(), path, oldSide, newSide);
|
|
@@ -3295,7 +3797,9 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
3295
3797
|
path: string,
|
|
3296
3798
|
side: Map<string, Side>,
|
|
3297
3799
|
): Promise<void> {
|
|
3298
|
-
if (c.isTree) {
|
|
3800
|
+
if (c.isTree && this.treeWalk === "flat") {
|
|
3801
|
+
side.set(`${path}/`, { mode: c.mode, id: c.id() });
|
|
3802
|
+
} else if (c.isTree) {
|
|
3299
3803
|
this.addTreeSide(path, c.mode, c.id(), side);
|
|
3300
3804
|
await this.collectTreeEntries(c.id(), path, side);
|
|
3301
3805
|
} else side.set(path, { mode: c.mode, id: c.id() });
|
|
@@ -3303,7 +3807,9 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
3303
3807
|
|
|
3304
3808
|
/** A tree entry on one side: a blob as itself, a subtree as its blobs */
|
|
3305
3809
|
private async addSide(e: TreeEntry, path: string, side: Map<string, Side>): Promise<void> {
|
|
3306
|
-
if (isTreeMode(e.mode)) {
|
|
3810
|
+
if (isTreeMode(e.mode) && this.treeWalk === "flat") {
|
|
3811
|
+
side.set(`${path}/`, { mode: e.mode, id: e.id });
|
|
3812
|
+
} else if (isTreeMode(e.mode)) {
|
|
3307
3813
|
this.addTreeSide(path, e.mode, e.id, side);
|
|
3308
3814
|
await this.collectTreeEntries(e.id, path, side);
|
|
3309
3815
|
} else side.set(path, { mode: e.mode, id: e.id });
|
|
@@ -3368,12 +3874,26 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
3368
3874
|
const trust = worktreeModeTrust(this.workingCopy, worktree);
|
|
3369
3875
|
const indexTime = this.staging.getUpdateTime();
|
|
3370
3876
|
const ignoreOf = await this.submoduleIgnoreOf();
|
|
3877
|
+
// the file system monitor, asked as git asks it on reading the index (tweak_fsmonitor,
|
|
3878
|
+
// refresh_fsmonitor): an entry it reported nothing for since its token is unchanged.
|
|
3879
|
+
// diff-files never stats it (run_diff_files, as CE_VALID); diff-index of git 2.5x neither
|
|
3880
|
+
// (check_removed's fake_lstat), while 2.43's check_removed still lstats it (a deleted file
|
|
3881
|
+
// is a deletion there), only ie_match_stat's comparison skipped
|
|
3882
|
+
const fsm = await this.fsmonitorRefresh(this.staging);
|
|
3883
|
+
const fsmValid = (entry: StageEntry) => !!fsm && entry.stage === 0 && fsm.state.isValid(entry);
|
|
3884
|
+
const statsValid = unmergedAsFiles && this.hooks.compatibility === "2.43";
|
|
3885
|
+
const fsmUnstated = (entry: StageEntry) => !statsValid && fsmValid(entry);
|
|
3371
3886
|
const compareWith = async (
|
|
3372
3887
|
entry: StageEntry,
|
|
3373
3888
|
current?: WorktreeEntry | null,
|
|
3374
3889
|
): Promise<Side | undefined> => {
|
|
3375
3890
|
const indexSide: Side = { mode: entry.mode, id: entry.objectId };
|
|
3376
|
-
if (entry.skipWorktree || entry.assumeValid) return indexSide;
|
|
3891
|
+
if (entry.skipWorktree || entry.assumeValid || fsmUnstated(entry)) return indexSide;
|
|
3892
|
+
if (fsmValid(entry)) {
|
|
3893
|
+
const file =
|
|
3894
|
+
current !== undefined ? current : await worktree.getEntry(entry.path).catch(() => null);
|
|
3895
|
+
return file ? indexSide : undefined;
|
|
3896
|
+
}
|
|
3377
3897
|
const ignore = entry.mode === GITLINK ? ignoreOf(entry.path) : undefined;
|
|
3378
3898
|
if (entry.mode === GITLINK && ignore === "all") return indexSide;
|
|
3379
3899
|
const result = await compareWithWorktree(worktree, entry, { trust, indexTime }, current);
|
|
@@ -3393,6 +3913,9 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
3393
3913
|
result.worktreeEntry?.isDirectory
|
|
3394
3914
|
) {
|
|
3395
3915
|
const found = await readSubmoduleDirt(worktree, entry.path, ignore !== "none");
|
|
3916
|
+
for (const line of found.unreadable ?? []) {
|
|
3917
|
+
if (!this.configWarnings.includes(line)) this.configWarnings.push(line);
|
|
3918
|
+
}
|
|
3396
3919
|
if (found.modified) dirt.modified = true;
|
|
3397
3920
|
if (ignore === "none" && found.untracked) dirt.untracked = true;
|
|
3398
3921
|
dirty = !!dirt.modified || !!dirt.untracked;
|
|
@@ -3411,16 +3934,31 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
3411
3934
|
const content = encoder.encode(`Subproject commit ${id}-dirty\n`);
|
|
3412
3935
|
return { mode, id, dirty, dirt, ...unknown, read: async () => content };
|
|
3413
3936
|
}
|
|
3414
|
-
if (!result.kind && !entry.intentToAdd) return indexSide;
|
|
3415
3937
|
const path = entry.path;
|
|
3938
|
+
// plumbing's ie_match_stat: a stat that differs is a change, the file not hashed
|
|
3939
|
+
// (a racily clean entry's content is compared)
|
|
3940
|
+
const statDirty =
|
|
3941
|
+
this.plumbingWorktree &&
|
|
3942
|
+
!entry.intentToAdd &&
|
|
3943
|
+
!result.kind &&
|
|
3944
|
+
result.hashedId !== undefined &&
|
|
3945
|
+
!!result.worktreeEntry &&
|
|
3946
|
+
!basicStatMatches(entry, result.worktreeEntry, trust);
|
|
3947
|
+
if (!result.kind && !entry.intentToAdd && !statDirty) return indexSide;
|
|
3416
3948
|
const id = result.hashedId ?? (await worktree.computeHash(path));
|
|
3417
|
-
|
|
3949
|
+
// run_diff_files / run_diff_index: the worktree side is not hashed (its raw id is the
|
|
3950
|
+
// null id), porcelain included; only the porcelain's intent-to-add entry, shown as a
|
|
3951
|
+
// new file, gets its content's id
|
|
3952
|
+
const rawNull = this.plumbingWorktree || !entry.intentToAdd;
|
|
3953
|
+
if (!entry.intentToAdd && id === entry.objectId && mode === entry.mode && !statDirty) {
|
|
3954
|
+
return indexSide;
|
|
3955
|
+
}
|
|
3418
3956
|
let content: Promise<Uint8Array> | undefined;
|
|
3419
3957
|
const read = () => {
|
|
3420
3958
|
content ??= readCleanContent(worktree, path);
|
|
3421
3959
|
return content;
|
|
3422
3960
|
};
|
|
3423
|
-
return { mode, id, read };
|
|
3961
|
+
return { mode, id, read, ...(rawNull ? { rawNull: true } : {}) };
|
|
3424
3962
|
};
|
|
3425
3963
|
const compare: WorktreeCompare = (entry) => compareWith(entry);
|
|
3426
3964
|
// the stat pass: the files of the stage-0 entries compared, stat'ed a chunk at a time
|
|
@@ -3429,6 +3967,7 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
3429
3967
|
!entry.skipWorktree &&
|
|
3430
3968
|
!entry.assumeValid &&
|
|
3431
3969
|
entry.mode !== GITLINK &&
|
|
3970
|
+
!fsmUnstated(entry) &&
|
|
3432
3971
|
this.matches(entry.path);
|
|
3433
3972
|
for await (const { item: entry, current } of withWorktreeEntries(
|
|
3434
3973
|
worktree,
|
|
@@ -3449,7 +3988,13 @@ export class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
|
3449
3988
|
if (changedOnly && (!entry.intentToAdd || this.intentToAddVisible)) {
|
|
3450
3989
|
// diff-files: an entry its file still holds is no change on either side, left out
|
|
3451
3990
|
// of both (the index side is the entry, as `indexSide` gives it)
|
|
3452
|
-
if (
|
|
3991
|
+
if (
|
|
3992
|
+
side &&
|
|
3993
|
+
side.id === entry.objectId &&
|
|
3994
|
+
side.mode === entry.mode &&
|
|
3995
|
+
!side.dirty &&
|
|
3996
|
+
!(side.rawNull && this.plumbingWorktree)
|
|
3997
|
+
) {
|
|
3453
3998
|
continue;
|
|
3454
3999
|
}
|
|
3455
4000
|
changedOnly.set(entry.path, { mode: entry.mode, id: entry.objectId });
|