@statewalker/vcs-commands 0.10.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.
Files changed (72) hide show
  1. package/dist/commands/am/am-command.d.ts.map +1 -1
  2. package/dist/commands/cat-file/cat-file-command.d.ts +9 -0
  3. package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -1
  4. package/dist/commands/checkout-command.d.ts.map +1 -1
  5. package/dist/commands/clone-command.d.ts +9 -0
  6. package/dist/commands/clone-command.d.ts.map +1 -1
  7. package/dist/commands/default-branch.d.ts +12 -0
  8. package/dist/commands/default-branch.d.ts.map +1 -1
  9. package/dist/commands/diff-command.d.ts.map +1 -1
  10. package/dist/commands/format-rev-command.d.ts +6 -4
  11. package/dist/commands/format-rev-command.d.ts.map +1 -1
  12. package/dist/commands/fsmonitor-ipc.d.ts +30 -0
  13. package/dist/commands/fsmonitor-ipc.d.ts.map +1 -0
  14. package/dist/commands/fsmonitor-refresh.d.ts.map +1 -1
  15. package/dist/commands/index.d.ts +1 -0
  16. package/dist/commands/index.d.ts.map +1 -1
  17. package/dist/commands/index.js +6 -6
  18. package/dist/commands/log-output.d.ts +6 -0
  19. package/dist/commands/log-output.d.ts.map +1 -1
  20. package/dist/commands/ls-tree-command.d.ts.map +1 -1
  21. package/dist/commands/repo-command.d.ts +28 -6
  22. package/dist/commands/repo-command.d.ts.map +1 -1
  23. package/dist/commands/reset-command.d.ts +19 -2
  24. package/dist/commands/reset-command.d.ts.map +1 -1
  25. package/dist/commands/rev-parse-command.d.ts +3 -7
  26. package/dist/commands/rev-parse-command.d.ts.map +1 -1
  27. package/dist/commands/revision-resolver.d.ts +15 -1
  28. package/dist/commands/revision-resolver.d.ts.map +1 -1
  29. package/dist/commands/signing.d.ts +8 -1
  30. package/dist/commands/signing.d.ts.map +1 -1
  31. package/dist/commands/status-command.d.ts +14 -1
  32. package/dist/commands/status-command.d.ts.map +1 -1
  33. package/dist/commands/submodule-add-command.d.ts +12 -0
  34. package/dist/commands/submodule-add-command.d.ts.map +1 -1
  35. package/dist/commands/submodule-update-command.d.ts +14 -0
  36. package/dist/commands/submodule-update-command.d.ts.map +1 -1
  37. package/dist/commands/tag-command.d.ts.map +1 -1
  38. package/dist/commands/update-index-command.d.ts +21 -0
  39. package/dist/commands/update-index-command.d.ts.map +1 -1
  40. package/dist/{commands-Mlo1dxQN.js → commands-bQQ9OmCh.js} +354 -77
  41. package/dist/{fsck-CrhVMNIH.js → fsck-BHT9bUS-.js} +1 -1
  42. package/dist/git-command.d.ts +8 -2
  43. package/dist/git-command.d.ts.map +1 -1
  44. package/dist/index.js +6 -6
  45. package/dist/{maintenance-run-command-Bw21HEkH.js → maintenance-run-command-Cx2PlGV9.js} +9 -4
  46. package/dist/{remote-transport-Bu4PGSMD.js → remote-transport-BrQZfyHu.js} +3 -3
  47. package/dist/results/index.js +1 -1
  48. package/dist/{results-ERo9vELd.js → results-CNHQnU5Y.js} +327 -54
  49. package/package.json +12 -12
  50. package/src/commands/am/am-command.ts +30 -14
  51. package/src/commands/cat-file/cat-file-command.ts +46 -8
  52. package/src/commands/checkout-command.ts +22 -1
  53. package/src/commands/clone-command.ts +41 -2
  54. package/src/commands/default-branch.ts +19 -0
  55. package/src/commands/diff-command.ts +19 -1
  56. package/src/commands/format-rev-command.ts +28 -12
  57. package/src/commands/fsmonitor-ipc.ts +121 -0
  58. package/src/commands/fsmonitor-refresh.ts +7 -2
  59. package/src/commands/index.ts +1 -0
  60. package/src/commands/log-output.ts +11 -0
  61. package/src/commands/ls-tree-command.ts +25 -1
  62. package/src/commands/repo-command.ts +124 -25
  63. package/src/commands/reset-command.ts +75 -3
  64. package/src/commands/rev-parse-command.ts +14 -28
  65. package/src/commands/revision-resolver.ts +53 -11
  66. package/src/commands/signing.ts +54 -7
  67. package/src/commands/status-command.ts +31 -2
  68. package/src/commands/submodule-add-command.ts +18 -1
  69. package/src/commands/submodule-update-command.ts +18 -1
  70. package/src/commands/tag-command.ts +33 -11
  71. package/src/commands/update-index-command.ts +137 -5
  72. package/src/git-command.ts +48 -4
@@ -1,15 +1,15 @@
1
- import { E as fsckTree, I as __exportAll, T as fsckTag, _ as UnknownFsckMsgIdError, d as FsckCommand, g as FsckMessageTypes, h as FSCK_MSG_IDS, m as receiveFsckOf, n as VerifyPackCommand, p as fetchFsckOf, v as parseFsckMsgId, w as fsckCommit, x as checkSubmoduleName } from "./fsck-CrhVMNIH.js";
1
+ import { E as fsckTree, I as __exportAll, T as fsckTag, _ as UnknownFsckMsgIdError, d as FsckCommand, g as FsckMessageTypes, h as FSCK_MSG_IDS, m as receiveFsckOf, n as VerifyPackCommand, p as fetchFsckOf, v as parseFsckMsgId, w as fsckCommit, x as checkSubmoduleName } from "./fsck-BHT9bUS-.js";
2
2
  import { BranchUsedByWorktreeError, CannotDeleteCurrentBranchError, CheckoutIndexFailedError, CloneCheckoutError, CloneDestinationError, CommitNotFoundError, DescribeError, EmptyCommitError, GitApiError, HookFailedError, IncompatibleOptionsError, IndexLockFailedError, InvalidArgumentError, InvalidConfigError, InvalidMainlineParentError, InvalidMergeHeadsError, InvalidPathError, InvalidRefNameError, InvalidRemoteError, InvalidStashIndexError, InvalidTagNameError, MissingArgumentError, MktagFailedError, MultipleParentsNotAllowedError, MvFailedError, NoFilepatternError, NoHeadError, NoMergeBaseError, NoMessageError, NoRebaseInProgressError, NonFastForwardError, NotACommitError, NotFastForwardError, NotMergedError, PushRejectedException, RebaseTodoMissingError, RefAlreadyExistsError, RefFilterError, RefNotFoundError, RemoteAlreadyExistsError, RemoteNotFoundError, RevisionError, RmFailedError, StashApplyFailedError, StashNotFoundError, StoreNotAvailableError, SwitchRefusedError, TransportError as TransportError$1, UnmergedPathsError, UpdateIndexFailedError, WorktreeError } from "./errors/index.js";
3
- import { $ as RevParseCommand, $a as disableHint, $c as checkoutFreshTree, $i as conflictsComment, $n as remergeObjectsView, $r as latin1Bytes$3, Ac as cleanTrackedSparseDirectories, Ai as latin1ToBytes, Al as createIdAbbreviator, Ar as combineNotesOverwrite, At as applyAutostash, Bi as isMergeSuccessful, Bn as readStoredObjectBytes, C as patchRevisionOf, Cc as defaultRefFormat, Ci as readBlob, Co as rerereGcLocation, Cr as initNotes, Cs as quoteCStyleBody, D as PATCH_MODES, Di as ApplyParser, Dl as sequencerPrepareMessage, Do as runRerere, Dr as combineNotesCatSortUniq, Dt as sanitizedSubject, Ei as ApplyEngine, El as sequencerPostCommit, Eo as rerereStatus, Et as relativeDate, Fa as GitCommand, Fc as sparseCheckoutConfig, Fi as newFilePatch, Fl as isGitSpace, Ft as removeMergeBranchState, G as readHeadDescription, Gc as pruneEmptyParents, Gi as commitMessageFromOption, Gl as conflictStyleOf, Gn as verifyCommitBytes, Gt as WorkingCopyStashProvider, H as readShowUntrackedFiles, Ha as signPayload, Hi as cleanupWith, Hl as bareAttributesResolver, Ht as StashCreateCommand, Ia as SIGNING_FAILED_LINES, Ic as sparseDirectoriesOf, Il as wsBlankLine, Io as detectRenames, Ir as reencodedCommitParts, It as resetMerge, J as formatStatusText, Jc as statFollowingLinks, Ji as parseCleanupMode, Js as reflogMessages, Ki as completeLine$1, Kl as mergeVerbosityOf, Kn as verifyMergeSignature, Kr as processTrailers, Kt as ResetCommand, L as TextconvCaches, Lc as sparsePathAdvice, Ll as wsCheckEmit, Lo as GIT_MAX_SCORE, Lr as amendWithTrailers, Lt as resetUnmergedToHead, M as DiffCommand, Mi as latin1ToText, Mo as lowLevelMerge, Mt as createAutostash, Nc as readSparseCheckoutFile, Ni as pathToLatin1, Nl as WS_DEFAULT_RULE, Nr as mailFromHeader, Nt as moveHeadAsReset, O as patchModeFor, Oi as bytesToLatin1, Ol as abbrevLengths, Or as combineNotesConcatenate, Pc as readSparseCheckoutPatterns, Pi as textToLatin1, Pl as checkBlankAtEof, Po as ortConfigOptions, Pr as mailSubjectLine, Pt as removeBranchState, Qc as worktreeModified, Qi as OperationState, Ql as committerIdentOf, Qr as globalPathspecMagic, R as StatusCommand, Ra as SigningFailedError, Rc as sparseWarningText, Ro as isBinaryContent, Rr as appendSignoff, Rt as saveAutostash, Sc as defaultInitialBranch, Si as ortResultEntries, Sl as isKnownHook, So as rerereForget, Sr as initCopyNotesForRewrite, T as runPatchSelection, Tl as runPostCheckoutHook, To as rerereRemaining, Tr as updateNotesRef, Ua as signRequestOf, Ui as commentPrefixOf, Ul as configBool$1, Uo as strerror, Va as signCommit, Vl as attributesSourceResolver, Vo as readGitlinkHead, Vr as ignoredLogMessageBytes, W as SubmoduleSummaryCommand, Wi as commitCleanupMode, Wl as configValue, Xa as ambiguousRemoteAdvice, Xi as stripspace, Xl as InvalidIdentError, Xn as applyMailmapToHeader, Xr as trailerLinesOf, Xs as updateHead, Yc as statThroughLeadingLinks, Yi as preparedMessageCleanup, Yl as InvalidDateError, Yn as GrepPatternError, Yr as trailerConfigOf, Za as applyRefspecs$1, Zi as FlatTreeCache, Zl as authorIdentOf, Zr as validateTrailerArgs, Zs as updateHeadExpecting, _i as parseDateMode, _n as worktreeAdminWorkingCopy, _o as unknownRevisionMessage, _r as createNotesCommit, ai as pathspecCommonPrefix, al as treePathRefusal, ao as trackableStart, ar as forkPointOf, au as withoutCrud, b as collapsedSparseDirectories, bc as checkDefaultObjectStorage, bo as rerereClear, br as expandNotesRef, ca as rewriteIndex, ci as pathspecItemMayMatch, cn as checkCandidatePath, co as worktreeAmbiguityHints, cr as patchIdOfChanges, cu as localTimezoneOffset, da as subjectOf, dc as readRepositoryMailmap, di as treeEntryInteresting, dl as commonGitFileOf, dn as refuseIfCheckedOut, dr as isFullHexObjectId, dt as formatConfigValue, du as moveRefs, ei as latin1String, el as planFlatRestore, en as PathspecFile, eo as endOfSymbolicChain, er as mergeBaseTree, et as revisionMergeBases, eu as hostEnvironmentOf, fa as switchTrees, fc as removeLegacyRemoteFile, fi as treePathspec, fn as repositoryPlaceOf, fo as parseRevisionAndPathArgs, fr as NotesError, ft as gitConfigBool, fu as RemoteConfigStore, gl as gitFileOf, gn as usesBranch, gr as copyNotesForRebase, ha as writeIndexAsTree, hl as gitCommitMessageHooks, hn as useRelativePaths, ho as handleRevisionArg, hr as copyNotesForAmend, hs as formatStat, ht as parseGitColor, i as isRebaseSuccessful, ii as parsePathspecItem, in as LogCommand, io as pushTrackingPlan, ir as commitsBaseSource, jc as entryList, ji as latin1ToPath, jl as worktreeModeTrust, jr as readNoteBytes, jt as cleanupMessage, kc as SparseUnpack, ki as cUnquote, kl as coreBool, kn as parseGitmodules, ko as MergeDriverFailedError, kt as AUTOSTASH_SAVED_LINES, la as storeFlatTree, lc as readMailmapBlob, li as pathspecName, ln as findLinkedWorktree, lr as patchIdsOfPatchText, lt as CONFIG_VALUE_TYPES, lu as parseGitDate, ma as updateIndexCacheTree, mc as InvalidInitialBranchError, mi as DEFAULT_DATE_MODE, ml as gitCommitAfterHooks, mn as shortBranchName, mo as verifyNonFilename, mr as copyNoteForRewrite, mt as normalizeConfigValue, na as indexChanges, nc as promisorOf, ni as matchPathspecSeen, nn as STASH_REF, no as installTracking, nr as storedBase, nt as textconvRunnerOf, oa as readIndex, oc as promisorRemoteReplyOf, oi as pathspecErrors, ol as withTreePathRefusal, on as WorktreeListCommand, oo as uniqueTrackingName, or as PathspecAttributes, ou as approxidateCareful$1, pa as treeDelta, pi as untrackedScanPathspec, pn as requireWorktrees, po as verifyFilename, pr as commitNotes, pt as gitConfigColorBool, pu as listRemoteNames, q as StatusPrinter, qa as signingKeyIdOf, qc as removeDirectoryIfEmpty, qi as editorCleanupMode, qn as verifyTagBytes, qr as signoffLine, qs as reflogLine, ra as indexChangesFromTree, ri as parsePathspec, rl as writeTreeRestorePlan, rn as StashListCommand, ro as planTracking, rr as MergeBaseGraph, sa as refsWatched, si as pathspecItemBytes, sl as worktreePathRules, so as upstreamMissingError, sr as PatchIds, st as readDiffColorSettings, su as formatRfc2822Date, ta as flatTree, ti as matchPathspec, tn as StashApplyCommand, to as guessRemoteBranch, tr as mergeStoredTrees, ua as storeFlatTreeOver, uc as readMailmapFile, ui as psEqual, ur as canonicalObjectId, ut as ConfigValueDeath, uu as deleteRefs, v as AddCommand, vi as showDate, vl as hookHostOf, vn as worktreeUsingBranch, vo as RerereError, vr as defaultNotesRef, vt as formatCommitPretty, w as pathPatchMode, wc as isValidBranchName$1, wi as ApplyCommand, wn as readDiffSubmoduleConfig, wr as readRef, ws as quotePath, wt as parseColorSpec, x as sparseIndexAsRead, xo as rerereDiff, xr as finishCopyNotesForRewrite, xt as loadRefDecorations, y as SPARSE_INDEX_EXPANDED_HINT, yi as GRAPH_COLUMN_COLORS_ANSI, yl as hookRunnerOf, yr as expandLooseNotesRef, z as cutLine, zc as updateSparsity, zo as IndexAdder, zt as squashMessage } from "./results-ERo9vELd.js";
4
- import { $ as relativeFilesPath, $t as BisectRunCommand, A as fetchBundleUri, An as pathCheckoutResult, Bt as signatureStart, C as strictUrlOrigin, Ct as shortlogIdent, D as TransportCommand, E as PlumbingError, En as CheckoutCommand, Et as fillAheadBehind, Ft as RefFormat, G as defaultRemoteOf, I as BundleList, It as RefKind, J as lstatKind, Jt as BisectCommand, K as isRelativeSubmoduleUrl, M as BundleListHeadsCommand, Mn as runPathCheckout, N as BundleUnbundleCommand, Nt as sortRefs, Ot as filterAndFormatRefs, P as BundleVerifyCommand, Q as physicalFilesPath, Qt as BisectResetCommand, R as parseBundleListLine, S as guardSubmoduleTransports, St as readShortlogInput, T as PlumbingCommand, U as SubmoduleGitDirError, W as SubmoduleModel, X as parentIsDirectory, Xt as BisectNextCommand, Y as openConfigFile, Yt as BisectLogCommand, Z as parseSubmoduleUpdateStrategy, Zt as BisectReplayCommand, _ as SubmoduleFetchRepository, a as ReflogCommand, at as setInConfigFile, b as submoduleTouchesInRange, bt as parseShortlogGroup, c as GuardedTransportCommand, ct as upPathOf, dt as validateSubmodulePath, en as BisectSkipCommand, ft as worktreeHostPath, g as uriProtocolsOption, gt as commitSubject$1, h as toTrackingRefUpdate, ht as Shortlog, i as RepackCommand, it as safeCreateLeadingDirectories, jt as parseRefSorting, k as fetchBundleList, kn as nonCommitSwitchError, kt as filterRefs, l as FetchCommand, lt as urlIsLocalNotSsh, m as toTagMode, n as MaintenanceRunCommand, nn as BisectStateCommand, nt as resolveFilesLinks, o as inLinkedWorktree, ot as submodulePathConfigOf, pt as BundleCreateCommand, q as joinFilesPath, qt as RevListCommand, rn as BisectTermsCommand, rt as resolveRelativeUrl, s as objectsDirectoryDisplay, st as submoduleUpdateTypeName, tn as BisectStartCommand, tt as remoteFromUrl, ut as validateSubmoduleGitDir, v as findUnpushedSubmodules, vt as inputLines$2, w as clientSessionIdOf, wt as splitIdent, x as createSubmoduleAuthPolicy, xt as parseShortlogWrap, yt as outputEncoderFor } from "./maintenance-run-command-Bw21HEkH.js";
5
- import { C as WorktreePruneCommand, S as GarbageCollectCommand, _ as remoteHookSession, b as withReceiveTransactionHook, d as withRemoteUploadPack, f as createDuplexPair, g as receivePackSettingsOf, h as receiveFsckSettingsOf, l as withRemoteReceivePack, p as httpBackendEnv, u as withRemoteSession, v as servedMaxTreeDepth, w as BundlePrerequisitesError, x as ReadTreeCommand, y as servedUseBitmaps } from "./remote-transport-Bu4PGSMD.js";
3
+ import { $c as statFollowingLinks, $i as stripspace, $l as configValue, $n as applyMailmapToHeader, $r as trailerLinesOf, Ai as ApplyParser, Al as runPostCheckoutHook, Ao as rerereStatus, Ar as combineNotesCatSortUniq, At as AUTOSTASH_SAVED_LINES, Bc as sparseCheckoutConfig, Bl as worktreeModeTrust, Bo as detectRenames, Br as amendWithTrailers, Bt as squashMessage, C as patchRevisionOf, Cc as UnsupportedObjectStorageError, Cl as hookHostOf, Cr as expandNotesRef, D as PATCH_MODES, Dc as defaultRefFormat, Di as ApplyCommand, Dl as isKnownHook, Dn as readDiffSubmoduleConfig, Do as rerereGcLocation, Dr as readRef, Ds as quoteCStyleBody, Dt as relativeDate, Ec as defaultInitialBranch, Ei as readBlob, Eo as rerereForget, Er as initNotes, Fc as cleanTrackedSparseDirectories, Fi as latin1ToText, Ft as removeBranchState, G as SubmoduleSummaryCommand, Ga as signPayload, Gi as cleanupWith, Gl as wsBlankLine, Go as readGitlinkHead, H as readShowUntrackedFiles, Hc as sparsePathAdvice, Hl as WS_DEFAULT_RULE, Ho as isBinaryContent, Ic as entryList, Ii as pathToLatin1, Io as lowLevelMerge, Ir as mailFromHeader, It as removeMergeBranchState, J as StatusPrinter, Ji as commitMessageFromOption, Jn as verifyCommitBytes, K as readHeadDescription, Ka as signRequestOf, Ki as commentPrefixOf, Kl as wsCheckEmit, Kt as WorkingCopyStashProvider, L as TextconvCaches, Li as textToLatin1, Ll as abbrevLengths, Lr as mailSubjectLine, Lt as resetMerge, M as DiffCommand, Mi as cUnquote, Ml as sequencerPrepareMessage, Mn as parseGitmodules, Mt as cleanupMessage, Ni as latin1ToBytes, Nl as fsmonitorModeOf, No as MergeDriverFailedError, Nr as combineNotesOverwrite, Nt as createAutostash, O as patchModeFor, Oc as isValidBranchName$1, Or as updateNotesRef, Os as quotePath, Ot as sanitizedSubject, Pc as SparseUnpack, Pi as latin1ToPath, Pr as readNoteBytes, Pt as moveHeadAsReset, Qc as removeDirectoryIfEmpty, Qi as preparedMessageCleanup, Ql as configBool$1, Qn as GrepPatternError, Qr as trailerConfigOf, Qs as reflogMessages, R as StatusCommand, Ra as GitCommand, Rc as readSparseCheckoutFile, Ri as newFilePatch, Rl as coreBool, Ro as ortConfigOptions, Rt as resetUnmergedToHead, Si as GRAPH_COLUMN_COLORS_ANSI, So as RerereError, Sr as expandLooseNotesRef, St as loadRefDecorations, Su as listRemoteNames, T as runPatchSelection, Ti as ortResultEntries, To as rerereDiff, Tr as initCopyNotesForRewrite, Tt as parseColorSpec, Uc as sparseWarningText, Ui as isMergeSuccessful, Ul as checkBlankAtEof, Un as readStoredObjectBytes, Uo as IndexAdder, Ut as StashCreateCommand, Va as SigningFailedError, Vc as sparseDirectoriesOf, Vo as GIT_MAX_SCORE, Vr as appendSignoff, Wa as signCommit, Wc as updateSparsity, Wl as isGitSpace, Wr as ignoredLogMessageBytes, Xc as pruneEmptyParents, Xi as editorCleanupMode, Xl as attributesSourceResolver, Xn as verifyTagBytes, Xr as signoffLine, Y as formatStatusText, Yi as completeLine$1, Yn as verifyMergeSignature, Yr as processTrailers, Za as signingKeyIdOf, Zi as parseCleanupMode, Zl as bareAttributesResolver, Zs as reflogLine, _a as updateIndexCacheTree, _i as DEFAULT_DATE_MODE, _n as shortBranchName, _o as verifyFilename, _r as copyNoteForRewrite, _u as localTimezoneOffset, aa as indexChanges, ai as matchPathspecSeen, al as planFlatRestore, an as STASH_REF, ao as guessRemoteBranch, ar as storedBase, au as InvalidIdentError, b as collapsedSparseDirectories, bi as parseDateMode, bl as gitCommitMessageHooks, bn as worktreeAdminWorkingCopy, br as createNotesCommit, bu as moveRefs, ci as pathspecCommonPrefix, cl as writeTreeRestorePlan, co as pushTrackingPlan, cr as forkPointOf, ct as readDiffColorSettings, da as rewriteIndex, di as pathspecItemMayMatch, dl as withTreePathRefusal, dn as checkCandidatePath, do as upstreamMissingError, dr as patchIdOfChanges, dt as ConfigValueDeath, ea as FlatTreeCache, ec as updateHead, ei as validateTrailerArgs, el as statThroughLeadingLinks, eo as ambiguousRemoteAdvice, et as RevParseCommand, eu as conflictStyleOf, fa as storeFlatTree, fi as pathspecName, fl as worktreePathRules, fn as findLinkedWorktree, fo as worktreeAmbiguityHints, fr as patchIdsOfPatchText, ft as formatConfigValue, ga as treeDelta, gc as removeLegacyRemoteFile, gi as untrackedScanPathspec, gl as commonGitFileOf, gn as requireWorktrees, go as parseRevisionAndPathArgs, gr as commitNotes, gt as parseGitColor, gu as formatRfc2822Date, ha as switchTrees, hc as readRepositoryMailmap, hi as treePathspec, hn as repositoryPlaceOf, hr as NotesError, ht as normalizeConfigValue, hu as approxidateCareful$1, i as isRebaseSuccessful, ia as flatTree, ii as matchPathspec, il as checkoutFreshTree, in as StashApplyCommand, io as endOfSymbolicChain, ir as mergeStoredTrees, iu as InvalidDateError, ji as bytesToLatin1, jl as sequencerPostCommit, jo as runRerere, jr as combineNotesConcatenate, jt as applyAutostash, kc as unknownObjectStorageFormat, ki as ApplyEngine, ko as rerereRemaining, la as readIndex, li as pathspecErrors, ln as WorktreeListCommand, lo as trackableStart, lr as PathspecAttributes, lu as hostEnvironmentOf, ma as subjectOf, mc as readMailmapFile, mi as treeEntryInteresting, mn as refuseIfCheckedOut, mr as isFullHexObjectId, mt as gitConfigColorBool, mu as withoutCrud, na as conflictsComment, ni as latin1Bytes$3, nr as remergeObjectsView, oa as indexChangesFromTree, oc as promisorOf, oi as parsePathspec, on as StashListCommand, oo as installTracking, or as MergeBaseGraph, ou as authorIdentOf, pa as storeFlatTreeOver, pc as readMailmapBlob, pi as psEqual, pr as canonicalObjectId, pt as gitConfigBool, qa as signTagCompat, qi as commitCleanupMode, qo as strerror, qt as ResetCommand, ri as latin1String, rl as worktreeModified, rn as PathspecFile, ro as disableHint, rr as mergeBaseTree, rt as textconvRunnerOf, si as parsePathspecItem, sn as LogCommand, so as planTracking, sr as commitsBaseSource, su as committerIdentOf, ta as OperationState, tc as updateHeadExpecting, ti as globalPathspecMagic, to as applyRefspecs$1, tt as revisionMergeBases, tu as mergeVerbosityOf, ua as refsWatched, uc as promisorRemoteReplyOf, ui as pathspecItemBytes, ul as treePathRefusal, uo as uniqueTrackingName, ur as PatchIds, ut as CONFIG_VALUE_TYPES, v as AddCommand, va as writeIndexAsTree, vc as InvalidInitialBranchError, vn as useRelativePaths, vo as verifyNonFilename, vr as copyNotesForAmend, vu as parseGitDate, w as pathPatchMode, wc as checkDefaultObjectStorage, wl as hookRunnerOf, wo as rerereClear, wr as finishCopyNotesForRewrite, x as sparseIndexAsRead, xi as showDate, xl as gitFileOf, xn as worktreeUsingBranch, xo as unknownRevisionMessage, xr as defaultNotesRef, xu as RemoteConfigStore, y as SPARSE_INDEX_EXPANDED_HINT, yl as gitCommitAfterHooks, yn as usesBranch, yo as handleRevisionArg, yr as copyNotesForRebase, ys as formatStat, yt as formatCommitPretty, yu as deleteRefs, z as cutLine, za as SIGNING_FAILED_LINES, zc as readSparseCheckoutPatterns, zl as createIdAbbreviator, zr as reencodedCommitParts, zt as saveAutostash } from "./results-CNHQnU5Y.js";
4
+ import { $ as relativeFilesPath, $t as BisectRunCommand, A as fetchBundleUri, An as pathCheckoutResult, Bt as signatureStart, C as strictUrlOrigin, Ct as shortlogIdent, D as TransportCommand, E as PlumbingError, En as CheckoutCommand, Et as fillAheadBehind, Ft as RefFormat, G as defaultRemoteOf, I as BundleList, It as RefKind, J as lstatKind, Jt as BisectCommand, K as isRelativeSubmoduleUrl, M as BundleListHeadsCommand, Mn as runPathCheckout, N as BundleUnbundleCommand, Nt as sortRefs, Ot as filterAndFormatRefs, P as BundleVerifyCommand, Q as physicalFilesPath, Qt as BisectResetCommand, R as parseBundleListLine, S as guardSubmoduleTransports, St as readShortlogInput, T as PlumbingCommand, U as SubmoduleGitDirError, W as SubmoduleModel, X as parentIsDirectory, Xt as BisectNextCommand, Y as openConfigFile, Yt as BisectLogCommand, Z as parseSubmoduleUpdateStrategy, Zt as BisectReplayCommand, _ as SubmoduleFetchRepository, a as ReflogCommand, at as setInConfigFile, b as submoduleTouchesInRange, bt as parseShortlogGroup, c as GuardedTransportCommand, ct as upPathOf, dt as validateSubmodulePath, en as BisectSkipCommand, ft as worktreeHostPath, g as uriProtocolsOption, gt as commitSubject$1, h as toTrackingRefUpdate, ht as Shortlog, i as RepackCommand, it as safeCreateLeadingDirectories, jt as parseRefSorting, k as fetchBundleList, kn as nonCommitSwitchError, kt as filterRefs, l as FetchCommand, lt as urlIsLocalNotSsh, m as toTagMode, n as MaintenanceRunCommand, nn as BisectStateCommand, nt as resolveFilesLinks, o as inLinkedWorktree, ot as submodulePathConfigOf, pt as BundleCreateCommand, q as joinFilesPath, qt as RevListCommand, rn as BisectTermsCommand, rt as resolveRelativeUrl, s as objectsDirectoryDisplay, st as submoduleUpdateTypeName, tn as BisectStartCommand, tt as remoteFromUrl, ut as validateSubmoduleGitDir, v as findUnpushedSubmodules, vt as inputLines$2, w as clientSessionIdOf, wt as splitIdent, x as createSubmoduleAuthPolicy, xt as parseShortlogWrap, yt as outputEncoderFor } from "./maintenance-run-command-Cx2PlGV9.js";
5
+ import { C as WorktreePruneCommand, S as GarbageCollectCommand, _ as remoteHookSession, b as withReceiveTransactionHook, d as withRemoteUploadPack, f as createDuplexPair, g as receivePackSettingsOf, h as receiveFsckSettingsOf, l as withRemoteReceivePack, p as httpBackendEnv, u as withRemoteSession, v as servedMaxTreeDepth, w as BundlePrerequisitesError, x as ReadTreeCommand, y as servedUseBitmaps } from "./remote-transport-BrQZfyHu.js";
6
6
  import { CorruptObjectError, DEFAULT_BIG_FILE_THRESHOLD, EMPTY_BLOB_ID, EMPTY_TREE_ID, FileMode, InvalidTreeEntryNameError, MemoryRawStorage, ObjectType, RefStorage, bloomFilterContains, bloomKey, collapseRefNameSlashes, collectTagBytes, compareRefNames, countAheadBehind, createGitObjects, createInMemoryFilesApi, createMemoryHistory, decodeTreeBytes, formatPersonIdent, historyWithoutLazyFetch, importPack, isSymbolicRef, isValidBranchName, isValidRefName, isValidTagName, isValidWorktreePath, joinPath, listObjectsWithPrefix, objectFormatOf, overlayMethods, overlayObjects, packNameOf, parseCoreAbbrev, parseGraftFile, parseObjectFilter, parsePersonIdent, rawStorageStaging, readFile, replacementOf, serializeCommit, serializeTag, unpackObjects } from "@statewalker/vcs-core";
7
7
  import { compareGitPaths, decodeGitPath, decodeGitPatternFile, encodeGitPath, foldAsciiCase, parseGitBool, parseGitInt, unquoteGitPath } from "@statewalker/vcs-utils/encoding";
8
- import { AttributesMemo, AttributesSourceError, DIR_COLLECT_KILLED_ONLY, DIR_HIDE_EMPTY_DIRECTORIES, DIR_SHOW_IGNORED, DIR_SHOW_OTHER_DIRECTORIES, FilterDriverError, IndexPathLookup, WorktreeFormatUpgradeError, attributesIndexOf, attributesIndexOfTree, basicStatMatches, cacheTreeOfTree, collectChunks, commandLineExcluded, compareWithWorktree, convAttrsOf, createCommandLineExcludes, createIgnoreNode, createMemoryCheckout, crlfToWorktree, entryStatOf, eolStatsAscii, expandUserPath, getWorktreeEntries, identToWorktree, invalidateCacheTreePath, isIndexUnborn, isValidAttributeName, modeFromWorktree, readConversionSettings, reencode, scanUntracked, smudgeContent, sparseFilterMatcher, sparsePatternsFromCone, sparsePatternsFromLines, splitPatternLines, storeWorktreeFile, unreadableDirectoryWarning, walkUntrackedScanHost, wholeSeconds, wildmatch, withWorktreeEntries, xdgConfigPath } from "@statewalker/vcs-working-tree";
8
+ import { AttributesMemo, AttributesSourceError, DIR_COLLECT_KILLED_ONLY, DIR_HIDE_EMPTY_DIRECTORIES, DIR_SHOW_IGNORED, DIR_SHOW_OTHER_DIRECTORIES, FilterDriverError, FsmonitorState, IndexPathLookup, WorktreeFormatUpgradeError, attributesIndexOf, attributesIndexOfTree, basicStatMatches, cacheTreeOfTree, collectChunks, commandLineExcluded, compareWithWorktree, convAttrsOf, createCommandLineExcludes, createIgnoreNode, createMemoryCheckout, crlfToWorktree, entryStatOf, eolStatsAscii, expandUserPath, getWorktreeEntries, identToWorktree, invalidateCacheTreePath, isIndexUnborn, isValidAttributeName, modeFromWorktree, readConversionSettings, readIndexFileEntries, reencode, scanUntracked, smudgeContent, sparseFilterMatcher, sparsePatternsFromCone, sparsePatternsFromLines, splitPatternLines, storeWorktreeFile, unreadableDirectoryWarning, walkUntrackedScanHost, wholeSeconds, wildmatch, withWorktreeEntries, xdgConfigPath } from "@statewalker/vcs-working-tree";
9
9
  import { ByteLines, LineInterner, PosixRegexError, SHA1_OBJECT_FORMAT, URL_COMPONENTS, XDF_IGNORE_CR_AT_EOL, XDF_IGNORE_WHITESPACE, XDF_IGNORE_WHITESPACE_AT_EOL, XDF_IGNORE_WHITESPACE_CHANGE, approxidateCareful, compilePosixRegex, decodeGitPath as decodeGitPath$1, encodeGitPath as encodeGitPath$1, formatHunkHeader, funcnameFindFunction, gitStrWidth as gitStrWidth$1, isUrlNormalizeError, mergeLines, normalizeUrl, nullObjectIdLike, objectFormatByName, parseGitBool as parseGitBool$1, parseGitInt as parseGitInt$1, selectUrlMatches, unifiedDiff, unifiedDiffHunks, urlComponent, urlParse, whitespaceFlags, xdiffHunks, xdlHashRecord } from "@statewalker/vcs-utils";
10
10
  import { FileMode as FileMode$1, PERM_GROUP, adjustSharedPerm, dirname, joinPath as joinPath$1, normalizePath, parseSharedRepository as parseSharedRepository$1, readFile as readFile$1, sharedRepositoryConfigValue, sharedRepositoryOf, tryReadFile, withSharedPerm } from "@statewalker/vcs-utils/files";
11
11
  import { SHA1_OBJECT_FORMAT as SHA1_OBJECT_FORMAT$1, SHA256_OBJECT_FORMAT as SHA256_OBJECT_FORMAT$1, isNullObjectId as isNullObjectId$1 } from "@statewalker/vcs-utils/hash";
12
- import { CONFIG_REGEX_NONE, ConfigParseError, FileStagingStore, GitWorkingCopyConfig, HostPaths, MissingRootError, RefMigrationError, ReflogExpiryConfigError, computeAlternatePath, configFilesApiOf, createFileWorktree, createGitFilesHistoryFromFiles, createWorkingCopyConfig, hostPathOf, hostRootOf, isAbsoluteGitPath, isGitDirectory, migrateRefStorage, openGitLinkedWorktrees, parseConfigKey, parseExpiryDate, parseGitfile, prepareConfigComment, probeCaseFolding, prune, readConfigFileThroughLinks, readProtectedConfig, readReftableWriteOptions, readRepositoryFormat, refStoreRetirement, renameConfigSectionInFile, rerereGc, resolveLinkedGitDir, retireRefStore, setConfigMultivarInFile, setConfigMultivarText, verifyRefStorage } from "@statewalker/vcs-store-files";
12
+ import { CONFIG_REGEX_NONE, ConfigParseError, FileStagingStore, GitWorkingCopyConfig, HostPaths, MissingRootError, RefMigrationError, ReflogExpiryConfigError, computeAlternatePath, configFilesApiOf, createFileWorktree, createGitFilesHistoryFromFiles, createWorkingCopyConfig, hostPathOf, hostRootOf, isAbsoluteGitPath, isGitDirectory, migrateRefStorage, objectStorageFormatByUri, openGitLinkedWorktrees, parseConfigKey, parseExpiryDate, parseGitfile, prepareConfigComment, probeCaseFolding, prune, readConfigFileThroughLinks, readProtectedConfig, readReftableWriteOptions, readRepositoryFormat, refStoreRetirement, renameConfigSectionInFile, rerereGc, resolveLinkedGitDir, retireRefStore, setConfigMultivarInFile, setConfigMultivarText, setupGitDirectory, verifyRefStorage } from "@statewalker/vcs-store-files";
13
13
  import { FetchCheckError, ObjectFormatMismatchError, ObjectInfoError, PushCertificateError, PushRefspecError, PushRefusedByHookError, ReceivedObjects, ShallowRemoteRejectedError, anonymizeUrl, bundleUriLines, checkUnpackedObjects, countRefspecMatch, createDefaultTransports, createRepositoryFacade, createTransportRefStore, expandFromDestination, expandFromSource, fetchFromConnection, fetchObjectInfo, formatPushStatus, gitDaemonRequest, lsRefs, mapRefs, mapRejectReason, matchDestination, matchPushRefs, matchSource, missingSources, objectSource, packObjectsHookArgs, parseConfigInt, parseRefSpec, pushToConnection, refPrefixes, repositoryQuarantine, requestRemoteArchive, serveUploadArchive, servedGitFilesOf } from "@statewalker/vcs-transport";
14
14
  import { MemoryStagingStore } from "@statewalker/vcs-store-mem";
15
15
  import { deflateSync } from "@statewalker/vcs-utils/compression";
@@ -2436,13 +2436,26 @@ var AmCommand = class extends GitCommand {
2436
2436
  let header = "";
2437
2437
  if (sign !== void 0) {
2438
2438
  const payload = encodeGitPath(head + body);
2439
- const signature = latin1ToPath(bytesToLatin1(await this.signOrDie((cwd) => signPayload(this.workingCopy, sign, payload, {
2439
+ const signBytes = async (bytes) => latin1ToPath(bytesToLatin1(await this.signOrDie((cwd) => signPayload(this.workingCopy, sign, bytes, {
2440
2440
  committer,
2441
2441
  tail: [],
2442
2442
  ...cwd !== void 0 ? { cwd } : {}
2443
2443
  }))));
2444
- const lines = (signature.endsWith("\n") ? signature.slice(0, -1) : signature).split("\n");
2445
- header = `${this.objectFormat.signatureHeader} ${lines.join("\n ")}\n`;
2444
+ const headerOf = (name, signature) => `${name} ${(signature.endsWith("\n") ? signature.slice(0, -1) : signature).split("\n").join("\n ")}\n`;
2445
+ const signatures = [{
2446
+ name: this.objectFormat.signatureHeader,
2447
+ value: await signBytes(payload)
2448
+ }];
2449
+ const compat = objects.compat;
2450
+ if (compat) {
2451
+ const compatPayload = await compat.convertToCompat("commit", payload);
2452
+ signatures.push({
2453
+ name: compat.compat.signatureHeader,
2454
+ value: await signBytes(compatPayload)
2455
+ });
2456
+ signatures.sort((a, b) => a.name === "gpgsig" ? -1 : b.name === "gpgsig" ? 1 : 0);
2457
+ }
2458
+ header = signatures.map((s) => headerOf(s.name, s.value)).join("");
2446
2459
  }
2447
2460
  id = await objects.putUnsized("commit", [encodeGitPath(head + header + body)]);
2448
2461
  } else {
@@ -11118,7 +11131,7 @@ const OBJECT_TYPES = /* @__PURE__ */ new Set([
11118
11131
  "tag"
11119
11132
  ]);
11120
11133
  const S_IFMT$8 = 61440;
11121
- const S_IFGITLINK$4 = 57344;
11134
+ const S_IFGITLINK$5 = 57344;
11122
11135
  const encoder$6 = new TextEncoder();
11123
11136
  const MAILMAP_HEADERS = [
11124
11137
  "author ",
@@ -11332,17 +11345,20 @@ var CatFileCommand = class extends PlumbingCommand {
11332
11345
  }
11333
11346
  /** cat_one_file */
11334
11347
  async catOne(name) {
11335
- const compat = this.compatObjects;
11336
- if (compat && name.length === compat.compat.hexLength && /^[0-9a-f]+$/.test(name)) return this.catOneCompat(name, compat);
11337
11348
  const resolver = this.revisionResolver();
11338
11349
  let id;
11339
11350
  try {
11340
- id = await resolver.resolve(name, { onlyToDie: true });
11351
+ id = await resolver.resolve(name, {
11352
+ onlyToDie: true,
11353
+ hashAny: true
11354
+ });
11341
11355
  } finally {
11342
11356
  for (const line of resolver.warnings) this.warn(line);
11343
11357
  resolver.warnings.length = 0;
11344
11358
  }
11345
11359
  if (id === void 0) throw new PlumbingError(`fatal: Not a valid object name ${name}`);
11360
+ const compat = this.compatIdOf(id);
11361
+ if (compat) return this.catOneCompat(id, compat);
11346
11362
  const couldNotGetInfo = () => new PlumbingError("fatal: git cat-file: could not get object info");
11347
11363
  switch (this.mode) {
11348
11364
  case "type": {
@@ -11368,6 +11384,11 @@ var CatFileCommand = class extends PlumbingCommand {
11368
11384
  default: return this.catTyped(name, id, this.type);
11369
11385
  }
11370
11386
  }
11387
+ /** The compatibility objects when `id` is an id of the compatibility format (not storage's) */
11388
+ compatIdOf(id) {
11389
+ const compat = this.compatObjects;
11390
+ return compat && id.length !== this.objectFormat.hexLength ? compat : void 0;
11391
+ }
11371
11392
  /**
11372
11393
  * cat_one_file for an id of the compatibility format: the object read through the map and
11373
11394
  * converted (`odb_read_object_info_extended` with an id of the other format).
@@ -11397,7 +11418,7 @@ var CatFileCommand = class extends PlumbingCommand {
11397
11418
  checkNames: false
11398
11419
  })) {
11399
11420
  const kind = entry.mode & S_IFMT$8;
11400
- const type = kind === 16384 ? "tree" : kind === S_IFGITLINK$4 ? "commit" : "blob";
11421
+ const type = kind === 16384 ? "tree" : kind === S_IFGITLINK$5 ? "commit" : "blob";
11401
11422
  const mode = entry.mode.toString(8).padStart(6, "0");
11402
11423
  out += `${mode} ${type} ${entry.id}\t${quotePath(entry.name, quoteFully)}\n`;
11403
11424
  }
@@ -11449,7 +11470,7 @@ var CatFileCommand = class extends PlumbingCommand {
11449
11470
  let out = "";
11450
11471
  for (const entry of entries) {
11451
11472
  const kind = entry.mode & S_IFMT$8;
11452
- const type = kind === 16384 ? "tree" : kind === S_IFGITLINK$4 ? "commit" : "blob";
11473
+ const type = kind === 16384 ? "tree" : kind === S_IFGITLINK$5 ? "commit" : "blob";
11453
11474
  const mode = entry.mode.toString(8).padStart(6, "0");
11454
11475
  out += `${mode} ${type} ${entry.id}\t${quotePath(entry.name, quoteFully)}\n`;
11455
11476
  if (out.length >= 65536) {
@@ -11651,7 +11672,7 @@ var CatFileCommand = class extends PlumbingCommand {
11651
11672
  async batchOne(state, resolver, name, rest) {
11652
11673
  let id;
11653
11674
  try {
11654
- id = await resolver.resolve(name);
11675
+ id = await resolver.resolve(name, { hashAny: true });
11655
11676
  } finally {
11656
11677
  for (const line of resolver.warnings) this.warn(line);
11657
11678
  }
@@ -11667,13 +11688,37 @@ var CatFileCommand = class extends PlumbingCommand {
11667
11688
  ...rest !== void 0 ? { rest } : {}
11668
11689
  });
11669
11690
  }
11691
+ /**
11692
+ * batch_object_write for an id of the compatibility format (`GET_OID_HASH_ANY` in
11693
+ * batch_one_object): the object read through the map and converted, so its id, type, size
11694
+ * and content are the compatibility format's. Replace refs are storage ids: they do not
11695
+ * apply to it.
11696
+ */
11697
+ async batchCompatWrite(state, name, data, compat) {
11698
+ const object = await compat.readAsCompat(data.id);
11699
+ if (!object) {
11700
+ await this.write(`${name ?? data.id} missing${state.delim}`);
11701
+ return;
11702
+ }
11703
+ let content = object.content;
11704
+ if (this.useMailmap && (object.type === "commit" || object.type === "tag")) content = await this.mapIdents(content);
11705
+ data.type = object.type;
11706
+ data.size = content.length;
11707
+ const header = state.plain ? `${data.id} ${data.type} ${data.size}${state.delim}` : `${expandBatchFormat(state.format, data)}${state.delim}`;
11708
+ await this.write(header);
11709
+ if (!state.contents) return;
11710
+ await this.write(content);
11711
+ await this.write(state.delim);
11712
+ }
11670
11713
  /** batch_object_write */
11671
11714
  async batchObjectWrite(state, name, data) {
11715
+ const compat = this.compatIdOf(data.id);
11716
+ if (compat) return this.batchCompatWrite(state, name, data, compat);
11672
11717
  const target = state.replace ? await this.replaced(data.id) : data.id;
11673
11718
  const info = await this.info(target);
11674
11719
  if (!info) {
11675
11720
  if (this.compatibility !== "2.43" && data.mode !== void 0) {
11676
- if ((data.mode & S_IFMT$8) === S_IFGITLINK$4) {
11721
+ if ((data.mode & S_IFMT$8) === S_IFGITLINK$5) {
11677
11722
  await this.write(`${data.id} submodule${state.delim}`);
11678
11723
  return;
11679
11724
  }
@@ -12000,7 +12045,7 @@ const USAGE$10 = "usage: git check-attr [--source <tree-ish>] [-a | --all | <att
12000
12045
  const S_IFMT$7 = 61440;
12001
12046
  const S_IFDIR$5 = 16384;
12002
12047
  const S_IFLNK$2 = 40960;
12003
- const S_IFGITLINK$3 = 57344;
12048
+ const S_IFGITLINK$4 = 57344;
12004
12049
  /**
12005
12050
  * An attributes file's message as git prints it: its `warning()`s (negative patterns, an
12006
12051
  * overly long line or large file) prefixed, the others (an invalid name, a macro where none
@@ -12206,10 +12251,10 @@ var CheckAttrCommand = class extends GitCommand {
12206
12251
  const entry = await this.worktreeIfAny()?.getEntry(path).catch(() => void 0);
12207
12252
  if (!entry) return { error: `unable to stat '${path}': No such file or directory` };
12208
12253
  if (entry.isDirectory || (entry.mode & S_IFMT$7) === S_IFDIR$5) {
12209
- if (indexEntry && (indexEntry.mode & S_IFMT$7) === S_IFGITLINK$3) return octal(indexEntry.mode);
12210
- return octal((entry.mode & S_IFMT$7) === S_IFGITLINK$3 ? S_IFGITLINK$3 : S_IFDIR$5);
12254
+ if (indexEntry && (indexEntry.mode & S_IFMT$7) === S_IFGITLINK$4) return octal(indexEntry.mode);
12255
+ return octal((entry.mode & S_IFMT$7) === S_IFGITLINK$4 ? S_IFGITLINK$4 : S_IFDIR$5);
12211
12256
  }
12212
- if ((entry.mode & S_IFMT$7) === S_IFGITLINK$3) return octal(S_IFGITLINK$3);
12257
+ if ((entry.mode & S_IFMT$7) === S_IFGITLINK$4) return octal(S_IFGITLINK$4);
12213
12258
  if ((entry.mode & S_IFMT$7) === S_IFLNK$2) return octal(S_IFLNK$2);
12214
12259
  return octal(entry.mode & 73 ? 33261 : 33188);
12215
12260
  }
@@ -12229,7 +12274,7 @@ var CheckAttrCommand = class extends GitCommand {
12229
12274
  */
12230
12275
  const S_IFMT$6 = 61440;
12231
12276
  const S_IFLNK$1 = 40960;
12232
- const S_IFGITLINK$2 = 57344;
12277
+ const S_IFGITLINK$3 = 57344;
12233
12278
  const S_IFDIR$4 = 16384;
12234
12279
  /**
12235
12280
  * `git check-ignore [-q] [-v [-n]] [--no-index] (<pathname>... | --stdin [-z])`: each path the
@@ -12336,7 +12381,7 @@ var CheckIgnoreCommand = class extends GitCommand {
12336
12381
  if (entry && (entry.mode & S_IFMT$6) === S_IFLNK$1) return `pathspec '${original}' is beyond a symbolic link`;
12337
12382
  }
12338
12383
  if (staging) {
12339
- for (const e of index) if ((e.mode & S_IFMT$6) === S_IFGITLINK$2 && path.startsWith(`${e.path}/`)) return `Pathspec '${original}' is in submodule '${e.path}'`;
12384
+ for (const e of index) if ((e.mode & S_IFMT$6) === S_IFGITLINK$3 && path.startsWith(`${e.path}/`)) return `Pathspec '${original}' is in submodule '${e.path}'`;
12340
12385
  }
12341
12386
  let match;
12342
12387
  if (!staging || !this.seenInIndex(full, index)) {
@@ -12400,7 +12445,7 @@ var CheckIgnoreCommand = class extends GitCommand {
12400
12445
  return false;
12401
12446
  }
12402
12447
  for (const e of index) {
12403
- const dir = (e.mode & S_IFMT$6) === S_IFGITLINK$2 || (e.mode & S_IFMT$6) === S_IFDIR$4;
12448
+ const dir = (e.mode & S_IFMT$6) === S_IFGITLINK$3 || (e.mode & S_IFMT$6) === S_IFDIR$4;
12404
12449
  if (matchPathspec([item], e.path, dir ? 1 : 0)) return true;
12405
12450
  }
12406
12451
  return false;
@@ -33551,6 +33596,7 @@ var SubmoduleUpdateCommand = class SubmoduleUpdateCommand extends SubmoduleComma
33551
33596
  requireInit = false;
33552
33597
  /** `--filter=<spec>` of the clones */
33553
33598
  filter;
33599
+ objectStorageFormat;
33554
33600
  /** `--[no-]single-branch` of the clones */
33555
33601
  singleBranch;
33556
33602
  transports;
@@ -33627,6 +33673,16 @@ var SubmoduleUpdateCommand = class SubmoduleUpdateCommand extends SubmoduleComma
33627
33673
  this.recommendShallow = recommend;
33628
33674
  return this;
33629
33675
  }
33676
+ /**
33677
+ * `--object-storage-format=<name>` (git master): the object storage of the submodules
33678
+ * cloned. Only `files` is a name git knows (the repository as always); anything else,
33679
+ * `files://<dir>` included, dies `unknown object storage format '<v>'` before any work.
33680
+ */
33681
+ setObjectStorageFormat(format) {
33682
+ this.checkCallable();
33683
+ this.objectStorageFormat = format;
33684
+ return this;
33685
+ }
33630
33686
  /** `--filter=<spec>`: partial clones of the submodules (`CloneCommand.setFilter`). */
33631
33687
  setFilter(spec) {
33632
33688
  this.checkCallable();
@@ -33759,6 +33815,10 @@ var SubmoduleUpdateCommand = class SubmoduleUpdateCommand extends SubmoduleComma
33759
33815
  }
33760
33816
  async call() {
33761
33817
  this.start();
33818
+ if (this.objectStorageFormat !== void 0) {
33819
+ const unknown = unknownObjectStorageFormat(this.objectStorageFormat, "name");
33820
+ if (unknown) this.die(unknown);
33821
+ }
33762
33822
  if (this.requireInit) this.init = true;
33763
33823
  const list = await this.moduleList(this.paths);
33764
33824
  if (!list) return this.finish();
@@ -34322,6 +34382,7 @@ const CLONE_SETTINGS = [
34322
34382
  "dissociate",
34323
34383
  "references",
34324
34384
  "recurseSubmodules",
34385
+ "objectStorageFormat",
34325
34386
  "shallowSubmodules",
34326
34387
  "alsoFilterSubmodules",
34327
34388
  "remoteSubmodules",
@@ -34447,6 +34508,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
34447
34508
  references = [];
34448
34509
  /** `--recurse-submodules[=<pathspec>]` values, in the order given */
34449
34510
  recurseSubmodules = [];
34511
+ objectStorageFormat;
34450
34512
  shallowSubmodules = false;
34451
34513
  /** `--[no-]also-filter-submodules`; unset: `clone.filterSubmodules` */
34452
34514
  alsoFilterSubmodules;
@@ -34915,6 +34977,18 @@ var CloneCommand = class CloneCommand extends TransportCommand {
34915
34977
  * `protocol.file.allow=always`. Credentials and headers reach a submodule's URL only as
34916
34978
  * `SubmoduleUpdateCommand.setCredentials` allows (the clone's own origin).
34917
34979
  */
34980
+ /**
34981
+ * `--object-storage-format=<format>`: the clone's object storage (git master). `files` is
34982
+ * the repository as always and is passed on to the submodules a recursive clone makes; a
34983
+ * name git does not know dies as git (`unknown object storage format '<v>'`), and
34984
+ * `files://<directory>`, objects outside `objects/`, which we do not read, is refused
34985
+ * before anything is fetched (`UnsupportedObjectStorageError`).
34986
+ */
34987
+ setObjectStorageFormat(format) {
34988
+ this.checkCallable();
34989
+ this.objectStorageFormat = format;
34990
+ return this;
34991
+ }
34918
34992
  setRecurseSubmodules(recurse) {
34919
34993
  this.checkCallable();
34920
34994
  this.recurseSubmodules = recurse === true ? ["."] : recurse === false ? [] : [...recurse];
@@ -35001,6 +35075,11 @@ var CloneCommand = class CloneCommand extends TransportCommand {
35001
35075
  }
35002
35076
  async cloneOnce() {
35003
35077
  if (!this.uri) throw new InvalidRemoteError("", "URI must be specified for clone");
35078
+ if (this.objectStorageFormat !== void 0) {
35079
+ const unknown = unknownObjectStorageFormat(this.objectStorageFormat, "uri");
35080
+ if (unknown) throw new GitApiError(unknown);
35081
+ if (objectStorageFormatByUri(this.objectStorageFormat)?.payload !== void 0) throw new UnsupportedObjectStorageError(this.objectStorageFormat);
35082
+ }
35004
35083
  const submoduleConfig = [];
35005
35084
  if (this.recurseSubmodules.length > 0) {
35006
35085
  const patterns = [...new Set(this.recurseSubmodules)].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
@@ -35019,10 +35098,15 @@ var CloneCommand = class CloneCommand extends TransportCommand {
35019
35098
  if (this.bundleUri !== void 0 && (this.depth !== void 0 || this.shallowSince !== void 0 || this.shallowExcludes.length > 0)) throw new GitApiError(compatibility === "2.43" ? "fatal: --bundle-uri is incompatible with --depth, --shallow-since, and --shallow-exclude" : "fatal: options '--bundle-uri' and '--depth/--shallow-since/--shallow-exclude' cannot be used together");
35020
35099
  const uri = this.uri;
35021
35100
  const worktree = repositoryPlaceOf(this.workingCopy);
35101
+ let formatRefusal;
35022
35102
  const isRepositoryPath = await worktree?.openRepository?.(uri, {
35023
35103
  checkOwnership: false,
35024
35104
  commandLineConfig: false
35025
- }).then((opened) => opened !== void 0).catch(() => false);
35105
+ }).then((opened) => opened !== void 0).catch((error) => {
35106
+ if (error instanceof Error && error.name === "UnsupportedRepositoryFormatError") formatRefusal = error;
35107
+ return false;
35108
+ });
35109
+ if (formatRefusal) throw new TransportError$1(`fatal: ${formatRefusal.message}`);
35026
35110
  let bundleFile;
35027
35111
  const givenBundle = this.hasGivenBundle(uri);
35028
35112
  if (givenBundle) bundleFile = uri;
@@ -35400,6 +35484,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
35400
35484
  if (this.shallowSubmodules) update.setDepth(1);
35401
35485
  if (this.remoteSubmodules) update.setRemote(true).setNoFetch(true);
35402
35486
  if (filterSubmodules && this.filterSpec !== void 0) update.setFilter(this.filterSpec);
35487
+ if (this.objectStorageFormat !== void 0) update.setObjectStorageFormat("files");
35403
35488
  update.setSingleBranch(this.revision !== void 0 ? false : this.singleBranch ?? (this.depth !== void 0 || this.shallowSince !== void 0 || this.shallowExcludes.length > 0));
35404
35489
  update.setTransports(this.getTransports());
35405
35490
  if (this.credentials) update.setCredentials(this.credentials);
@@ -38600,7 +38685,7 @@ const S_IFMT$5 = 61440;
38600
38685
  const S_IFDIR$3 = 16384;
38601
38686
  const S_IFREG$1 = 32768;
38602
38687
  const S_IFLNK = 40960;
38603
- const S_IFGITLINK$1 = 57344;
38688
+ const S_IFGITLINK$2 = 57344;
38604
38689
  const BRANCH_TABLE_SIZE = 1039;
38605
38690
  /** fast-import.c's hc_str over the name's bytes as signed chars. */
38606
38691
  function hcStr(name) {
@@ -39341,7 +39426,7 @@ var FastImportCommand = class extends PlumbingCommand {
39341
39426
  case 33261:
39342
39427
  case S_IFLNK:
39343
39428
  case S_IFDIR$3:
39344
- case S_IFGITLINK$1: break;
39429
+ case S_IFGITLINK$2: break;
39345
39430
  default: this.die(`corrupt mode: ${this.line}`);
39346
39431
  }
39347
39432
  let id;
@@ -39370,7 +39455,7 @@ var FastImportCommand = class extends PlumbingCommand {
39370
39455
  await this.treeRemove(b.root, path, false);
39371
39456
  return;
39372
39457
  }
39373
- if (mode === S_IFGITLINK$1) {
39458
+ if (mode === S_IFGITLINK$2) {
39374
39459
  if (inline) this.die(`Git links cannot be specified 'inline': ${this.line}`);
39375
39460
  if (knownType !== void 0 && knownType !== "commit") this.die(`not a commit (actually a ${knownType}): ${this.line}`);
39376
39461
  } else if (inline) {
@@ -39740,7 +39825,7 @@ var FastImportCommand = class extends PlumbingCommand {
39740
39825
  return;
39741
39826
  }
39742
39827
  if (isDir$1(leaf.mode)) await this.storeTree(leaf);
39743
- const type = leaf.mode === S_IFGITLINK$1 ? "commit" : isDir$1(leaf.mode) ? "tree" : "blob";
39828
+ const type = leaf.mode === S_IFGITLINK$2 ? "commit" : isDir$1(leaf.mode) ? "tree" : "blob";
39744
39829
  await this.catBlobWrite(`${leaf.mode.toString(8).padStart(6, "0")} ${type} ${leaf.id}\t${quoted}\n`);
39745
39830
  }
39746
39831
  async parseAlias() {
@@ -39872,7 +39957,7 @@ function canonMode(mode) {
39872
39957
  if ((mode & S_IFMT$5) === S_IFREG$1) return S_IFREG$1 | (mode & 73 ? 493 : 420);
39873
39958
  if ((mode & S_IFMT$5) === S_IFLNK) return S_IFLNK;
39874
39959
  if ((mode & S_IFMT$5) === S_IFDIR$3) return S_IFDIR$3;
39875
- return S_IFGITLINK$1;
39960
+ return S_IFGITLINK$2;
39876
39961
  }
39877
39962
  /** validate_raw_date */
39878
39963
  function validRawDate(text, strict) {
@@ -42677,14 +42762,25 @@ var FormatRevCommand = class extends PlumbingCommand {
42677
42762
  const alias = RemoteConfigStore.from(this.workingCopy).value(`pretty.${format}`);
42678
42763
  if (alias !== void 0) return this.prettyOf(alias, depth + 1);
42679
42764
  }
42680
- if (BUILTIN_OTHER.has(format)) throw new PlumbingError(`fatal: format-rev: the '${format}' format is not supported`);
42765
+ if (BUILTIN_OTHER.has(format)) return { builtin: format };
42681
42766
  throw new PlumbingError(`fatal: invalid --pretty format: ${format}`);
42682
42767
  }
42683
42768
  /** pretty_print_commit of one commit (with its notes when the format shows `%N`). */
42684
42769
  async formatOne(id, pretty) {
42685
42770
  const log = new LogCommand(this.workingCopy).setNoWalk([{ id }]).setLogConfig(false);
42686
- const wantsNotes = /%N/.test(pretty.format);
42687
42771
  try {
42772
+ if (pretty.builtin !== void 0) return decodeGitPath(await log.callBytes({
42773
+ pretty: pretty.builtin,
42774
+ prettyOnly: true,
42775
+ notes: false,
42776
+ mailmap: false,
42777
+ date: "default",
42778
+ mail: {
42779
+ subject: () => "Subject: ",
42780
+ encodeHeaders: false
42781
+ }
42782
+ }));
42783
+ const wantsNotes = /%N/.test(pretty.format);
42688
42784
  return decodeGitPath(await log.callBytes({
42689
42785
  pretty: `format:${pretty.format}`,
42690
42786
  ...pretty.date ? { date: pretty.date } : {},
@@ -46440,7 +46536,7 @@ var LsTreeCommand = class extends PlumbingCommand {
46440
46536
  const resolver = this.revisionResolver();
46441
46537
  let id;
46442
46538
  try {
46443
- id = await resolver.resolve(this.treeish);
46539
+ id = await resolver.resolve(this.treeish, { hashAny: true });
46444
46540
  } catch (e) {
46445
46541
  if (!(e instanceof RefNotFoundError)) throw e;
46446
46542
  }
@@ -46517,6 +46613,14 @@ var LsTreeCommand = class extends PlumbingCommand {
46517
46613
  }
46518
46614
  /** parse_tree_indirect: a commit's tree, a tag's object peeled, a tree itself. */
46519
46615
  async peelToTree(id) {
46616
+ const compat = this.compatObjects;
46617
+ if (compat && id.length !== this.objectFormat.hexLength) {
46618
+ const type = (await compat.readAsCompat(id).catch(() => void 0))?.type;
46619
+ if (type === "tree") return id;
46620
+ if (type === "commit") this.warn(`error: bogus commit object ${id}`);
46621
+ if (type === "blob") this.warn(`error: hash mismatch ${id}`);
46622
+ return;
46623
+ }
46520
46624
  const peeled = await this.revisionResolver().peelTags(id);
46521
46625
  if (peeled.type === "tree") return peeled.id;
46522
46626
  if (peeled.type === "commit") return (await this.commits.load(peeled.id).catch(() => void 0))?.tree;
@@ -46574,6 +46678,10 @@ var LsTreeCommand = class extends PlumbingCommand {
46574
46678
  }
46575
46679
  async abbreviated(id) {
46576
46680
  if (this.abbrev === 0) return id;
46681
+ if (id.length !== this.objectFormat.hexLength) {
46682
+ const min = this.abbrev < 0 ? 7 : Math.max(4, this.abbrev);
46683
+ return id.slice(0, Math.min(min, id.length));
46684
+ }
46577
46685
  const hex = this.objectFormat.hexLength;
46578
46686
  const min = this.abbrev < 0 ? void 0 : this.abbrev < 4 ? 4 : this.abbrev > hex ? hex : this.abbrev;
46579
46687
  const length = (await this.idAbbreviator().lengths([id], min)).get(id) ?? hex;
@@ -46581,6 +46689,8 @@ var LsTreeCommand = class extends PlumbingCommand {
46581
46689
  }
46582
46690
  /** The blob's size, undefined when it cannot be read. */
46583
46691
  async blobSize(id) {
46692
+ const compat = this.compatObjects;
46693
+ if (compat && id.length !== this.objectFormat.hexLength) return (await compat.readAsCompat(id).catch(() => void 0))?.content.length;
46584
46694
  const objects = this._workingCopy.history?.objects;
46585
46695
  try {
46586
46696
  if (objects) {
@@ -54083,12 +54193,12 @@ const ERROR = 255;
54083
54193
  var StepFailed = class extends Error {};
54084
54194
  const S_IFMT$2 = 61440;
54085
54195
  const S_IFDIR$1 = 16384;
54086
- const S_IFGITLINK = 57344;
54196
+ const S_IFGITLINK$1 = 57344;
54087
54197
  /** git's object_type(mode) */
54088
54198
  function modeType(mode) {
54089
54199
  const kind = mode & S_IFMT$2;
54090
54200
  if (kind === S_IFDIR$1) return "tree";
54091
- if (kind === S_IFGITLINK) return "commit";
54201
+ if (kind === S_IFGITLINK$1) return "commit";
54092
54202
  return "blob";
54093
54203
  }
54094
54204
  /**
@@ -54469,7 +54579,7 @@ var ReplaceCommand = class extends PlumbingCommand {
54469
54579
  const oid = id.toLowerCase();
54470
54580
  const actual = await this.typeOf(oid);
54471
54581
  if (actual === void 0) {
54472
- if ((mode & S_IFMT$2) !== S_IFGITLINK) die(`entry '${path}' object ${oid} is unavailable`);
54582
+ if ((mode & S_IFMT$2) !== S_IFGITLINK$1) die(`entry '${path}' object ${oid} is unavailable`);
54473
54583
  } else if (actual !== expected) die(`entry '${path}' object ${oid} is a ${actual} but specified type was (${expected})`);
54474
54584
  if (path.includes("/")) die(`path ${path} contains slash`);
54475
54585
  entries.push({
@@ -55313,7 +55423,7 @@ function gitRelativePath(input, prefix) {
55313
55423
  }
55314
55424
  const relativeTo = (facts, path) => {
55315
55425
  if (path === void 0) return "";
55316
- const base = facts.workTree ?? facts.gitDir ?? "";
55426
+ const base = facts.setupDirectory ?? facts.workTree ?? facts.gitDir ?? "";
55317
55427
  return gitRelativePath(path, facts.prefix ? `${base}/${facts.prefix}` : base);
55318
55428
  };
55319
55429
  const COMMON_FIELDS = [
@@ -55362,11 +55472,19 @@ function hostPathOf$1(files, path) {
55362
55472
  * `git repo info [--format=(lines|nul) | -z] [--all | <key>...]` and `git repo info --keys`.
55363
55473
  *
55364
55474
  * Paths are host paths: the FilesApi's root directory joined with its paths, resolved through
55365
- * the host's `realPath`; without a root directory the path keys are empty. Not followed:
55366
- * `$GIT_DIR`/`$GIT_COMMON_DIR` given apart from the working copy (the working copy's own
55367
- * directories are reported). `path.superprojectworkingtree.*` is found where the repository's
55368
- * git directory is `<super>/.git/modules/<name>` and the superproject's worktree holds the
55369
- * repository at its place (git asks the superproject's index).
55475
+ * the host's `realPath`; without a root directory the path keys are empty. The git directory
55476
+ * and worktree are the working copy's: open it where git's setup puts them
55477
+ * (`openRepositoryFromEnvironment` for `$GIT_DIR`/`$GIT_WORK_TREE`) and pass its `prefix` to
55478
+ * {@link setCurrentDirectory}, and the setup's current directory (`setup.cwd`, as a host path)
55479
+ * to {@link setSetupDirectory}; `$GIT_COMMON_DIR` and `$GIT_INDEX_FILE` are read from the host
55480
+ * environment. Relative keys are relative to the setup directory plus the prefix, and a relative
55481
+ * `$GIT_INDEX_FILE` is read in the setup directory (the worktree top, else where git started:
55482
+ * outside the worktree, or with a bare `$GIT_DIR`). Without a setup directory git is taken to
55483
+ * have gone to the worktree top (the git directory when bare), and a relative index is the
55484
+ * file the working copy's staging opened.
55485
+ * `path.superprojectworkingtree.*` is submodule.c's `get_superproject_working_tree`: the
55486
+ * repository of the worktree's parent directory (reached through `hostFilesOf`, else the
55487
+ * FilesApi) must hold a gitlink at the worktree's path in its index.
55370
55488
  */
55371
55489
  var RepoInfoCommand = class extends PlumbingCommand {
55372
55490
  format = "lines";
@@ -55375,6 +55493,7 @@ var RepoInfoCommand = class extends PlumbingCommand {
55375
55493
  keys = [];
55376
55494
  compatibility = "2.57";
55377
55495
  currentDirectory = "";
55496
+ setupDirectory;
55378
55497
  /** `--format=<format>` (`lines`, `nul`; `table` is refused when printing values) */
55379
55498
  setFormat(format) {
55380
55499
  this.checkCallable();
@@ -55420,6 +55539,15 @@ var RepoInfoCommand = class extends PlumbingCommand {
55420
55539
  this.currentDirectory = path.replace(/^\/+|\/+$/g, "");
55421
55540
  return this;
55422
55541
  }
55542
+ /**
55543
+ * The directory git's setup went to, as a host path (`setupGitDirectory`'s `cwd` joined to
55544
+ * the FilesApi's root): the worktree top when git started inside it, else where it started.
55545
+ */
55546
+ setSetupDirectory(hostPath) {
55547
+ this.checkCallable();
55548
+ this.setupDirectory = hostPath === void 0 ? void 0 : hostPath.replace(/(.)\/+$/, "$1");
55549
+ return this;
55550
+ }
55423
55551
  async run() {
55424
55552
  const format = parseFormat(this.format.replace(/^!/, ""));
55425
55553
  const fields = infoFields(this.compatibility);
@@ -55467,7 +55595,8 @@ var RepoInfoCommand = class extends PlumbingCommand {
55467
55595
  shallow: shallow.length > 0,
55468
55596
  objectFormat: this.objectFormat.name,
55469
55597
  refStorage,
55470
- prefix: this.currentDirectory ? `${this.currentDirectory}/` : ""
55598
+ prefix: this.currentDirectory ? `${this.currentDirectory}/` : "",
55599
+ setupDirectory: await real(this.setupDirectory)
55471
55600
  };
55472
55601
  if (!layout) return facts;
55473
55602
  const files = layout.files;
@@ -55476,27 +55605,77 @@ var RepoInfoCommand = class extends PlumbingCommand {
55476
55605
  const named = commondirFile ? new TextDecoder().decode(commondirFile).trim() : void 0;
55477
55606
  facts.commonDir = environment?.commonDir ? await real(environment.commonDir) : named ? await real(named.startsWith("/") ? named : `${facts.gitDir}/${named}`) : facts.gitDir;
55478
55607
  const indexFile = environment?.indexFile;
55479
- facts.index = indexFile === void 0 ? facts.gitDir ? `${facts.gitDir}/index` : void 0 : indexFile.startsWith("/") ? indexFile : await real(`${hostPathOf$1(files, layout.bare ? layout.gitDir : layout.top) ?? ""}/${facts.prefix}${indexFile}`);
55608
+ const location = indexFile && !indexFile.startsWith("/") && facts.setupDirectory === void 0 ? this.indexLocation() : void 0;
55609
+ facts.index = indexFile === void 0 ? facts.gitDir ? `${facts.gitDir}/index` : void 0 : indexFile.startsWith("/") ? indexFile : facts.setupDirectory !== void 0 ? `${facts.setupDirectory.replace(/\/$/, "")}/${indexFile}` : await real(location ? hostPathOf$1(location.files, location.path) : `${hostPathOf$1(files, layout.bare ? layout.gitDir : layout.top) ?? ""}/${indexFile}`);
55480
55610
  if (!layout.bare) {
55481
55611
  facts.workTree = await real(hostPathOf$1(files, layout.top));
55482
- facts.superproject = await this.superprojectOf(facts.gitDir, facts.workTree);
55612
+ facts.superproject = await this.superprojectOf(files, layout.top, facts.workTree);
55483
55613
  }
55484
55614
  return facts;
55485
55615
  }
55486
- /** get_superproject_working_tree, for a git directory under `<super>/.git/modules/`. */
55487
- async superprojectOf(gitDir, workTree) {
55488
- if (!gitDir || !workTree) return void 0;
55489
- const at = gitDir.lastIndexOf("/.git/modules/");
55490
- if (at < 0) return void 0;
55491
- const superTop = gitDir.slice(0, at);
55492
- if (!workTree.startsWith(`${superTop}/`)) return void 0;
55616
+ /** The index file of the working copy's staging; undefined without one (bare, memory). */
55617
+ indexLocation() {
55618
+ try {
55619
+ return this.resolveStaging().indexLocation?.();
55620
+ } catch {
55621
+ return;
55622
+ }
55623
+ }
55624
+ /**
55625
+ * submodule.c's `get_superproject_working_tree`: the repository found from the directory
55626
+ * above the worktree (discovered as git's child `git -C <parent> ls-files` discovers it,
55627
+ * the repository variables cleared) must hold a gitlink at the worktree's path in its
55628
+ * index; the superproject is the worktree less that path. Whatever the submodule's git
55629
+ * directory is (embedded `.git`, `.git/modules/<name>`, a linked worktree's modules).
55630
+ */
55631
+ async superprojectOf(files, top, workTree) {
55632
+ if (!workTree) return void 0;
55493
55633
  const environment = hostEnvironmentOf(this.workingCopy);
55494
- if (environment?.statFile) {
55495
- if (!await environment.statFile(`${superTop}/.git`).catch(() => void 0)) return void 0;
55634
+ const real = async (path) => await environment?.realPath?.(path).catch(() => void 0) ?? path;
55635
+ const oneUp = await real(parentHostPath(workTree));
55636
+ const subpath = gitRelativePath(workTree, oneUp).replace(/\/$/, "");
55637
+ if (!subpath || subpath === "./" || subpath.startsWith("../")) return void 0;
55638
+ const host = await environment?.hostFilesOf?.(oneUp).catch(() => void 0);
55639
+ const parent = host ? {
55640
+ files: host.files,
55641
+ cwd: host.path
55642
+ } : top ? {
55643
+ files,
55644
+ cwd: normalizePath(top.slice(0, Math.max(0, top.lastIndexOf("/"))))
55645
+ } : void 0;
55646
+ if (!parent) return void 0;
55647
+ const { gitDir: _gitDir, workTree: _workTree, commonDir: _commonDir, indexFile: _indexFile, objectDirectory: _objectDirectory, implicitWorkTree: _implicitWorkTree, ...childEnvironment } = environment ?? {};
55648
+ let setup;
55649
+ try {
55650
+ setup = await setupGitDirectory({
55651
+ files: parent.files,
55652
+ cwd: parent.cwd,
55653
+ ...environment ? { environment: childEnvironment } : {}
55654
+ });
55655
+ } catch {
55656
+ return;
55496
55657
  }
55497
- return superTop;
55658
+ if (setup.workTree === void 0) return void 0;
55659
+ const format = await readRepositoryFormat(parent.files, setup.commonDir).catch(() => void 0);
55660
+ const index = await readIndexFileEntries(parent.files, setup.indexFile, {
55661
+ gitDir: setup.gitDir,
55662
+ ...format ? { objectFormat: format.objectFormat } : {}
55663
+ }).catch(() => void 0);
55664
+ if (!index) return void 0;
55665
+ const fullName = `${setup.prefix ?? ""}${subpath}`;
55666
+ const first = index.entries.find((e) => e.path === fullName || e.path.startsWith(`${fullName}/`));
55667
+ if (!first || first.mode !== S_IFGITLINK) return void 0;
55668
+ if (!workTree.endsWith(`/${fullName}`)) return void 0;
55669
+ return real(workTree.slice(0, workTree.length - fullName.length - 1) || "/");
55498
55670
  }
55499
55671
  };
55672
+ const S_IFGITLINK = 57344;
55673
+ /** The host directory holding `path` (`/a/b` → `/a`). */
55674
+ function parentHostPath(path) {
55675
+ const trimmed = path.replace(/\/+$/, "");
55676
+ const at = trimmed.lastIndexOf("/");
55677
+ return at <= 0 ? "/" : trimmed.slice(0, at);
55678
+ }
55500
55679
  const emptyValues = () => ({
55501
55680
  commits: 0,
55502
55681
  trees: 0,
@@ -60610,6 +60789,7 @@ var SubmoduleAddCommand = class extends SubmoduleCommandBase {
60610
60789
  force = false;
60611
60790
  reference;
60612
60791
  depth;
60792
+ objectStorageFormat;
60613
60793
  transports;
60614
60794
  credentialHelper;
60615
60795
  warningCallback;
@@ -60649,6 +60829,16 @@ var SubmoduleAddCommand = class extends SubmoduleCommandBase {
60649
60829
  this.reference = reference;
60650
60830
  return this;
60651
60831
  }
60832
+ /**
60833
+ * `--object-storage-format=<name>` (git master): the object storage of the submodules
60834
+ * cloned. Only `files` is a name git knows (the repository as always); anything else,
60835
+ * `files://<dir>` included, dies `unknown object storage format '<v>'` before any work.
60836
+ */
60837
+ setObjectStorageFormat(format) {
60838
+ this.checkCallable();
60839
+ this.objectStorageFormat = format;
60840
+ return this;
60841
+ }
60652
60842
  /** `--depth <n>`: a shallow clone (ignored, with git's warning, for a local path). */
60653
60843
  setDepth(depth) {
60654
60844
  this.checkCallable();
@@ -60678,6 +60868,10 @@ var SubmoduleAddCommand = class extends SubmoduleCommandBase {
60678
60868
  }
60679
60869
  async call() {
60680
60870
  this.start();
60871
+ if (this.objectStorageFormat !== void 0) {
60872
+ const unknown = unknownObjectStorageFormat(this.objectStorageFormat, "name");
60873
+ if (unknown) this.die(unknown);
60874
+ }
60681
60875
  if (!await this.writingGitmodulesOk()) this.die("fatal: please make sure that the .gitmodules file is in the working tree");
60682
60876
  if (this.uri === void 0) this.die(ADD_USAGE, 129);
60683
60877
  const repo = this.uri;
@@ -61543,8 +61737,13 @@ var TagCommand = class extends GitCommand {
61543
61737
  message
61544
61738
  };
61545
61739
  if (sign) {
61546
- const signature = await this.signTag(await collectTagBytes(tag), tagger, compatibility, warnings);
61547
- if (signature) tag.message = `${message}${new TextDecoder().decode(signature)}`;
61740
+ const payload = await collectTagBytes(tag);
61741
+ const signature = await this.signTag(payload, tagger, compatibility, warnings);
61742
+ if (signature) {
61743
+ tag.message = `${message}${new TextDecoder().decode(signature)}`;
61744
+ const compatSignature = await this.signTag(payload, tagger, compatibility, warnings, { compat: true });
61745
+ if (compatSignature) tag.compatSignature = compatSignature;
61746
+ }
61548
61747
  }
61549
61748
  tagObjectId = await this.tagsStore.storeTag(tag);
61550
61749
  } else tagObjectId = targetId;
@@ -61633,28 +61832,20 @@ var TagCommand = class extends GitCommand {
61633
61832
  const message = (await this.tagsStore?.loadTag(prev).catch(() => void 0))?.message ?? "";
61634
61833
  return message.slice(0, signatureStart(message));
61635
61834
  }
61636
- /**
61637
- * builtin/tag.c's `do_sign`: `payload` (the tag object without a signature) signed with the
61638
- * `-u` key, else `user.signingKey`, else the format's default (`get_signing_key`: ssh's
61639
- * `gpg.ssh.defaultKeyCommand`, openpgp's and x509's the committer as `Name <email>`), the
61640
- * program run in the worktree top. A failure is create_tag's: the signer's lines, `error:
61641
- * unable to sign the tag` and where the message was left (`TAG_EDITMSG` in the git
61642
- * directory, named as git names it from the top of the worktree: `.git/TAG_EDITMSG`),
61643
- * exit 128; a death of the signing (ssh without a key) only its `fatal:` line. Under 2.43
61644
- * an ssh-keygen that ran and failed leaves the tag unsigned, its error in `warnings`
61645
- * (undefined returned).
61646
- */
61647
- async signTag(payload, tagger, compatibility, warnings) {
61835
+ async signTag(payload, tagger, compatibility, warnings, options) {
61648
61836
  const gitDir = (await this.hooks.hostGitDir({ real: false }).catch(() => void 0))?.replace(/\/+$/, "");
61649
61837
  const top = (await this.hostWorkingDir())?.replace(/\/+$/, "");
61650
61838
  const path = gitDir === void 0 ? ".git/TAG_EDITMSG" : top !== void 0 && gitDir.startsWith(`${top}/`) ? `${gitDir.slice(top.length + 1)}/TAG_EDITMSG` : `${gitDir}/TAG_EDITMSG`;
61651
61839
  const cwd = await this.hooks.hostWorkingDirectory().catch(() => void 0);
61652
61840
  try {
61653
- return await signPayload(this.workingCopy, this.signingKey ?? "", payload, {
61841
+ const signOptions = {
61654
61842
  committer: tagger,
61655
61843
  ...cwd !== void 0 ? { cwd } : {},
61656
61844
  tail: ["error: unable to sign the tag", `The tag message has been left in ${path}`]
61657
- });
61845
+ };
61846
+ const key = this.signingKey ?? "";
61847
+ if (options?.compat) return await signTagCompat(this.workingCopy, key, payload, signOptions);
61848
+ return await signPayload(this.workingCopy, key, payload, signOptions);
61658
61849
  } catch (e) {
61659
61850
  if (!(e instanceof SigningFailedError)) throw e;
61660
61851
  if (compatibility === "2.43" && (e.programExitCode ?? 0) > 0) {
@@ -62302,6 +62493,10 @@ function dryRunTarget(objects) {
62302
62493
  *
62303
62494
  * // git update-index --refresh
62304
62495
  * const { output, exitCode } = await git.updateIndex().refresh().call();
62496
+ *
62497
+ * // git update-index --fsmonitor, then --fsmonitor-valid a
62498
+ * await git.updateIndex().setFsmonitor(true).call();
62499
+ * await git.updateIndex().setFsmonitorValid(true).addPath("a").call();
62305
62500
  * ```
62306
62501
  */
62307
62502
  /** A death (`die()`): git's message, without the `fatal: ` prefix. */
@@ -62350,6 +62545,7 @@ var UpdateIndexCommand = class extends GitCommand {
62350
62545
  indexVersion;
62351
62546
  showIndexVersion = false;
62352
62547
  forceWrite = false;
62548
+ fsmonitor;
62353
62549
  set(apply) {
62354
62550
  this.checkCallable();
62355
62551
  this.steps.push({
@@ -62412,6 +62608,26 @@ var UpdateIndexCommand = class extends GitCommand {
62412
62608
  s.markSkipWorktree = mark;
62413
62609
  });
62414
62610
  }
62611
+ /**
62612
+ * `--fsmonitor-valid` (true) / `--no-fsmonitor-valid` (false) for the paths after it: the
62613
+ * entry's fsmonitor valid bit (`CE_FSMONITOR_VALID`) set or cleared.
62614
+ */
62615
+ setFsmonitorValid(mark) {
62616
+ return this.set((s) => {
62617
+ s.markFsmonitor = mark;
62618
+ });
62619
+ }
62620
+ /**
62621
+ * `--fsmonitor` (true) / `--no-fsmonitor` (false), applied after the paths, as git does:
62622
+ * the index's `FSMN` extension added (`add_fsmonitor`; a warning when `core.fsmonitor` is
62623
+ * unset; git's death in a bare repository with `core.fsmonitor` set) or removed (a warning
62624
+ * when `core.fsmonitor` is set).
62625
+ */
62626
+ setFsmonitor(enable) {
62627
+ this.checkCallable();
62628
+ this.fsmonitor = enable;
62629
+ return this;
62630
+ }
62415
62631
  /** `--ignore-skip-worktree-entries`: `--remove` leaves skip-worktree entries alone. */
62416
62632
  setIgnoreSkipWorktreeEntries(ignore = true) {
62417
62633
  return this.set((s) => {
@@ -62523,8 +62739,14 @@ var UpdateIndexCommand = class extends GitCommand {
62523
62739
  async call() {
62524
62740
  this.checkCallable();
62525
62741
  this.setCallable(false);
62526
- await this.readCurrentIndex();
62527
- const run = new UpdateIndexRun(this.context());
62742
+ if (this.fsmonitor && !this.hasWorktree()) {
62743
+ if (fsmonitorModeOf(RemoteConfigStore.from(this.workingCopy).value("core.fsmonitor")).kind !== "disabled") throw new UpdateIndexFailedError(`fatal: bare repository '${await this.currentDirectory()}' is incompatible with fsmonitor`);
62744
+ }
62745
+ await this.readCurrentIndex(true, false);
62746
+ const hadFsmonitor = !!this.staging.getFsmonitor?.();
62747
+ const fsm = await this.fsmonitorRefresh(this.staging);
62748
+ const run = new UpdateIndexRun(this.context(fsm?.state));
62749
+ for (const warning of fsm?.warnings ?? []) run.stderr.push(`warning: ${warning}`);
62528
62750
  try {
62529
62751
  await this.inOneOperation(async () => {
62530
62752
  for (const step of this.steps) await run.step(step);
@@ -62536,12 +62758,15 @@ var UpdateIndexCommand = class extends GitCommand {
62536
62758
  };
62537
62759
  for (const path of inputPaths(this.stdinPaths, this.nulTerminated, badlyQuoted)) await run.updateOne(path);
62538
62760
  }
62761
+ await this.applyFsmonitor(run);
62539
62762
  });
62540
62763
  } catch (error) {
62541
62764
  if (error instanceof Death) throw new UpdateIndexFailedError([...run.stderr, `fatal: ${error.message}`].join("\n"), run.stdout.join(""));
62542
62765
  throw error;
62543
62766
  }
62544
- if (run.changed || this.forceWrite) try {
62767
+ const fsmonitorNow = this.staging.getFsmonitor?.();
62768
+ const fsmonitorChanged = !!fsmonitorNow?.changed || hadFsmonitor && !fsmonitorNow;
62769
+ if (run.changed || this.forceWrite || fsmonitorChanged) try {
62545
62770
  await run.write();
62546
62771
  } catch (error) {
62547
62772
  if (error instanceof Death) throw new UpdateIndexFailedError([...run.stderr, `fatal: ${error.message}`].join("\n"), run.stdout.join(""));
@@ -62553,6 +62778,37 @@ var UpdateIndexCommand = class extends GitCommand {
62553
62778
  exitCode: run.hasErrors ? 1 : 0
62554
62779
  };
62555
62780
  }
62781
+ /** `--[no-]fsmonitor`: `add_fsmonitor` / `remove_fsmonitor` and their warnings. */
62782
+ async applyFsmonitor(run) {
62783
+ if (this.fsmonitor === void 0) return;
62784
+ const mode = fsmonitorModeOf(RemoteConfigStore.from(this.workingCopy).value("core.fsmonitor"));
62785
+ const staging = this.staging;
62786
+ if (this.fsmonitor) {
62787
+ if (mode.kind === "disabled") run.stderr.push("warning: core.fsmonitor is unset; set it if you really want to enable fsmonitor");
62788
+ if (!staging.getFsmonitor?.() && staging.setFsmonitor) {
62789
+ const state = new FsmonitorState(String(BigInt(Date.now()) * 1000000n));
62790
+ state.changed = true;
62791
+ state.writtenWhileDisabled = mode.kind === "disabled";
62792
+ staging.setFsmonitor(state);
62793
+ }
62794
+ run.report("fsmonitor enabled");
62795
+ } else {
62796
+ if (mode.kind !== "disabled" && this.hasWorktree()) run.stderr.push("warning: core.fsmonitor is set; remove it if you really want to disable fsmonitor");
62797
+ staging.setFsmonitor?.(void 0);
62798
+ run.report("fsmonitor disabled");
62799
+ }
62800
+ }
62801
+ /** git's `xgetcwd()` for a bare repository: the git directory's host path. */
62802
+ async currentDirectory() {
62803
+ const layout = await hookHostOf(this.workingCopy).layout();
62804
+ if (!layout) return ".";
62805
+ const root = layout.files.rootDirectory;
62806
+ if (!root) return layout.gitDir;
62807
+ const base = root.replace(/\/+$/, "");
62808
+ const rest = layout.gitDir.replace(/^\.?\/*|\/+$/g, "");
62809
+ const path = rest ? `${base}/${rest}` : base || "/";
62810
+ return await hostEnvironmentOf(this.workingCopy)?.realPath?.(path).catch(() => void 0) ?? path;
62811
+ }
62556
62812
  applyIndexVersion(run) {
62557
62813
  const staging = this.staging;
62558
62814
  const current = staging._getVersion?.() ?? 2;
@@ -62565,9 +62821,10 @@ var UpdateIndexCommand = class extends GitCommand {
62565
62821
  run.version = wanted;
62566
62822
  if (staging._setVersion) run.setVersion = (v) => staging._setVersion?.(v);
62567
62823
  }
62568
- context() {
62824
+ context(fsmonitor) {
62569
62825
  const worktree = this.worktreeAccess;
62570
62826
  return {
62827
+ fsmonitor,
62571
62828
  staging: this.staging,
62572
62829
  worktree,
62573
62830
  blobs: this.blobs,
@@ -62770,7 +63027,7 @@ var UpdateIndexRun = class {
62770
63027
  async updateOne(path) {
62771
63028
  await this.load();
62772
63029
  const s = this.state;
62773
- const markOnly = s.markValid !== void 0 || s.markSkipWorktree !== void 0;
63030
+ const markOnly = s.markValid !== void 0 || s.markSkipWorktree !== void 0 || s.markFsmonitor !== void 0;
62774
63031
  let current;
62775
63032
  let missing = false;
62776
63033
  let mode = 0;
@@ -62791,6 +63048,10 @@ var UpdateIndexRun = class {
62791
63048
  if (!this.markFlags(path, "skipWorktree", s.markSkipWorktree)) throw new Death(`Unable to mark file ${path}`);
62792
63049
  return this.chmodAfter(path);
62793
63050
  }
63051
+ if (s.markFsmonitor !== void 0) {
63052
+ if (!this.markFsmonitor(path, s.markFsmonitor)) throw new Death(`Unable to mark file ${path}`);
63053
+ return this.chmodAfter(path);
63054
+ }
62794
63055
  if (s.forceRemove) {
62795
63056
  this.removeFile(path);
62796
63057
  this.report(`remove '${path}'`);
@@ -62829,6 +63090,20 @@ var UpdateIndexRun = class {
62829
63090
  this.changed = true;
62830
63091
  return true;
62831
63092
  }
63093
+ /** `mark_ce_flags` with `CE_FSMONITOR_VALID`: false when the path has no stage-0 entry. */
63094
+ markFsmonitor(path, mark) {
63095
+ const pos = this.namePos(path);
63096
+ if (pos < 0) return false;
63097
+ const ce = this.entries[pos];
63098
+ const state = this.ctx.fsmonitor;
63099
+ if (state) {
63100
+ state.markInvalid(ce);
63101
+ if (mark) state.markValid(ce, { gitlinks: true });
63102
+ }
63103
+ this.invalidate(path);
63104
+ this.changed = true;
63105
+ return true;
63106
+ }
62832
63107
  /** `remove_one_path`. */
62833
63108
  removeOnePath(path) {
62834
63109
  if (!this.state.remove) {
@@ -63016,6 +63291,7 @@ var UpdateIndexRun = class {
63016
63291
  const worktree = this.ctx.worktree;
63017
63292
  if (!worktree) return;
63018
63293
  const trust = this.ctx.trust;
63294
+ const fsmonitor = this.ctx.fsmonitor;
63019
63295
  for (let i = 0; i < this.entries.length; i++) {
63020
63296
  const ce = this.entries[i];
63021
63297
  if (s.ignoreSubmodules && ce.mode === FileMode.GITLINK) continue;
@@ -63029,6 +63305,7 @@ var UpdateIndexRun = class {
63029
63305
  }
63030
63306
  if (ce.skipWorktree) continue;
63031
63307
  if (!really && ce.assumeValid) continue;
63308
+ if (fsmonitor?.isValid(ce)) continue;
63032
63309
  const current = await worktree.getEntry(ce.path).catch(() => void 0);
63033
63310
  if (!current && s.ignoreMissing) continue;
63034
63311
  let changed;
@@ -63062,7 +63339,7 @@ var UpdateIndexRun = class {
63062
63339
  if (fresh && !sameStat(fresh, ce)) {
63063
63340
  this.entries[i] = fresh;
63064
63341
  this.changed = true;
63065
- }
63342
+ } else fsmonitor?.markValid(ce);
63066
63343
  }
63067
63344
  for (const ce of this.entries) {
63068
63345
  if (ce.stage !== 0) continue;