@statewalker/vcs-commands 0.12.0 → 0.14.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/dist/commands/archive/archive-command.d.ts +6 -2
- package/dist/commands/archive/archive-command.d.ts.map +1 -1
- package/dist/commands/archive/remote-archive-command.d.ts +23 -1
- package/dist/commands/archive/remote-archive-command.d.ts.map +1 -1
- package/dist/commands/archive/upload-archive-writer.d.ts +11 -5
- package/dist/commands/archive/upload-archive-writer.d.ts.map +1 -1
- package/dist/commands/bundle/bundle-format.d.ts +6 -1
- package/dist/commands/bundle/bundle-format.d.ts.map +1 -1
- package/dist/commands/bundle/bundle-uri-host.d.ts +12 -1
- package/dist/commands/bundle/bundle-uri-host.d.ts.map +1 -1
- package/dist/commands/bundle/bundle-uri.d.ts +7 -1
- package/dist/commands/bundle/bundle-uri.d.ts.map +1 -1
- package/dist/commands/bundle/bundle-verify.d.ts +4 -1
- package/dist/commands/bundle/bundle-verify.d.ts.map +1 -1
- package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -1
- package/dist/commands/check-ignore-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts +15 -0
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +10 -1
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/default-branch.d.ts +17 -3
- package/dist/commands/default-branch.d.ts.map +1 -1
- package/dist/commands/fetch-command.d.ts +2 -1
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/fsck/fsck-object-checks.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +3 -3
- package/dist/commands/git-hooks.d.ts.map +1 -1
- package/dist/commands/http-config.d.ts +1 -1
- package/dist/commands/http-config.d.ts.map +1 -1
- package/dist/commands/index.js +6 -6
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/local-transport.d.ts +11 -1
- package/dist/commands/local-transport.d.ts.map +1 -1
- package/dist/commands/ls-tree-command.d.ts +10 -0
- package/dist/commands/ls-tree-command.d.ts.map +1 -1
- package/dist/commands/merge-command.d.ts +11 -1
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-support.d.ts +19 -2
- package/dist/commands/merge-support.d.ts.map +1 -1
- package/dist/commands/plumbing-input.d.ts.map +1 -1
- package/dist/commands/promisor-remote-reply.d.ts +31 -4
- package/dist/commands/promisor-remote-reply.d.ts.map +1 -1
- package/dist/commands/promisor-remote.d.ts +8 -1
- package/dist/commands/promisor-remote.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/ref-filter/index.d.ts +1 -0
- package/dist/commands/ref-filter/index.d.ts.map +1 -1
- package/dist/commands/ref-filter/peel-limit.d.ts +8 -0
- package/dist/commands/ref-filter/peel-limit.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -1
- package/dist/commands/ref-filter/ref-format.d.ts.map +1 -1
- package/dist/commands/serve-repository.d.ts +4 -3
- package/dist/commands/serve-repository.d.ts.map +1 -1
- package/dist/commands/signing.d.ts +29 -2
- package/dist/commands/signing.d.ts.map +1 -1
- package/dist/commands/split-cmdline.d.ts +6 -0
- package/dist/commands/split-cmdline.d.ts.map +1 -0
- package/dist/{commands-C2E51T1z.js → commands-C9M78Chn.js} +1186 -1036
- package/dist/errors/commit-errors.d.ts +17 -1
- package/dist/errors/commit-errors.d.ts.map +1 -1
- package/dist/errors/index.js +18 -3
- package/dist/{fsck-BjlxStsM.js → fsck-C4US3l0B.js} +2 -2
- package/dist/index.js +7 -7
- package/dist/{maintenance-run-command-G_eWdA8O.js → maintenance-run-command-CoJFKr2p.js} +85 -33
- package/dist/{remote-transport-CSgTJ1BH.js → remote-transport-C43eykfK.js} +51 -16
- package/dist/results/index.js +1 -1
- package/dist/{results-Dg1KHG8y.js → results-B0CWLCAp.js} +398 -54
- package/dist/transport-command.d.ts +3 -0
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +21 -13
- package/src/commands/archive/archive-command.ts +7 -3
- package/src/commands/archive/remote-archive-command.ts +37 -3
- package/src/commands/archive/upload-archive-writer.ts +34 -22
- package/src/commands/bundle/bundle-format.ts +10 -2
- package/src/commands/bundle/bundle-uri-host.ts +71 -11
- package/src/commands/bundle/bundle-uri.ts +11 -4
- package/src/commands/bundle/bundle-verify.ts +4 -1
- package/src/commands/cat-file/cat-file-command.ts +1 -33
- package/src/commands/check-ignore-command.ts +60 -15
- package/src/commands/clone-command.ts +89 -11
- package/src/commands/commit-command.ts +42 -7
- package/src/commands/default-branch.ts +19 -5
- package/src/commands/fetch-command.ts +13 -2
- package/src/commands/fsck/fsck-object-checks.ts +3 -1
- package/src/commands/git-hooks.ts +11 -5
- package/src/commands/http-config.ts +47 -1
- package/src/commands/init-command.ts +24 -4
- package/src/commands/local-transport.ts +53 -9
- package/src/commands/ls-tree-command.ts +20 -12
- package/src/commands/merge-command.ts +32 -8
- package/src/commands/merge-support.ts +42 -4
- package/src/commands/plumbing-input.ts +3 -1
- package/src/commands/promisor-remote-reply.ts +338 -56
- package/src/commands/promisor-remote.ts +25 -3
- package/src/commands/push-command.ts +5 -1
- package/src/commands/read-tree-command.ts +2 -2
- package/src/commands/ref-filter/index.ts +1 -0
- package/src/commands/ref-filter/peel-limit.ts +7 -0
- package/src/commands/ref-filter/ref-filter.ts +9 -3
- package/src/commands/ref-filter/ref-format.ts +2 -1
- package/src/commands/repack-command.ts +1 -1
- package/src/commands/serve-repository.ts +8 -3
- package/src/commands/signing.ts +93 -10
- package/src/commands/split-cmdline.ts +32 -0
- package/src/errors/commit-errors.ts +24 -2
- package/src/transport-command.ts +31 -1
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
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 { $
|
|
4
|
-
import { $ as relativeFilesPath, $t as
|
|
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-
|
|
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";
|
|
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-C4US3l0B.js";
|
|
2
|
+
import { BranchUsedByWorktreeError, CannotDeleteCurrentBranchError, CheckoutIndexFailedError, CloneCheckoutError, CloneDestinationError, CommitNotFoundError, DescribeError, EMPTY_AMEND_ADVICE, 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 { $a as splitCmdline, $c as sparseWarningText, $i as stripspace, $l as checkBlankAtEof, $n as applyMailmapToHeader, $r as trailerLinesOf, Ai as ApplyParser, Al as gitCommitMessageHooks, Ao as rerereGcLocation, Ar as combineNotesCatSortUniq, As as quoteCStyleBody, At as AUTOSTASH_SAVED_LINES, Au as moveRefs, Ba as SIGNING_FAILED_LINES, Bl as runPostCheckoutHook, Br as amendWithTrailers, Bt as squashMessage, C as patchRevisionOf, Cc as readMailmapBlob, Co as unknownRevisionMessage, Cr as expandNotesRef, D as PATCH_MODES, Di as ApplyCommand, Dn as readDiffSubmoduleConfig, Do as rerereDiff, Dr as readRef, Dt as relativeDate, Du as localTimezoneOffset, Ec as removeLegacyRemoteFile, Ei as readBlob, El as commonGitFileOf, Eo as rerereClear, Er as initNotes, Eu as formatRfc2822Date, Fi as latin1ToText, Ft as removeBranchState, G as SubmoduleSummaryCommand, Ga as signCommit, Gc as cleanTrackedSparseDirectories, Gi as cleanupWith, Go as isBinaryContent, H as readShowUntrackedFiles, Ha as SigningFailedError, Hl as sequencerPrepareMessage, Ic as defaultInitialBranch, Ii as pathToLatin1, Io as MergeDriverFailedError, Ir as mailFromHeader, It as removeMergeBranchState, J as StatusPrinter, Ja as signTagCompat, Jc as readSparseCheckoutFile, Ji as commitMessageFromOption, Jl as coreBool, Jn as verifyCommitBytes, Jo as readGitlinkHead, K as readHeadDescription, Ka as signPayload, Kc as entryList, Ki as commentPrefixOf, Ko as IndexAdder, Kt as WorkingCopyStashProvider, L as TextconvCaches, Lc as defaultRefFormat, Li as textToLatin1, Ll as isKnownHook, Lr as mailSubjectLine, Lt as resetMerge, M as DiffCommand, Mi as cUnquote, Mn as parseGitmodules, Mo as rerereRemaining, Mt as cleanupMessage, Mu as listRemoteNames, Nc as UnsupportedObjectStorageError, Ni as latin1ToBytes, Nl as hookHostOf, No as rerereStatus, Nr as combineNotesOverwrite, Nt as createAutostash, O as patchModeFor, Oc as InvalidInitialBranchError, Oo as rerereEngineOf, Or as updateNotesRef, Ot as sanitizedSubject, Ou as parseGitDate, Pc as checkDefaultObjectStorage, Pi as latin1ToPath, Pl as hookRunnerOf, Po as runRerere, Pr as readNoteBytes, Pt as moveHeadAsReset, Qa as signingKeyIdOf, Qc as sparsePathAdvice, Qi as preparedMessageCleanup, Ql as WS_DEFAULT_RULE, Qn as GrepPatternError, Qr as trailerConfigOf, R as StatusCommand, Rc as isValidBranchName$1, Ri as newFilePatch, Rt as resetUnmergedToHead, Si as GRAPH_COLUMN_COLORS_ANSI, Sl as worktreePathRules, Sr as expandLooseNotesRef, Ss as formatStat, St as loadRefDecorations, T as runPatchSelection, Tc as readRepositoryMailmap, Ti as ortResultEntries, Tr as initCopyNotesForRewrite, Tt as parseColorSpec, Tu as approxidateCareful$1, Ui as isMergeSuccessful, Ul as fsmonitorModeOf, Un as readStoredObjectBytes, Uo as detectRenames, Ut as StashCreateCommand, Vl as sequencerPostCommit, Vo as ortConfigOptions, Vr as appendSignoff, Wc as SparseUnpack, Wo as GIT_MAX_SCORE, Wr as ignoredLogMessageBytes, Xc as sparseCheckoutConfig, Xi as editorCleanupMode, Xl as worktreeModeTrust, Xn as verifyTagBytes, Xo as strerror, Xr as signoffLine, Y as formatStatusText, Yc as readSparseCheckoutPatterns, Yi as completeLine$1, Yl as createIdAbbreviator, Yn as verifyMergeSignature, Yr as processTrailers, Zc as sparseDirectoriesOf, Zi as parseCleanupMode, _a as treeDelta, _c as CorruptTreeError, _i as DEFAULT_DATE_MODE, _n as shortBranchName, _r as copyNoteForRewrite, _u as committerIdentOf, aa as indexChanges, ai as matchPathspecSeen, an as STASH_REF, ao as disableHint, ar as storedBase, b as collapsedSparseDirectories, bc as objectTypeOfMode, bi as parseDateMode, bl as treePathRefusal, bn as worktreeAdminWorkingCopy, bo as verifyNonFilename, br as createNotesCommit, ci as pathspecCommonPrefix, cl as removeDirectoryIfEmpty, co as installTracking, cr as forkPointOf, ct as readDiffColorSettings, cu as configBool$1, da as refsWatched, di as pathspecItemMayMatch, dn as checkCandidatePath, do as trackableStart, dr as patchIdOfChanges, dt as ConfigValueDeath, du as mergeVerbosityOf, ea as FlatTreeCache, ec as reflogLine, ei as validateTrailerArgs, el as updateSparsity, et as RevParseCommand, eu as isGitSpace, fa as rewriteIndex, fi as pathspecName, fn as findLinkedWorktree, fo as uniqueTrackingName, fr as patchIdsOfPatchText, ft as formatConfigValue, ga as switchTrees, gi as untrackedScanPathspec, gn as requireWorktrees, gr as commitNotes, gt as parseGitColor, gu as authorIdentOf, ha as subjectOf, hc as resetPromisorAcceptance, hi as treePathspec, hl as planFlatRestore, hn as repositoryPlaceOf, hr as NotesError, ht as normalizeConfigValue, hu as InvalidIdentError, i as isRebaseSuccessful, ia as flatTree, ic as updateHeadExpecting, ii as matchPathspec, in as StashApplyCommand, ir as mergeStoredTrees, ji as bytesToLatin1, jl as gitFileOf, jr as combineNotesConcatenate, js as quotePath, jt as applyAutostash, ju as RemoteConfigStore, ki as ApplyEngine, kl as gitCommitAfterHooks, ko as rerereForget, ku as deleteRefs, lc as promisorOf, li as pathspecErrors, ll as statFollowingLinks, ln as WorktreeListCommand, lo as planTracking, lr as PathspecAttributes, lu as configValue, ma as storeFlatTreeOver, mc as promisorRemoteReplyOf, mi as treeEntryInteresting, ml as checkoutFreshTree, mn as refuseIfCheckedOut, mo as worktreeAmbiguityHints, mr as isFullHexObjectId, mt as gitConfigColorBool, mu as InvalidDateError, na as conflictsComment, ni as latin1Bytes$3, no as ambiguousRemoteAdvice, nr as remergeObjectsView, nu as wsCheckEmit, oa as indexChangesFromTree, oi as parsePathspec, ol as pruneEmptyParents, on as StashListCommand, oo as endOfSymbolicChain, or as MergeBaseGraph, ou as attributesSourceResolver, pa as storeFlatTree, pc as promisorAutoFilter, pi as psEqual, pl as worktreeModified, po as upstreamMissingError, pr as canonicalObjectId, pt as gitConfigBool, qa as signRequestOf, qi as commitCleanupMode, ql as abbrevLengths, qt as ResetCommand, rc as updateHead, ri as latin1String, rn as PathspecFile, ro as applyRefspecs$1, rr as mergeBaseTree, rt as textconvRunnerOf, sa as peelMergeHeads, si as parsePathspecItem, sn as LogCommand, so as guessRemoteBranch, sr as commitsBaseSource, su as bareAttributesResolver, ta as OperationState, tc as reflogMessages, ti as globalPathspecMagic, tt as revisionMergeBases, tu as wsBlankLine, ua as readIndex, ui as pathspecItemBytes, ul as statThroughLeadingLinks, uo as pushTrackingPlan, ur as PatchIds, ut as CONFIG_VALUE_TYPES, uu as conflictStyleOf, v as AddCommand, va as updateIndexCacheTree, vc as SHORT_MAGIC$1, vl as writeTreeRestorePlan, vn as useRelativePaths, vo as parseRevisionAndPathArgs, vr as copyNotesForAmend, w as pathPatchMode, wc as readMailmapFile, wo as RerereError, wr as finishCopyNotesForRewrite, wu as withoutCrud, x as sparseIndexAsRead, xc as readAllBytes, xi as showDate, xl as withTreePathRefusal, xn as worktreeUsingBranch, xo as handleRevisionArg, xr as defaultNotesRef, y as SPARSE_INDEX_EXPANDED_HINT, ya as writeIndexAsTree, yc as concatBytes, yn as usesBranch, yo as verifyFilename, yr as copyNotesForRebase, yt as formatCommitPretty, yu as hostEnvironmentOf, z as cutLine, za as GitCommand, zc as unknownObjectStorageFormat, zo as lowLevelMerge, zr as reencodedCommitParts, zt as saveAutostash } from "./results-B0CWLCAp.js";
|
|
4
|
+
import { $ as relativeFilesPath, $t as BisectResetCommand, A as fetchBundleUri, An as nonCommitSwitchError, Bt as signatureStart, C as strictUrlOrigin, Ct as shortlogIdent, D as TransportCommand, Dn as CheckoutCommand, E as PlumbingError, Et as fillAheadBehind, Ft as RefFormat, G as defaultRemoteOf, I as BundleList, It as RefKind, J as lstatKind, Jt as RevListCommand, K as isRelativeSubmoduleUrl, M as BundleListHeadsCommand, N as BundleUnbundleCommand, Nn as runPathCheckout, Nt as sortRefs, Ot as filterAndFormatRefs, P as BundleVerifyCommand, Q as physicalFilesPath, Qt as BisectReplayCommand, R as parseBundleListLine, S as guardSubmoduleTransports, St as readShortlogInput, T as PlumbingCommand, U as SubmoduleGitDirError, W as SubmoduleModel, X as parentIsDirectory, Xt as BisectLogCommand, Y as openConfigFile, Yt as BisectCommand, Z as parseSubmoduleUpdateStrategy, Zt as BisectNextCommand, _ 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 BisectRunCommand, ft as worktreeHostPath, g as uriProtocolsOption, gt as commitSubject$1, h as toTrackingRefUpdate, ht as Shortlog, i as RepackCommand, in as BisectTermsCommand, it as safeCreateLeadingDirectories, jn as pathCheckoutResult, jt as parseRefSorting, k as fetchBundleList, kt as filterRefs, l as FetchCommand, lt as urlIsLocalNotSsh, m as toTagMode, n as MaintenanceRunCommand, nn as BisectStartCommand, nt as resolveFilesLinks, o as inLinkedWorktree, ot as submodulePathConfigOf, pt as BundleCreateCommand, q as joinFilesPath, rn as BisectStateCommand, rt as resolveRelativeUrl, s as objectsDirectoryDisplay, st as submoduleUpdateTypeName, tn as BisectSkipCommand, 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-CoJFKr2p.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-C43eykfK.js";
|
|
6
|
+
import { CorruptObjectError, DEFAULT_BIG_FILE_THRESHOLD, EMPTY_BLOB_ID, EMPTY_TREE_ID, FileMode, InvalidTreeEntryNameError, MemoryRawStorage, ObjectFilterError, 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
8
|
import { AttributesMemo, AttributesSourceError, DIR_COLLECT_KILLED_ONLY, DIR_HIDE_EMPTY_DIRECTORIES, DIR_SHOW_IGNORED, DIR_SHOW_OTHER_DIRECTORIES, FilterDriverError, FilterDriverRunError, FsmonitorState, IndexPathLookup, WorktreeFormatUpgradeError, attributesIndexOf, attributesIndexOfTree, basicStatMatches, cacheTreeOfTree, collectChunks, commandLineExcluded, compareWithWorktree, convAttrsOf, createCommandLineExcludes, createIgnoreNode, createMemoryCheckout, crlfToWorktree, entryStatOf, eolStatsAscii, expandUserPath, getWorktreeEntries, identToWorktree, invalidateCacheTreePath, isCleanByStat, 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, parseGitUlong, selectUrlMatches, unifiedDiff, unifiedDiffHunks, urlComponent, urlParse, whitespaceFlags, xdiffHunks, xdlHashRecord } from "@statewalker/vcs-utils";
|
|
@@ -5501,9 +5501,13 @@ var ArchiveCommand = class extends GitCommand {
|
|
|
5501
5501
|
this.compatibility = version;
|
|
5502
5502
|
return this;
|
|
5503
5503
|
}
|
|
5504
|
-
/**
|
|
5505
|
-
|
|
5506
|
-
|
|
5504
|
+
/**
|
|
5505
|
+
* What git printed on stderr (`-v`'s paths, warnings), from the `from`th message on: read
|
|
5506
|
+
* while {@link callStream} runs, the messages so far (upload-archive sends them on as they
|
|
5507
|
+
* come).
|
|
5508
|
+
*/
|
|
5509
|
+
getMessages(from = 0) {
|
|
5510
|
+
return this.messages.slice(from);
|
|
5507
5511
|
}
|
|
5508
5512
|
/** `git archive --list`: the formats, as git lists them. */
|
|
5509
5513
|
listFormats() {
|
|
@@ -6472,46 +6476,52 @@ const encoder$7 = new TextEncoder();
|
|
|
6472
6476
|
/**
|
|
6473
6477
|
* Runs `git archive <args>` as upload-archive's writer runs it in `workingCopy` (a
|
|
6474
6478
|
* repository's, its worktree never read): git's options parsed from `args`, only formats
|
|
6475
|
-
* served remotely, a tree-ish only by ref unless `allowUnreachable`.
|
|
6476
|
-
*
|
|
6479
|
+
* served remotely, a tree-ish only by ref unless `allowUnreachable`. The archive goes to
|
|
6480
|
+
* `sink` as it is written ({@link ArchiveCommand.callStream}: never held whole, the writer
|
|
6481
|
+
* waiting on each chunk), stderr's lines with it as they are printed; resolves with git's
|
|
6482
|
+
* exit status. Never throws: git's deaths are a stderr line and the status (a sink that
|
|
6483
|
+
* rejects, the client gone, stops the writer the same way).
|
|
6477
6484
|
*
|
|
6478
6485
|
* @example
|
|
6479
6486
|
* ```ts
|
|
6480
|
-
* const
|
|
6487
|
+
* const exitCode = await runArchiveWriter(workingCopy, ["--format=zip", "HEAD"], {
|
|
6488
|
+
* stdout: async (chunk) => file.write(chunk),
|
|
6489
|
+
* stderr: async (text) => log(text),
|
|
6490
|
+
* });
|
|
6481
6491
|
* ```
|
|
6482
6492
|
*/
|
|
6483
|
-
async function runArchiveWriter(workingCopy, args, options = {}) {
|
|
6493
|
+
async function runArchiveWriter(workingCopy, args, sink, options = {}) {
|
|
6484
6494
|
let command;
|
|
6495
|
+
let sent = 0;
|
|
6496
|
+
const flushMessages = async () => {
|
|
6497
|
+
if (!command) return;
|
|
6498
|
+
const lines = command.getMessages(sent);
|
|
6499
|
+
sent += lines.length;
|
|
6500
|
+
if (lines.length > 0) await sink.stderr(lines.map((m) => `${m}\n`).join(""));
|
|
6501
|
+
};
|
|
6485
6502
|
try {
|
|
6486
6503
|
command = new ArchiveCommand(workingCopy).setUploadArchive({ allowUnreachable: options.allowUnreachable === true });
|
|
6487
6504
|
options.configure?.(command);
|
|
6488
6505
|
if (applyArchiveArgs(command, args)) {
|
|
6489
6506
|
const lines = command.listFormats().map((name) => `${name}\n`);
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
stdout: encoder$7.encode(lines.join("")),
|
|
6493
|
-
stderr: ""
|
|
6494
|
-
};
|
|
6507
|
+
await sink.stdout(encoder$7.encode(lines.join("")));
|
|
6508
|
+
return 0;
|
|
6495
6509
|
}
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6510
|
+
for await (const chunk of command.callStream()) {
|
|
6511
|
+
await flushMessages();
|
|
6512
|
+
await sink.stdout(chunk);
|
|
6513
|
+
}
|
|
6514
|
+
await flushMessages();
|
|
6515
|
+
return 0;
|
|
6501
6516
|
} catch (error) {
|
|
6502
6517
|
const message = error.message ?? String(error);
|
|
6503
6518
|
const exitCode = error instanceof GitApiError ? error.exitCode : 128;
|
|
6504
6519
|
const text = /^(fatal|error|usage|warning):/.test(message) ? message : `fatal: ${message}`;
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
stderr: `${command ? messagesOf(command) : ""}${text}\n`
|
|
6509
|
-
};
|
|
6520
|
+
await flushMessages().catch(() => {});
|
|
6521
|
+
await sink.stderr(`${text}\n`).catch(() => {});
|
|
6522
|
+
return exitCode;
|
|
6510
6523
|
}
|
|
6511
6524
|
}
|
|
6512
|
-
function messagesOf(command) {
|
|
6513
|
-
return command.getMessages().map((m) => `${m}\n`).join("");
|
|
6514
|
-
}
|
|
6515
6525
|
/**
|
|
6516
6526
|
* {@link runArchiveWriter} for an opened repository (`Worktree.openRepository`), as git's
|
|
6517
6527
|
* upload-archive serves it: in its git directory (no worktree), `uploadarchive.allowUnreachable`
|
|
@@ -6527,11 +6537,11 @@ function messagesOf(command) {
|
|
|
6527
6537
|
function uploadArchiveWriterOf(repository, options = {}) {
|
|
6528
6538
|
const worktrees = repository.worktrees;
|
|
6529
6539
|
if (!worktrees) return void 0;
|
|
6530
|
-
return async (args) => {
|
|
6540
|
+
return async (args, sink) => {
|
|
6531
6541
|
const value = repository.config?.getAll("uploadarchive.allowUnreachable").at(-1);
|
|
6532
6542
|
const allowUnreachable = value === void 0 ? false : parseGitBool$1(value ?? "true") ?? false;
|
|
6533
6543
|
const admin = await worktrees.openAdmin();
|
|
6534
|
-
return runArchiveWriter(withoutWorktree(worktreeAdminWorkingCopy(admin)), args, {
|
|
6544
|
+
return runArchiveWriter(withoutWorktree(worktreeAdminWorkingCopy(admin)), args, sink, {
|
|
6535
6545
|
allowUnreachable,
|
|
6536
6546
|
...options
|
|
6537
6547
|
});
|
|
@@ -6644,6 +6654,8 @@ function applyArchiveArgs(command, args) {
|
|
|
6644
6654
|
* (builtin/archive.c's `run_remote_archiver`): the archive made by the remote's
|
|
6645
6655
|
* upload-archive.
|
|
6646
6656
|
*/
|
|
6657
|
+
/** What the in-process upload-archive may write ahead of the client. */
|
|
6658
|
+
const LOCAL_HIGH_WATER_MARK = 1 << 20;
|
|
6647
6659
|
/**
|
|
6648
6660
|
* `git archive --remote`: `git archive`'s arguments (without `--remote`, `--exec` and
|
|
6649
6661
|
* `--output`) sent to the remote's upload-archive, the archive it makes returned. A local
|
|
@@ -6666,6 +6678,7 @@ var RemoteArchiveCommand = class extends TransportCommand {
|
|
|
6666
6678
|
exec;
|
|
6667
6679
|
outputName;
|
|
6668
6680
|
args = [];
|
|
6681
|
+
output;
|
|
6669
6682
|
/** `--remote=<repo>`: a remote's name or a URL (a path for a local repository). */
|
|
6670
6683
|
setRemote(remote) {
|
|
6671
6684
|
this.checkCallable();
|
|
@@ -6687,6 +6700,28 @@ var RemoteArchiveCommand = class extends TransportCommand {
|
|
|
6687
6700
|
this.outputName = name;
|
|
6688
6701
|
return this;
|
|
6689
6702
|
}
|
|
6703
|
+
/**
|
|
6704
|
+
* Takes the archive as it arrives, chunk by chunk (git writing its stdout or `-o`'s file),
|
|
6705
|
+
* instead of collecting it in {@link RemoteArchiveResult.archive}: the next chunk is read
|
|
6706
|
+
* once the returned promise settles, so neither end holds the archive whole. A rejection
|
|
6707
|
+
* is the client's death (exit 128).
|
|
6708
|
+
*
|
|
6709
|
+
* @example
|
|
6710
|
+
* ```typescript
|
|
6711
|
+
* const writer = file.getWriter();
|
|
6712
|
+
* const { exitCode } = await git
|
|
6713
|
+
* .archiveRemote()
|
|
6714
|
+
* .setRemote("origin")
|
|
6715
|
+
* .addArguments("HEAD")
|
|
6716
|
+
* .setOutput((chunk) => writer.write(chunk))
|
|
6717
|
+
* .call();
|
|
6718
|
+
* ```
|
|
6719
|
+
*/
|
|
6720
|
+
setOutput(output) {
|
|
6721
|
+
this.checkCallable();
|
|
6722
|
+
this.output = output;
|
|
6723
|
+
return this;
|
|
6724
|
+
}
|
|
6690
6725
|
/** `git archive`'s other arguments, as given (`--format=tar`, `-v`, `HEAD`, `--`, paths). */
|
|
6691
6726
|
addArguments(...args) {
|
|
6692
6727
|
this.checkCallable();
|
|
@@ -6698,14 +6733,17 @@ var RemoteArchiveCommand = class extends TransportCommand {
|
|
|
6698
6733
|
this.setCallable(false);
|
|
6699
6734
|
if (this.remote === void 0) throw new GitApiError("fatal: no remote given: setRemote() names the repository", { exitCode: 129 });
|
|
6700
6735
|
const formatHint = this.outputName !== void 0 ? new ArchiveCommand(this.workingCopy).formatFromFilename(this.outputName) : void 0;
|
|
6701
|
-
const options =
|
|
6736
|
+
const options = {
|
|
6737
|
+
...formatHint ? { formatHint } : {},
|
|
6738
|
+
...this.output ? { output: this.output } : {}
|
|
6739
|
+
};
|
|
6702
6740
|
const url = RemoteConfigStore.from(this.workingCopy).remoteUrlOf(this.remote);
|
|
6703
6741
|
const remote = await this.prepareRemote(url);
|
|
6704
6742
|
if (remote.kind === "bundle") throw new GitApiError("fatal: operation not supported by protocol");
|
|
6705
6743
|
if (remote.kind === "local") {
|
|
6706
6744
|
const writer = uploadArchiveWriterOf(remote.repository);
|
|
6707
6745
|
if (!writer) throw new GitApiError("fatal: operation not supported by protocol");
|
|
6708
|
-
const [client, server] = createDuplexPair();
|
|
6746
|
+
const [client, server] = createDuplexPair({ highWaterMark: LOCAL_HIGH_WATER_MARK });
|
|
6709
6747
|
const serving = serveUploadArchive(server, writer).finally(() => server.close?.());
|
|
6710
6748
|
const [result, served] = await Promise.all([requestRemoteArchive(client, this.args, options).finally(() => client.close?.()), serving]);
|
|
6711
6749
|
return served.error ? {
|
|
@@ -12127,34 +12165,6 @@ var CatFileCommand = class extends PlumbingCommand {
|
|
|
12127
12165
|
const MAX_ALLOWED_OBJ_LIMIT = 1e4;
|
|
12128
12166
|
/** cat-file.c's MAX_REMOTE_OBJ_INFO_LINE: a URL of 8 KiB and the ids (GIT_MAX_HEXSZ + 1 each). */
|
|
12129
12167
|
const MAX_REMOTE_OBJ_INFO_LINE = 658192;
|
|
12130
|
-
/**
|
|
12131
|
-
* alias.c's split_cmdline: words split on whitespace, quotes removed, a backslash escaping
|
|
12132
|
-
* the next character outside single quotes; split_cmdline_strerror's text on an error.
|
|
12133
|
-
*/
|
|
12134
|
-
function splitCmdline(line) {
|
|
12135
|
-
const args = [];
|
|
12136
|
-
let current = "";
|
|
12137
|
-
let quoted = "";
|
|
12138
|
-
for (let i = 0; i < line.length; i++) {
|
|
12139
|
-
const c = line[i];
|
|
12140
|
-
if (!quoted && /[ \t\n\r]/.test(c)) {
|
|
12141
|
-
args.push(current);
|
|
12142
|
-
current = "";
|
|
12143
|
-
while (i + 1 < line.length && /[ \t\n\r]/.test(line[i + 1])) i++;
|
|
12144
|
-
} else if (!quoted && (c === "'" || c === "\"")) quoted = c;
|
|
12145
|
-
else if (c === quoted) quoted = "";
|
|
12146
|
-
else {
|
|
12147
|
-
if (c === "\\" && quoted !== "'") {
|
|
12148
|
-
i++;
|
|
12149
|
-
if (i >= line.length) return "cmdline ends with \\";
|
|
12150
|
-
}
|
|
12151
|
-
current += line[i];
|
|
12152
|
-
}
|
|
12153
|
-
}
|
|
12154
|
-
if (quoted) return "unclosed quote";
|
|
12155
|
-
args.push(current);
|
|
12156
|
-
return args;
|
|
12157
|
-
}
|
|
12158
12168
|
function modeLetter(mode) {
|
|
12159
12169
|
return mode === "type" ? "t" : mode === "size" ? "s" : mode === "exists" ? "e" : "p";
|
|
12160
12170
|
}
|
|
@@ -12345,7 +12355,8 @@ function inputRecords(input, nul) {
|
|
|
12345
12355
|
records,
|
|
12346
12356
|
badlyQuoted: true
|
|
12347
12357
|
};
|
|
12348
|
-
|
|
12358
|
+
const nul = unquoted.path.indexOf("\0");
|
|
12359
|
+
records.push(nul < 0 ? unquoted.path : unquoted.path.slice(0, nul));
|
|
12349
12360
|
} else records.push(decodeGitPath(line));
|
|
12350
12361
|
}
|
|
12351
12362
|
return {
|
|
@@ -12621,323 +12632,909 @@ var CheckAttrCommand = class extends GitCommand {
|
|
|
12621
12632
|
}
|
|
12622
12633
|
};
|
|
12623
12634
|
//#endregion
|
|
12624
|
-
//#region src/commands/
|
|
12635
|
+
//#region src/commands/ls-tree-command.ts
|
|
12625
12636
|
/**
|
|
12626
|
-
* `git
|
|
12627
|
-
* `-v` the pattern that decides (`<source>:<line>:<pattern>\t<path>`).
|
|
12637
|
+
* `git ls-tree` (builtin/ls-tree.c): the entries of a tree, byte for byte as git prints them.
|
|
12628
12638
|
*
|
|
12629
12639
|
* @example
|
|
12630
12640
|
* ```typescript
|
|
12631
|
-
* // git
|
|
12632
|
-
* await git.
|
|
12633
|
-
*
|
|
12641
|
+
* // git ls-tree -r --name-only HEAD src/
|
|
12642
|
+
* const { stdout } = await git.lsTree().setTreeish("HEAD").setRecursive(true)
|
|
12643
|
+
* .setNameOnly().addPaths("src/").callOutput();
|
|
12634
12644
|
* ```
|
|
12635
12645
|
*/
|
|
12636
|
-
|
|
12637
|
-
const
|
|
12638
|
-
|
|
12639
|
-
|
|
12646
|
+
/** The fast paths ls-tree takes for a `--format` equal to a mode's own format. */
|
|
12647
|
+
const MODE_FORMATS = [
|
|
12648
|
+
["default", "%(objectmode) %(objecttype) %(objectname)%x09%(path)"],
|
|
12649
|
+
["long", "%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)"],
|
|
12650
|
+
["name-only", "%(path)"],
|
|
12651
|
+
["object-only", "%(objectname)"]
|
|
12652
|
+
];
|
|
12653
|
+
const USAGE$9 = "usage: git ls-tree [<options>] <tree-ish> [<path>...]";
|
|
12654
|
+
/** pathspec.c's `pathspec_magic`: the bits, mnemonics and names, in its order */
|
|
12655
|
+
const MAGIC$2 = [
|
|
12656
|
+
{
|
|
12657
|
+
name: "top",
|
|
12658
|
+
mnemonic: "/"
|
|
12659
|
+
},
|
|
12660
|
+
{
|
|
12661
|
+
name: "literal",
|
|
12662
|
+
mnemonic: ""
|
|
12663
|
+
},
|
|
12664
|
+
{
|
|
12665
|
+
name: "glob",
|
|
12666
|
+
mnemonic: ""
|
|
12667
|
+
},
|
|
12668
|
+
{
|
|
12669
|
+
name: "icase",
|
|
12670
|
+
mnemonic: ""
|
|
12671
|
+
},
|
|
12672
|
+
{
|
|
12673
|
+
name: "exclude",
|
|
12674
|
+
mnemonic: "!"
|
|
12675
|
+
},
|
|
12676
|
+
{
|
|
12677
|
+
name: "attr",
|
|
12678
|
+
mnemonic: ""
|
|
12679
|
+
}
|
|
12680
|
+
];
|
|
12681
|
+
const FLUSH_AT = 65536;
|
|
12640
12682
|
/**
|
|
12641
|
-
* `git
|
|
12642
|
-
*
|
|
12643
|
-
*
|
|
12644
|
-
*
|
|
12645
|
-
*
|
|
12646
|
-
*
|
|
12647
|
-
*
|
|
12683
|
+
* `git ls-tree [<options>] <tree-ish> [<path>...]`.
|
|
12684
|
+
*
|
|
12685
|
+
* Paths are ls-tree's own: literal pathspecs (only `:(top)` and `:(literal)` magic), a tree
|
|
12686
|
+
* shown or entered by leading path components (`show_recursive`), not wildcard matches.
|
|
12687
|
+
* Output paths are relative to {@link setPrefix} unless `--full-name`/`--full-tree`.
|
|
12688
|
+
*
|
|
12689
|
+
* git 2.43 (`setCompatibility("2.43")`) words the conflict of two output modes as
|
|
12690
|
+
* `error: <b> is incompatible with <a>`, 2.45 and later as `error: options '<b>' and '<a>'
|
|
12691
|
+
* cannot be used together`. Usage errors exit 129 with that first line only (git prints its
|
|
12692
|
+
* usage after it).
|
|
12648
12693
|
*/
|
|
12649
|
-
var
|
|
12694
|
+
var LsTreeCommand = class extends PlumbingCommand {
|
|
12695
|
+
treeish;
|
|
12650
12696
|
paths = [];
|
|
12651
|
-
|
|
12697
|
+
treesOnly = false;
|
|
12698
|
+
recursive = false;
|
|
12699
|
+
showTrees = false;
|
|
12652
12700
|
nul = false;
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12701
|
+
modes = [];
|
|
12702
|
+
fullName;
|
|
12703
|
+
fullTree = false;
|
|
12704
|
+
format;
|
|
12705
|
+
abbrev = 0;
|
|
12657
12706
|
prefix = "";
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
this.paths.push(path);
|
|
12662
|
-
return this;
|
|
12663
|
-
}
|
|
12664
|
-
/** `--stdin`: the paths of this input (git's stdin). */
|
|
12665
|
-
setStdin(input) {
|
|
12707
|
+
compatibility = "2.56";
|
|
12708
|
+
/** The `<tree-ish>` argument. */
|
|
12709
|
+
setTreeish(name) {
|
|
12666
12710
|
this.checkCallable();
|
|
12667
|
-
this.
|
|
12711
|
+
this.treeish = name;
|
|
12668
12712
|
return this;
|
|
12669
12713
|
}
|
|
12670
|
-
/**
|
|
12671
|
-
|
|
12714
|
+
/** `<path>...` arguments, read against {@link setPrefix}. */
|
|
12715
|
+
addPaths(...paths) {
|
|
12672
12716
|
this.checkCallable();
|
|
12673
|
-
this.
|
|
12717
|
+
this.paths.push(...paths);
|
|
12674
12718
|
return this;
|
|
12675
12719
|
}
|
|
12676
|
-
/** `-
|
|
12677
|
-
|
|
12720
|
+
/** `-d`: only trees (and gitlinks). */
|
|
12721
|
+
setTreesOnly(on = true) {
|
|
12678
12722
|
this.checkCallable();
|
|
12679
|
-
this.
|
|
12723
|
+
this.treesOnly = on;
|
|
12680
12724
|
return this;
|
|
12681
12725
|
}
|
|
12682
|
-
/** `-
|
|
12683
|
-
|
|
12726
|
+
/** `-r`: recurse into subtrees. */
|
|
12727
|
+
setRecursive(on = true) {
|
|
12684
12728
|
this.checkCallable();
|
|
12685
|
-
this.
|
|
12729
|
+
this.recursive = on;
|
|
12686
12730
|
return this;
|
|
12687
12731
|
}
|
|
12688
|
-
/** `-
|
|
12689
|
-
|
|
12732
|
+
/** `-t`: show the trees recursed into. */
|
|
12733
|
+
setShowTrees(on = true) {
|
|
12690
12734
|
this.checkCallable();
|
|
12691
|
-
this.
|
|
12735
|
+
this.showTrees = on;
|
|
12692
12736
|
return this;
|
|
12693
12737
|
}
|
|
12694
|
-
/**
|
|
12695
|
-
|
|
12738
|
+
/** `-z`: entries end with NUL, paths unquoted. */
|
|
12739
|
+
setNullTerminated(on = true) {
|
|
12696
12740
|
this.checkCallable();
|
|
12697
|
-
this.
|
|
12741
|
+
this.nul = on;
|
|
12698
12742
|
return this;
|
|
12699
12743
|
}
|
|
12700
|
-
/**
|
|
12701
|
-
|
|
12744
|
+
/**
|
|
12745
|
+
* An output mode option (`-l`/`--long`, `--name-only`, `--name-status`, `--object-only`),
|
|
12746
|
+
* `option` its spelling for git's conflict message; a second, different mode is refused.
|
|
12747
|
+
*/
|
|
12748
|
+
addMode(mode, option = `--${mode}`) {
|
|
12702
12749
|
this.checkCallable();
|
|
12703
|
-
this.
|
|
12750
|
+
this.modes.push({
|
|
12751
|
+
mode,
|
|
12752
|
+
option
|
|
12753
|
+
});
|
|
12704
12754
|
return this;
|
|
12705
12755
|
}
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
this.
|
|
12709
|
-
let stdout = "";
|
|
12710
|
-
const stderr = "";
|
|
12711
|
-
const die = (message, exitCode = 128) => ({
|
|
12712
|
-
exitCode,
|
|
12713
|
-
stdout,
|
|
12714
|
-
stderr: `${stderr}fatal: ${message}\n`
|
|
12715
|
-
});
|
|
12716
|
-
if (this.stdin !== void 0) {
|
|
12717
|
-
if (this.paths.length > 0) return die("cannot specify pathnames with --stdin");
|
|
12718
|
-
} else {
|
|
12719
|
-
if (this.nul) return die("-z only makes sense with --stdin");
|
|
12720
|
-
if (this.paths.length === 0) return die("no path specified");
|
|
12721
|
-
}
|
|
12722
|
-
if (this.quiet) {
|
|
12723
|
-
if (this.paths.length > 1) return die("--quiet is only valid with a single pathname");
|
|
12724
|
-
if (this.verbose) return die("cannot have both --quiet and --verbose");
|
|
12725
|
-
}
|
|
12726
|
-
if (this.nonMatching && !this.verbose) return die("--non-matching is only valid with --verbose");
|
|
12727
|
-
const worktree = "worktree" in this._workingCopy ? this._workingCopy.worktree : void 0;
|
|
12728
|
-
if (!worktree?.ignoreMatch) return die("this operation must be run in a work tree");
|
|
12729
|
-
const staging = this.noIndex ? void 0 : this._workingCopy.checkout?.staging;
|
|
12730
|
-
const index = staging ? await this.indexEntries() : [];
|
|
12731
|
-
const quoteFully = configBool$1(this._workingCopy, "core.quotePath", true);
|
|
12732
|
-
const sources = await this.sourceNames();
|
|
12733
|
-
let ignored = 0;
|
|
12734
|
-
const top = await worktreeHostPath(this._workingCopy);
|
|
12735
|
-
const checkOne = async (original) => {
|
|
12736
|
-
const full = prefixPath(this.prefix, original, top);
|
|
12737
|
-
if (full === void 0) return `${original}: '${original}' is outside repository at '${top ?? ""}'`;
|
|
12738
|
-
const path = full.replace(/\/+$/, "");
|
|
12739
|
-
const parts = path.split("/");
|
|
12740
|
-
for (let k = 1; k < parts.length; k++) {
|
|
12741
|
-
const entry = await worktree.getEntry(parts.slice(0, k).join("/")).catch(() => void 0);
|
|
12742
|
-
if (entry && (entry.mode & S_IFMT$6) === S_IFLNK$1) return `pathspec '${original}' is beyond a symbolic link`;
|
|
12743
|
-
}
|
|
12744
|
-
if (staging) {
|
|
12745
|
-
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}'`;
|
|
12746
|
-
}
|
|
12747
|
-
let match;
|
|
12748
|
-
if (!staging || !this.seenInIndex(full, index)) {
|
|
12749
|
-
match = await worktree.ignoreMatch?.(path);
|
|
12750
|
-
if (!this.verbose && match?.negated) match = void 0;
|
|
12751
|
-
}
|
|
12752
|
-
if (!this.quiet && (match || this.nonMatching)) stdout += this.line(original, match, sources, quoteFully);
|
|
12753
|
-
if (match) ignored++;
|
|
12754
|
-
};
|
|
12755
|
-
const run = async () => {
|
|
12756
|
-
if (this.stdin === void 0) for (const path of this.paths) {
|
|
12757
|
-
const death = await checkOne(path);
|
|
12758
|
-
if (death) return die(death);
|
|
12759
|
-
}
|
|
12760
|
-
else {
|
|
12761
|
-
const { records, badlyQuoted } = inputRecords(this.stdin, this.nul);
|
|
12762
|
-
for (const path of records) {
|
|
12763
|
-
const death = await checkOne(path);
|
|
12764
|
-
if (death) return die(death);
|
|
12765
|
-
}
|
|
12766
|
-
if (badlyQuoted) return die("line is badly quoted");
|
|
12767
|
-
}
|
|
12768
|
-
return {
|
|
12769
|
-
exitCode: ignored ? 0 : 1,
|
|
12770
|
-
stdout,
|
|
12771
|
-
stderr
|
|
12772
|
-
};
|
|
12773
|
-
};
|
|
12774
|
-
return worktree.batch ? worktree.batch(run) : run();
|
|
12756
|
+
/** `-l`/`--long`: object sizes. */
|
|
12757
|
+
setLong(option = "--long") {
|
|
12758
|
+
return this.addMode("long", option);
|
|
12775
12759
|
}
|
|
12776
|
-
/**
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
if (match) {
|
|
12780
|
-
const s = match.source;
|
|
12781
|
-
source = s.kind === "directory" ? `${s.directory ? `${s.directory}/` : ""}.gitignore` : s.kind === "exclude" && s.name === "info/exclude" ? sources.info : s.kind === "exclude" && s.name === "core.excludesFile" ? sources.excludes ?? "" : "";
|
|
12782
|
-
}
|
|
12783
|
-
if (this.nul) {
|
|
12784
|
-
if (!this.verbose) return `${path}\0`;
|
|
12785
|
-
return match ? `${source}\0${match.line}\0${match.pattern}\0${path}\0` : `\0\0\0${path}\0`;
|
|
12786
|
-
}
|
|
12787
|
-
if (!this.verbose) return `${quotePath(path, quoteFully)}\n`;
|
|
12788
|
-
return `${match ? `${quotePath(source, quoteFully)}:${match.line}:${match.pattern}\t` : ":: "}${quotePath(path, quoteFully)}\n`;
|
|
12760
|
+
/** `--name-only`: paths only. */
|
|
12761
|
+
setNameOnly() {
|
|
12762
|
+
return this.addMode("name-only");
|
|
12789
12763
|
}
|
|
12790
|
-
/**
|
|
12791
|
-
|
|
12792
|
-
|
|
12793
|
-
const out = [];
|
|
12794
|
-
for await (const e of staging.entries()) if (!e.skipWorktree) out.push({
|
|
12795
|
-
path: e.path,
|
|
12796
|
-
mode: e.mode
|
|
12797
|
-
});
|
|
12798
|
-
return out;
|
|
12764
|
+
/** `--name-status`: as `--name-only`. */
|
|
12765
|
+
setNameStatus() {
|
|
12766
|
+
return this.addMode("name-status");
|
|
12799
12767
|
}
|
|
12800
|
-
/**
|
|
12801
|
-
|
|
12802
|
-
|
|
12803
|
-
try {
|
|
12804
|
-
item = parsePathspecItem(full === "" ? "." : full);
|
|
12805
|
-
} catch {
|
|
12806
|
-
return false;
|
|
12807
|
-
}
|
|
12808
|
-
for (const e of index) {
|
|
12809
|
-
const dir = (e.mode & S_IFMT$6) === S_IFGITLINK$3 || (e.mode & S_IFMT$6) === S_IFDIR$4;
|
|
12810
|
-
if (matchPathspec([item], e.path, dir ? 1 : 0)) return true;
|
|
12811
|
-
}
|
|
12812
|
-
return false;
|
|
12768
|
+
/** `--object-only`: object names only. */
|
|
12769
|
+
setObjectOnly() {
|
|
12770
|
+
return this.addMode("object-only");
|
|
12813
12771
|
}
|
|
12814
|
-
/**
|
|
12815
|
-
|
|
12816
|
-
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
const gitDir = this._workingCopy.config?.hostGitDir;
|
|
12820
|
-
const top = await worktreeHostPath(this._workingCopy);
|
|
12821
|
-
const trimmed = gitDir?.replace(/\/+$/, "");
|
|
12822
|
-
return {
|
|
12823
|
-
info: trimmed === void 0 || top !== void 0 && trimmed === `${top.replace(/\/+$/, "")}/.git` ? ".git/info/exclude" : `${trimmed}/info/exclude`,
|
|
12824
|
-
excludes
|
|
12825
|
-
};
|
|
12772
|
+
/** `--[no-]full-name`: paths from the top (default: on when there is no prefix). */
|
|
12773
|
+
setFullName(on = true) {
|
|
12774
|
+
this.checkCallable();
|
|
12775
|
+
this.fullName = on;
|
|
12776
|
+
return this;
|
|
12826
12777
|
}
|
|
12827
|
-
|
|
12828
|
-
|
|
12829
|
-
//#region src/commands/check-mailmap-command.ts
|
|
12830
|
-
/**
|
|
12831
|
-
* `git check-mailmap` (builtin/check-mailmap.c): each contact as the repository's mailmap
|
|
12832
|
-
* maps it (`.mailmap`, `mailmap.blob`, `mailmap.file`, plus `--mailmap-blob` and
|
|
12833
|
-
* `--mailmap-file`).
|
|
12834
|
-
*
|
|
12835
|
-
* @example
|
|
12836
|
-
* ```typescript
|
|
12837
|
-
* // git check-mailmap "nick1 <bugs@company.xx>"
|
|
12838
|
-
* await git.checkMailmap().addContact("nick1 <bugs@company.xx>").call();
|
|
12839
|
-
* // "Some Dude <some@dude.xx>\n"
|
|
12840
|
-
* ```
|
|
12841
|
-
*/
|
|
12842
|
-
/**
|
|
12843
|
-
* The contacts of `git check-mailmap <contact>...` (and `--stdin`'s lines after them), one
|
|
12844
|
-
* output line each: `Name <email>`, or `<email>` when the result has no name.
|
|
12845
|
-
*
|
|
12846
|
-
* git 2.43 (`setCompatibility("2.43")`) takes only `Name <email>` contacts (`fatal: unable
|
|
12847
|
-
* to parse contact: <contact>`) and has no `--mailmap-file`/`--mailmap-blob`; 2.47 and later
|
|
12848
|
-
* also map a bare address. Where git dies, the error carries what was printed before
|
|
12849
|
-
* ({@link getOutput}).
|
|
12850
|
-
*/
|
|
12851
|
-
var CheckMailmapCommand = class extends GitCommand {
|
|
12852
|
-
contacts = [];
|
|
12853
|
-
stdin;
|
|
12854
|
-
mailmapFile;
|
|
12855
|
-
mailmapBlob;
|
|
12856
|
-
compatibility = "2.56";
|
|
12857
|
-
output = "";
|
|
12858
|
-
errors = [];
|
|
12859
|
-
/** A contact argument. */
|
|
12860
|
-
addContact(contact) {
|
|
12778
|
+
/** `--full-tree`: the whole tree, paths from the top, the prefix ignored. */
|
|
12779
|
+
setFullTree(on = true) {
|
|
12861
12780
|
this.checkCallable();
|
|
12862
|
-
this.
|
|
12781
|
+
this.fullTree = on;
|
|
12863
12782
|
return this;
|
|
12864
12783
|
}
|
|
12865
|
-
/** `--
|
|
12866
|
-
|
|
12784
|
+
/** `--format=<format>`. */
|
|
12785
|
+
setFormat(format) {
|
|
12867
12786
|
this.checkCallable();
|
|
12868
|
-
this.
|
|
12787
|
+
this.format = format;
|
|
12869
12788
|
return this;
|
|
12870
12789
|
}
|
|
12871
|
-
/**
|
|
12872
|
-
|
|
12790
|
+
/**
|
|
12791
|
+
* `--abbrev[=<n>]`: `undefined` is `--abbrev` (core.abbrev, else automatic), 0 the full
|
|
12792
|
+
* id (`--no-abbrev`), else at least `n` digits (4 at least).
|
|
12793
|
+
*/
|
|
12794
|
+
setAbbrev(length) {
|
|
12873
12795
|
this.checkCallable();
|
|
12874
|
-
this.
|
|
12796
|
+
this.abbrev = length === void 0 ? -1 : length;
|
|
12875
12797
|
return this;
|
|
12876
12798
|
}
|
|
12877
|
-
/**
|
|
12878
|
-
|
|
12799
|
+
/** The directory git runs in, relative to the top of the worktree (git's prefix). */
|
|
12800
|
+
setPrefix(prefix) {
|
|
12879
12801
|
this.checkCallable();
|
|
12880
|
-
|
|
12802
|
+
const p = prefix.replace(/^\/+|\/+$/g, "");
|
|
12803
|
+
this.prefix = p ? `${p}/` : "";
|
|
12881
12804
|
return this;
|
|
12882
12805
|
}
|
|
12883
|
-
/** The git version whose
|
|
12806
|
+
/** The git version whose messages to follow (default 2.56). */
|
|
12884
12807
|
setCompatibility(version) {
|
|
12885
12808
|
this.checkCallable();
|
|
12886
12809
|
this.compatibility = version;
|
|
12887
12810
|
return this;
|
|
12888
12811
|
}
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
return this.output;
|
|
12812
|
+
writesNoObjects() {
|
|
12813
|
+
return true;
|
|
12892
12814
|
}
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12815
|
+
out = [];
|
|
12816
|
+
outSize = 0;
|
|
12817
|
+
emit(bytes) {
|
|
12818
|
+
this.out.push(bytes);
|
|
12819
|
+
this.outSize += bytes.length;
|
|
12820
|
+
return this.outSize >= FLUSH_AT ? this.flush() : void 0;
|
|
12896
12821
|
}
|
|
12897
|
-
|
|
12898
|
-
|
|
12899
|
-
this.
|
|
12900
|
-
|
|
12901
|
-
const
|
|
12902
|
-
|
|
12903
|
-
|
|
12904
|
-
throw new GitApiError(`error: unknown option \`${option}'\nusage: git check-mailmap [<options>] <contact>...`);
|
|
12822
|
+
async flush() {
|
|
12823
|
+
if (this.outSize === 0) return;
|
|
12824
|
+
const all = new Uint8Array(this.outSize);
|
|
12825
|
+
let at = 0;
|
|
12826
|
+
for (const c of this.out) {
|
|
12827
|
+
all.set(c, at);
|
|
12828
|
+
at += c.length;
|
|
12905
12829
|
}
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
if (
|
|
12830
|
+
this.out = [];
|
|
12831
|
+
this.outSize = 0;
|
|
12832
|
+
await this.write(all);
|
|
12833
|
+
}
|
|
12834
|
+
async run() {
|
|
12835
|
+
let mode;
|
|
12836
|
+
let modeOption = "";
|
|
12837
|
+
for (const m of this.modes) {
|
|
12838
|
+
if (mode !== void 0 && m.mode !== mode) throw new PlumbingError(this.compatibility === "2.43" ? `error: ${m.option} is incompatible with ${modeOption}` : `error: options '${m.option}' and '${modeOption}' cannot be used together`, 129);
|
|
12839
|
+
mode = m.mode;
|
|
12840
|
+
modeOption = m.option;
|
|
12915
12841
|
}
|
|
12916
|
-
if (
|
|
12917
|
-
|
|
12918
|
-
|
|
12842
|
+
if (mode === "name-status") mode = "name-only";
|
|
12843
|
+
let prefix = this.prefix || void 0;
|
|
12844
|
+
if (this.fullTree) prefix = void 0;
|
|
12845
|
+
const outputPrefix = this.fullName ?? !this.prefix ? void 0 : prefix;
|
|
12846
|
+
let showTrees = this.showTrees;
|
|
12847
|
+
if (this.treesOnly && this.recursive) showTrees = true;
|
|
12848
|
+
if (this.format !== void 0 && mode !== void 0) throw new PlumbingError("fatal: --format can't be combined with other format-altering options", 129);
|
|
12849
|
+
if (this.treeish === void 0) throw new PlumbingError(USAGE$9, 129);
|
|
12850
|
+
const resolver = this.revisionResolver();
|
|
12851
|
+
let id;
|
|
12852
|
+
try {
|
|
12853
|
+
id = await resolver.resolve(this.treeish, { hashAny: true });
|
|
12854
|
+
} catch (e) {
|
|
12855
|
+
if (!(e instanceof RefNotFoundError)) throw e;
|
|
12919
12856
|
}
|
|
12920
|
-
for (const
|
|
12921
|
-
|
|
12922
|
-
|
|
12857
|
+
for (const w of resolver.warnings) this.warn(w);
|
|
12858
|
+
resolver.warnings.length = 0;
|
|
12859
|
+
if (id === void 0) throw new PlumbingError(`fatal: Not a valid object name ${this.treeish}`);
|
|
12860
|
+
const items = await this.parsePaths(prefix);
|
|
12861
|
+
const tree = await this.peelToTree(id);
|
|
12862
|
+
if (tree === void 0) throw new PlumbingError("fatal: not a tree object");
|
|
12863
|
+
let fn;
|
|
12864
|
+
if (this.format !== void 0) {
|
|
12865
|
+
const fast = MODE_FORMATS.find(([, f]) => f === this.format);
|
|
12866
|
+
fn = fast ? fast[0] : "format";
|
|
12867
|
+
} else fn = mode ?? "default";
|
|
12868
|
+
const quotePathValue = (this._workingCopy.config ? RemoteConfigStore.from(this._workingCopy) : void 0)?.value("core.quotePath");
|
|
12869
|
+
const quoteFully = quotePathValue === void 0 ? true : parseGitBool$1(quotePathValue) ?? true;
|
|
12870
|
+
const ctx = {
|
|
12871
|
+
items,
|
|
12872
|
+
ps: items.length > 0 ? treePathspec(items) : void 0,
|
|
12873
|
+
fn,
|
|
12874
|
+
treesOnly: this.treesOnly,
|
|
12875
|
+
recursive: this.recursive,
|
|
12876
|
+
showTrees,
|
|
12877
|
+
outputPrefix: outputPrefix === void 0 ? void 0 : latin1String(encodeGitPath(outputPrefix)),
|
|
12878
|
+
quoteFully,
|
|
12879
|
+
nulTerminated: this.nul
|
|
12880
|
+
};
|
|
12881
|
+
let ok;
|
|
12882
|
+
try {
|
|
12883
|
+
ok = await this.walk(ctx, tree, "");
|
|
12884
|
+
} finally {
|
|
12885
|
+
await this.flush();
|
|
12886
|
+
}
|
|
12887
|
+
return ok ? 0 : 1;
|
|
12923
12888
|
}
|
|
12924
|
-
|
|
12925
|
-
|
|
12926
|
-
|
|
12927
|
-
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12889
|
+
/** parse_pathspec with ls-tree's magic mask and PATHSPEC_PREFER_CWD: literal elements. */
|
|
12890
|
+
async parsePaths(prefix) {
|
|
12891
|
+
const literal = (match) => pathspecItemBytes({
|
|
12892
|
+
match,
|
|
12893
|
+
nowildcardLen: match.length,
|
|
12894
|
+
oneStar: false,
|
|
12895
|
+
exclude: false,
|
|
12896
|
+
glob: false,
|
|
12897
|
+
icase: false
|
|
12898
|
+
});
|
|
12899
|
+
if (this.paths.length === 0) return prefix ? [literal(prefix)] : [];
|
|
12900
|
+
for (const p of this.paths) if (p === "") throw new PlumbingError("fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths");
|
|
12901
|
+
const items = [];
|
|
12902
|
+
for (const elem of this.paths) {
|
|
12903
|
+
const { magic, rest } = parseElementMagic(elem);
|
|
12904
|
+
if (magic.has("literal") && magic.has("glob")) throw new PlumbingError(`fatal: ${elem}: 'literal' and 'glob' are incompatible`);
|
|
12905
|
+
let match;
|
|
12906
|
+
if (magic.has("top")) match = rest;
|
|
12907
|
+
else {
|
|
12908
|
+
const normalized = await this.prefixPath(prefix ?? "", rest);
|
|
12909
|
+
if (normalized === void 0) {
|
|
12910
|
+
const top = await this.hostWorkingDir() ?? "";
|
|
12911
|
+
throw new PlumbingError(`fatal: ${elem}: '${rest}' is outside repository at '${top.replace(/\/+$/, "") || "/"}'`);
|
|
12912
|
+
}
|
|
12913
|
+
match = normalized;
|
|
12914
|
+
}
|
|
12915
|
+
const unsupported = unsupportedPathspecMagic(elem, magic, ["top", "literal"]);
|
|
12916
|
+
if (unsupported) throw new PlumbingError(`fatal: ${unsupported}`);
|
|
12917
|
+
items.push(literal(match));
|
|
12932
12918
|
}
|
|
12933
|
-
|
|
12934
|
-
this.output += `${mapped.name ? `${mapped.name} ` : ""}<${mapped.email}>\n`;
|
|
12919
|
+
return items;
|
|
12935
12920
|
}
|
|
12936
|
-
|
|
12937
|
-
|
|
12938
|
-
|
|
12939
|
-
|
|
12940
|
-
|
|
12921
|
+
/** prefix_path_gently: the path from the top, undefined when it leaves the worktree. */
|
|
12922
|
+
async prefixPath(prefix, path) {
|
|
12923
|
+
return prefixPathGently(prefix, path, path.startsWith("/") ? await this.hostWorkingDir() : void 0);
|
|
12924
|
+
}
|
|
12925
|
+
/** parse_tree_indirect: a commit's tree, a tag's object peeled, a tree itself. */
|
|
12926
|
+
async peelToTree(id) {
|
|
12927
|
+
const compat = this.compatObjects;
|
|
12928
|
+
if (compat && id.length !== this.objectFormat.hexLength) {
|
|
12929
|
+
const type = (await compat.readAsCompat(id).catch(() => void 0))?.type;
|
|
12930
|
+
if (type === "tree") return id;
|
|
12931
|
+
if (type === "commit") this.warn(`error: bogus commit object ${id}`);
|
|
12932
|
+
if (type === "blob") this.warn(`error: hash mismatch ${id}`);
|
|
12933
|
+
return;
|
|
12934
|
+
}
|
|
12935
|
+
const peeled = await this.revisionResolver().peelTags(id);
|
|
12936
|
+
if (peeled.type === "tree") return peeled.id;
|
|
12937
|
+
if (peeled.type === "commit") return (await this.commits.load(peeled.id).catch(() => void 0))?.tree;
|
|
12938
|
+
}
|
|
12939
|
+
/** read_tree_at: false when a tree could not be read (git's `-1`). */
|
|
12940
|
+
async walk(ctx, tree, base) {
|
|
12941
|
+
const entries = await this.listedTreeEntries(tree);
|
|
12942
|
+
if (!entries) {
|
|
12943
|
+
this.warn(`error: Could not read ${tree}`);
|
|
12944
|
+
return false;
|
|
12945
|
+
}
|
|
12946
|
+
const baseBytes = latin1Bytes$3(base);
|
|
12947
|
+
let all = false;
|
|
12948
|
+
for (const e of entries) {
|
|
12949
|
+
const nameBytes = encodeGitPath(e.name);
|
|
12950
|
+
const mode = e.mode;
|
|
12951
|
+
if (ctx.ps && !all) {
|
|
12952
|
+
const r = treeEntryInteresting(ctx.ps, nameBytes, 0, nameBytes.length, mode, baseBytes);
|
|
12953
|
+
if (r === -1) break;
|
|
12954
|
+
if (r === 0) continue;
|
|
12955
|
+
if (r === 2) all = true;
|
|
12956
|
+
}
|
|
12957
|
+
const name = latin1String(nameBytes);
|
|
12958
|
+
const type = objectTypeOfMode(mode);
|
|
12959
|
+
let recurse = false;
|
|
12960
|
+
let show = true;
|
|
12961
|
+
if (type === "blob") {
|
|
12962
|
+
if (ctx.treesOnly) show = false;
|
|
12963
|
+
} else if (type === "tree" && this.showRecursive(ctx, base, name)) {
|
|
12964
|
+
recurse = true;
|
|
12965
|
+
if (!ctx.showTrees) show = false;
|
|
12966
|
+
}
|
|
12967
|
+
if (show) {
|
|
12968
|
+
const pending = this.emit(await this.entryLine(ctx, e.id, mode, type, base + name));
|
|
12969
|
+
if (pending) await pending;
|
|
12970
|
+
}
|
|
12971
|
+
if (recurse && !await this.walk(ctx, e.id, `${base + name}/`)) return false;
|
|
12972
|
+
}
|
|
12973
|
+
return true;
|
|
12974
|
+
}
|
|
12975
|
+
/** show_recursive: whether a tree is entered. */
|
|
12976
|
+
showRecursive(ctx, base, pathname) {
|
|
12977
|
+
if (ctx.recursive) return true;
|
|
12978
|
+
for (const item of ctx.items) {
|
|
12979
|
+
const spec = item.match;
|
|
12980
|
+
if (!spec.startsWith(base)) continue;
|
|
12981
|
+
const rest = spec.slice(base.length);
|
|
12982
|
+
const len = pathname.length;
|
|
12983
|
+
if (rest.length <= len) continue;
|
|
12984
|
+
if (rest[len] !== "/") continue;
|
|
12985
|
+
if (rest.slice(0, len) !== pathname) continue;
|
|
12986
|
+
return true;
|
|
12987
|
+
}
|
|
12988
|
+
return false;
|
|
12989
|
+
}
|
|
12990
|
+
async abbreviated(id) {
|
|
12991
|
+
if (this.abbrev === 0) return id;
|
|
12992
|
+
if (id.length !== this.objectFormat.hexLength) {
|
|
12993
|
+
const min = this.abbrev < 0 ? 7 : Math.max(4, this.abbrev);
|
|
12994
|
+
return id.slice(0, Math.min(min, id.length));
|
|
12995
|
+
}
|
|
12996
|
+
const hex = this.objectFormat.hexLength;
|
|
12997
|
+
const min = this.abbrev < 0 ? void 0 : this.abbrev < 4 ? 4 : this.abbrev > hex ? hex : this.abbrev;
|
|
12998
|
+
const length = (await this.idAbbreviator().lengths([id], min)).get(id) ?? hex;
|
|
12999
|
+
return id.slice(0, length);
|
|
13000
|
+
}
|
|
13001
|
+
/** The blob's size, undefined when it cannot be read. */
|
|
13002
|
+
async blobSize(id) {
|
|
13003
|
+
const compat = this.compatObjects;
|
|
13004
|
+
if (compat && id.length !== this.objectFormat.hexLength) return (await compat.readAsCompat(id).catch(() => void 0))?.content.length;
|
|
13005
|
+
const objects = this._workingCopy.history?.objects;
|
|
13006
|
+
try {
|
|
13007
|
+
if (objects) {
|
|
13008
|
+
const header = await objects.header?.(id);
|
|
13009
|
+
if (header) return header.size;
|
|
13010
|
+
const obj = await objects.get(id);
|
|
13011
|
+
if (!obj) return void 0;
|
|
13012
|
+
await obj.content[Symbol.asyncIterator]().return?.();
|
|
13013
|
+
return obj.size;
|
|
13014
|
+
}
|
|
13015
|
+
return await this.blobs.size(id);
|
|
13016
|
+
} catch {
|
|
13017
|
+
return;
|
|
13018
|
+
}
|
|
13019
|
+
}
|
|
13020
|
+
/** The path (a byte string) as the fast paths print it. */
|
|
13021
|
+
fastPath(ctx, path) {
|
|
13022
|
+
const rel = relativePath$1(path, ctx.outputPrefix);
|
|
13023
|
+
if (ctx.nulTerminated) return latin1Bytes$3(`${rel}\0`);
|
|
13024
|
+
return latin1Bytes$3(`${quoteBytes(rel, ctx.quoteFully)}\n`);
|
|
13025
|
+
}
|
|
13026
|
+
async entryLine(ctx, id, mode, type, path) {
|
|
13027
|
+
const modeText = mode.toString(8).padStart(6, "0");
|
|
13028
|
+
switch (ctx.fn) {
|
|
13029
|
+
case "default": return concatBytes([latin1Bytes$3(`${modeText} ${type} ${await this.abbreviated(id)}\t`), this.fastPath(ctx, path)]);
|
|
13030
|
+
case "long": {
|
|
13031
|
+
let size = "-";
|
|
13032
|
+
if (type === "blob") size = String(await this.blobSize(id) ?? "BAD");
|
|
13033
|
+
return concatBytes([latin1Bytes$3(`${modeText} ${type} ${await this.abbreviated(id)} ${size.padStart(7)}\t`), this.fastPath(ctx, path)]);
|
|
13034
|
+
}
|
|
13035
|
+
case "name-only": return this.fastPath(ctx, path);
|
|
13036
|
+
case "object-only": return latin1Bytes$3(`${await this.abbreviated(id)}${this.nul ? "\0" : "\n"}`);
|
|
13037
|
+
default: return latin1Bytes$3(`${await this.expandFormat(ctx, id, modeText, type, path)}${this.nul ? "\0" : "\n"}`);
|
|
13038
|
+
}
|
|
13039
|
+
}
|
|
13040
|
+
/** show_tree_fmt's expansion (a byte string). */
|
|
13041
|
+
async expandFormat(ctx, id, modeText, type, path) {
|
|
13042
|
+
const format = latin1String(encodeGitPath(this.format ?? ""));
|
|
13043
|
+
let out = "";
|
|
13044
|
+
let i = 0;
|
|
13045
|
+
const size = async (padded) => {
|
|
13046
|
+
let text = "-";
|
|
13047
|
+
if (type === "blob") {
|
|
13048
|
+
const s = await this.blobSize(id);
|
|
13049
|
+
if (s === void 0) throw new PlumbingError(`fatal: could not get object info about '${id}'`);
|
|
13050
|
+
text = String(s);
|
|
13051
|
+
}
|
|
13052
|
+
return padded ? text.padStart(7) : text;
|
|
13053
|
+
};
|
|
13054
|
+
while (i < format.length) {
|
|
13055
|
+
const at = format.indexOf("%", i);
|
|
13056
|
+
if (at < 0) {
|
|
13057
|
+
out += format.slice(i);
|
|
13058
|
+
break;
|
|
13059
|
+
}
|
|
13060
|
+
out += format.slice(i, at);
|
|
13061
|
+
i = at + 1;
|
|
13062
|
+
const rest = format.slice(i);
|
|
13063
|
+
if (rest.startsWith("%")) {
|
|
13064
|
+
out += "%";
|
|
13065
|
+
i += 1;
|
|
13066
|
+
continue;
|
|
13067
|
+
}
|
|
13068
|
+
if (rest.startsWith("n")) {
|
|
13069
|
+
out += "\n";
|
|
13070
|
+
i += 1;
|
|
13071
|
+
continue;
|
|
13072
|
+
}
|
|
13073
|
+
const hex = /^x([0-9a-fA-F]{2})/.exec(rest);
|
|
13074
|
+
if (hex) {
|
|
13075
|
+
out += String.fromCharCode(Number.parseInt(hex[1], 16));
|
|
13076
|
+
i += 3;
|
|
13077
|
+
continue;
|
|
13078
|
+
}
|
|
13079
|
+
const atom = /^\((objectmode|objecttype|objectsize:padded|objectsize|objectname|path)\)/.exec(rest);
|
|
13080
|
+
if (!atom) {
|
|
13081
|
+
const shown = decodeLatin1Path(rest);
|
|
13082
|
+
if (!rest.startsWith("(")) throw new PlumbingError(`fatal: bad ls-tree format: element '${shown}' does not start with '('`);
|
|
13083
|
+
const close = rest.indexOf(")", 1);
|
|
13084
|
+
if (close < 0) throw new PlumbingError(`fatal: bad ls-tree format: element '${shown}' does not end in ')'`);
|
|
13085
|
+
throw new PlumbingError(`fatal: bad ls-tree format: %${decodeLatin1Path(rest.slice(0, close + 1))}`);
|
|
13086
|
+
}
|
|
13087
|
+
i += atom[0].length;
|
|
13088
|
+
switch (atom[1]) {
|
|
13089
|
+
case "objectmode":
|
|
13090
|
+
out += modeText;
|
|
13091
|
+
break;
|
|
13092
|
+
case "objecttype":
|
|
13093
|
+
out += type;
|
|
13094
|
+
break;
|
|
13095
|
+
case "objectsize:padded":
|
|
13096
|
+
out += await size(true);
|
|
13097
|
+
break;
|
|
13098
|
+
case "objectsize":
|
|
13099
|
+
out += await size(false);
|
|
13100
|
+
break;
|
|
13101
|
+
case "objectname":
|
|
13102
|
+
out += await this.abbreviated(id);
|
|
13103
|
+
break;
|
|
13104
|
+
default: out += quoteBytes(relativePath$1(path, ctx.outputPrefix), ctx.quoteFully);
|
|
13105
|
+
}
|
|
13106
|
+
}
|
|
13107
|
+
return out;
|
|
13108
|
+
}
|
|
13109
|
+
};
|
|
13110
|
+
/** A byte string as git prints it in an error message (bytes as they are). */
|
|
13111
|
+
function decodeLatin1Path(s) {
|
|
13112
|
+
return new TextDecoder().decode(latin1Bytes$3(s));
|
|
13113
|
+
}
|
|
13114
|
+
/** quote_c_style of a byte string, as a byte string. */
|
|
13115
|
+
function quoteBytes(path, quoteFully) {
|
|
13116
|
+
const body = quoteCStyleBody(latin1Bytes$3(path), quoteFully);
|
|
13117
|
+
if (body === void 0) return path;
|
|
13118
|
+
return latin1String(encodeGitPath(`"${body}"`));
|
|
13119
|
+
}
|
|
13120
|
+
/**
|
|
13121
|
+
* git's `unsupported_magic` message for the magic of `elem` outside `allowed` (a command's
|
|
13122
|
+
* `magic_mask`), undefined when it has none.
|
|
13123
|
+
*/
|
|
13124
|
+
function unsupportedPathspecMagic(elem, magic, allowed) {
|
|
13125
|
+
const unsupported = MAGIC$2.filter((m) => !allowed.includes(m.name) && magic.has(m.name));
|
|
13126
|
+
if (unsupported.length === 0) return void 0;
|
|
13127
|
+
return `${elem}: pathspec magic not supported by this command: ${unsupported.map((m) => m.mnemonic ? `'${m.name}' (mnemonic: '${m.mnemonic}')` : `'${m.name}'`).join(", ")}`;
|
|
13128
|
+
}
|
|
13129
|
+
/** parse_element_magic: the magic names an element carries and the path after them. */
|
|
13130
|
+
function parseElementMagic(elem) {
|
|
13131
|
+
const magic = /* @__PURE__ */ new Set();
|
|
13132
|
+
if (!elem.startsWith(":")) return {
|
|
13133
|
+
magic,
|
|
13134
|
+
rest: elem
|
|
13135
|
+
};
|
|
13136
|
+
if (elem[1] === "(") {
|
|
13137
|
+
let pos = 2;
|
|
13138
|
+
while (pos < elem.length && elem[pos] !== ")") {
|
|
13139
|
+
let len = 0;
|
|
13140
|
+
while (pos + len < elem.length && elem[pos + len] !== "," && elem[pos + len] !== ")") {
|
|
13141
|
+
if (elem[pos + len] === "\\" && pos + len + 1 < elem.length) len++;
|
|
13142
|
+
len++;
|
|
13143
|
+
}
|
|
13144
|
+
const next = elem[pos + len] === "," ? pos + len + 1 : pos + len;
|
|
13145
|
+
const word = elem.slice(pos, pos + len);
|
|
13146
|
+
pos = next;
|
|
13147
|
+
if (!word) continue;
|
|
13148
|
+
if (word.startsWith("prefix:")) {
|
|
13149
|
+
if (!/^-?\d+$/.test(word.slice(7))) throw new PlumbingError("fatal: invalid parameter for pathspec magic 'prefix'");
|
|
13150
|
+
continue;
|
|
13151
|
+
}
|
|
13152
|
+
if (word.startsWith("attr:")) {
|
|
13153
|
+
magic.add("attr");
|
|
13154
|
+
continue;
|
|
13155
|
+
}
|
|
13156
|
+
if (!MAGIC$2.some((m) => m.name === word)) throw new PlumbingError(`fatal: Invalid pathspec magic '${word}' in '${elem}'`);
|
|
13157
|
+
magic.add(word);
|
|
13158
|
+
}
|
|
13159
|
+
if (elem[pos] !== ")") throw new PlumbingError(`fatal: Missing ')' at the end of pathspec magic in '${elem}'`);
|
|
13160
|
+
return {
|
|
13161
|
+
magic,
|
|
13162
|
+
rest: elem.slice(pos + 1)
|
|
13163
|
+
};
|
|
13164
|
+
}
|
|
13165
|
+
let pos = 1;
|
|
13166
|
+
for (; pos < elem.length && elem[pos] !== ":"; pos++) {
|
|
13167
|
+
const ch = elem[pos];
|
|
13168
|
+
if (ch === "^") {
|
|
13169
|
+
magic.add("exclude");
|
|
13170
|
+
continue;
|
|
13171
|
+
}
|
|
13172
|
+
if (!SHORT_MAGIC$1.has(ch)) break;
|
|
13173
|
+
const m = MAGIC$2.find((x) => x.mnemonic === ch);
|
|
13174
|
+
if (!m) throw new PlumbingError(`fatal: Unimplemented pathspec magic '${ch}' in '${elem}'`);
|
|
13175
|
+
magic.add(m.name);
|
|
13176
|
+
}
|
|
13177
|
+
if (elem[pos] === ":") pos++;
|
|
13178
|
+
return {
|
|
13179
|
+
magic,
|
|
13180
|
+
rest: elem.slice(pos)
|
|
13181
|
+
};
|
|
13182
|
+
}
|
|
13183
|
+
//#endregion
|
|
13184
|
+
//#region src/commands/check-ignore-command.ts
|
|
13185
|
+
/**
|
|
13186
|
+
* `git check-ignore` (builtin/check-ignore.c): which paths the ignore rules exclude, and with
|
|
13187
|
+
* `-v` the pattern that decides (`<source>:<line>:<pattern>\t<path>`).
|
|
13188
|
+
*
|
|
13189
|
+
* @example
|
|
13190
|
+
* ```typescript
|
|
13191
|
+
* // git check-ignore -v build/out.o
|
|
13192
|
+
* await git.checkIgnore().setVerbose(true).addPath("build/out.o").call();
|
|
13193
|
+
* // { exitCode: 0, stdout: ".gitignore:1:build/\tbuild/out.o\n", stderr: "" }
|
|
13194
|
+
* ```
|
|
13195
|
+
*/
|
|
13196
|
+
const S_IFMT$6 = 61440;
|
|
13197
|
+
const S_IFLNK$1 = 40960;
|
|
13198
|
+
const S_IFGITLINK$3 = 57344;
|
|
13199
|
+
const S_IFDIR$4 = 16384;
|
|
13200
|
+
/**
|
|
13201
|
+
* `git check-ignore [-q] [-v [-n]] [--no-index] (<pathname>... | --stdin [-z])`: each path the
|
|
13202
|
+
* ignore rules exclude is printed (as given, C-quoted as `core.quotePath` asks); with `-v`
|
|
13203
|
+
* the deciding pattern before it, negated patterns too, and with `-n` the paths no pattern
|
|
13204
|
+
* matches (`::\t<path>`). A path the index holds (or a directory holding one) is never
|
|
13205
|
+
* checked, unless `--no-index`. Exit status 0 when a path was printed with a pattern, 1 when
|
|
13206
|
+
* none, 128 for git's deaths (its argument errors, a path beyond a symbolic link or inside a
|
|
13207
|
+
* submodule, a bare repository). Paths are read against {@link setCurrentDirectory}.
|
|
13208
|
+
*/
|
|
13209
|
+
var CheckIgnoreCommand = class extends GitCommand {
|
|
13210
|
+
paths = [];
|
|
13211
|
+
stdin;
|
|
13212
|
+
nul = false;
|
|
13213
|
+
quiet = false;
|
|
13214
|
+
verbose = false;
|
|
13215
|
+
nonMatching = false;
|
|
13216
|
+
noIndex = false;
|
|
13217
|
+
prefix = "";
|
|
13218
|
+
/** A path to check. */
|
|
13219
|
+
addPath(path) {
|
|
13220
|
+
this.checkCallable();
|
|
13221
|
+
this.paths.push(path);
|
|
13222
|
+
return this;
|
|
13223
|
+
}
|
|
13224
|
+
/** `--stdin`: the paths of this input (git's stdin). */
|
|
13225
|
+
setStdin(input) {
|
|
13226
|
+
this.checkCallable();
|
|
13227
|
+
this.stdin = typeof input === "string" ? new TextEncoder().encode(input) : input;
|
|
13228
|
+
return this;
|
|
13229
|
+
}
|
|
13230
|
+
/** `-z`: NUL-terminated input and output records. */
|
|
13231
|
+
setNulTerminated(nul) {
|
|
13232
|
+
this.checkCallable();
|
|
13233
|
+
this.nul = nul;
|
|
13234
|
+
return this;
|
|
13235
|
+
}
|
|
13236
|
+
/** `-q`: print nothing, only the exit status. */
|
|
13237
|
+
setQuiet(quiet) {
|
|
13238
|
+
this.checkCallable();
|
|
13239
|
+
this.quiet = quiet;
|
|
13240
|
+
return this;
|
|
13241
|
+
}
|
|
13242
|
+
/** `-v`: the deciding pattern too. */
|
|
13243
|
+
setVerbose(verbose) {
|
|
13244
|
+
this.checkCallable();
|
|
13245
|
+
this.verbose = verbose;
|
|
13246
|
+
return this;
|
|
13247
|
+
}
|
|
13248
|
+
/** `-n` (with `-v`): the paths no pattern matches too. */
|
|
13249
|
+
setNonMatching(nonMatching) {
|
|
13250
|
+
this.checkCallable();
|
|
13251
|
+
this.nonMatching = nonMatching;
|
|
13252
|
+
return this;
|
|
13253
|
+
}
|
|
13254
|
+
/** `--no-index`: paths the index holds are checked too. */
|
|
13255
|
+
setNoIndex(noIndex) {
|
|
13256
|
+
this.checkCallable();
|
|
13257
|
+
this.noIndex = noIndex;
|
|
13258
|
+
return this;
|
|
13259
|
+
}
|
|
13260
|
+
/** The directory git runs in, from the top of the worktree (paths are relative to it). */
|
|
13261
|
+
setCurrentDirectory(dir) {
|
|
13262
|
+
this.checkCallable();
|
|
13263
|
+
this.prefix = directoryPrefix(dir);
|
|
13264
|
+
return this;
|
|
13265
|
+
}
|
|
13266
|
+
async call() {
|
|
13267
|
+
this.checkCallable();
|
|
13268
|
+
this.setCallable(false);
|
|
13269
|
+
let stdout = "";
|
|
13270
|
+
const stderr = "";
|
|
13271
|
+
const die = (message, exitCode = 128) => ({
|
|
13272
|
+
exitCode,
|
|
13273
|
+
stdout,
|
|
13274
|
+
stderr: `${stderr}fatal: ${message}\n`
|
|
13275
|
+
});
|
|
13276
|
+
if (this.stdin !== void 0) {
|
|
13277
|
+
if (this.paths.length > 0) return die("cannot specify pathnames with --stdin");
|
|
13278
|
+
} else {
|
|
13279
|
+
if (this.nul) return die("-z only makes sense with --stdin");
|
|
13280
|
+
if (this.paths.length === 0) return die("no path specified");
|
|
13281
|
+
}
|
|
13282
|
+
if (this.quiet) {
|
|
13283
|
+
if (this.paths.length > 1) return die("--quiet is only valid with a single pathname");
|
|
13284
|
+
if (this.verbose) return die("cannot have both --quiet and --verbose");
|
|
13285
|
+
}
|
|
13286
|
+
if (this.nonMatching && !this.verbose) return die("--non-matching is only valid with --verbose");
|
|
13287
|
+
const worktree = "worktree" in this._workingCopy ? this._workingCopy.worktree : void 0;
|
|
13288
|
+
if (!worktree?.ignoreMatch) return die("this operation must be run in a work tree");
|
|
13289
|
+
const staging = this.noIndex ? void 0 : this._workingCopy.checkout?.staging;
|
|
13290
|
+
const index = staging ? await this.indexEntries() : [];
|
|
13291
|
+
const quoteFully = configBool$1(this._workingCopy, "core.quotePath", true);
|
|
13292
|
+
const sources = await this.sourceNames();
|
|
13293
|
+
let ignored = 0;
|
|
13294
|
+
const top = await worktreeHostPath(this._workingCopy);
|
|
13295
|
+
const EMPTY = "empty string is not a valid pathspec. please use . instead if you meant to match all paths";
|
|
13296
|
+
/**
|
|
13297
|
+
* parse_pathspec of one element with check-ignore's mask (every magic but `:/`
|
|
13298
|
+
* refused), PATHSPEC_SYMLINK_LEADING_PATH, then die_path_inside_submodule: the path
|
|
13299
|
+
* from the top, or git's death.
|
|
13300
|
+
*/
|
|
13301
|
+
const parse = async (original) => {
|
|
13302
|
+
if (original === "") return { death: EMPTY };
|
|
13303
|
+
let parsed;
|
|
13304
|
+
try {
|
|
13305
|
+
parsed = parseElementMagic(original);
|
|
13306
|
+
} catch (error) {
|
|
13307
|
+
if (error instanceof PlumbingError) return { death: error.message.replace(/^fatal: /, "") };
|
|
13308
|
+
throw error;
|
|
13309
|
+
}
|
|
13310
|
+
const { magic, rest } = parsed;
|
|
13311
|
+
if (magic.has("literal") && magic.has("glob")) return { death: `${original}: 'literal' and 'glob' are incompatible` };
|
|
13312
|
+
const full = prefixPath(magic.has("top") ? "" : this.prefix, rest, top);
|
|
13313
|
+
if (full === void 0) return { death: `${original}: '${rest}' is outside repository at '${top ?? ""}'` };
|
|
13314
|
+
const unsupported = unsupportedPathspecMagic(original, magic, ["top"]);
|
|
13315
|
+
if (unsupported) return { death: unsupported };
|
|
13316
|
+
const parts = full.replace(/\/+$/, "").split("/");
|
|
13317
|
+
for (let k = 1; k < parts.length; k++) {
|
|
13318
|
+
const entry = await worktree.getEntry(parts.slice(0, k).join("/")).catch(() => void 0);
|
|
13319
|
+
if (entry && (entry.mode & S_IFMT$6) === S_IFLNK$1) return { death: `pathspec '${original}' is beyond a symbolic link` };
|
|
13320
|
+
}
|
|
13321
|
+
return { path: full };
|
|
13322
|
+
};
|
|
13323
|
+
const insideSubmodule = (original, full) => {
|
|
13324
|
+
if (!staging) return void 0;
|
|
13325
|
+
const path = full.replace(/\/+$/, "");
|
|
13326
|
+
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}'`;
|
|
13327
|
+
};
|
|
13328
|
+
const checkOne = async (original, full) => {
|
|
13329
|
+
const path = full.replace(/\/+$/, "");
|
|
13330
|
+
let match;
|
|
13331
|
+
if (!staging || !this.seenInIndex(full, index)) {
|
|
13332
|
+
match = await worktree.ignoreMatch?.(path);
|
|
13333
|
+
if (!this.verbose && match?.negated) match = void 0;
|
|
13334
|
+
}
|
|
13335
|
+
if (!this.quiet && (match || this.nonMatching)) stdout += this.line(original, match, sources, quoteFully);
|
|
13336
|
+
if (match) ignored++;
|
|
13337
|
+
};
|
|
13338
|
+
/** check_ignore of the paths of one call: every element parsed before any output. */
|
|
13339
|
+
const checkAll = async (originals) => {
|
|
13340
|
+
if (originals.includes("")) return EMPTY;
|
|
13341
|
+
const paths = [];
|
|
13342
|
+
for (const original of originals) {
|
|
13343
|
+
const parsed = await parse(original);
|
|
13344
|
+
if ("death" in parsed) return parsed.death;
|
|
13345
|
+
paths.push(parsed.path);
|
|
13346
|
+
}
|
|
13347
|
+
for (let i = 0; i < originals.length; i++) {
|
|
13348
|
+
const death = insideSubmodule(originals[i], paths[i]);
|
|
13349
|
+
if (death) return death;
|
|
13350
|
+
}
|
|
13351
|
+
for (let i = 0; i < originals.length; i++) await checkOne(originals[i], paths[i]);
|
|
13352
|
+
};
|
|
13353
|
+
const run = async () => {
|
|
13354
|
+
if (this.stdin === void 0) {
|
|
13355
|
+
const death = await checkAll(this.paths);
|
|
13356
|
+
if (death) return die(death);
|
|
13357
|
+
} else {
|
|
13358
|
+
const { records, badlyQuoted } = inputRecords(this.stdin, this.nul);
|
|
13359
|
+
for (const path of records) {
|
|
13360
|
+
const death = await checkAll([path]);
|
|
13361
|
+
if (death) return die(death);
|
|
13362
|
+
}
|
|
13363
|
+
if (badlyQuoted) return die("line is badly quoted");
|
|
13364
|
+
}
|
|
13365
|
+
return {
|
|
13366
|
+
exitCode: ignored ? 0 : 1,
|
|
13367
|
+
stdout,
|
|
13368
|
+
stderr
|
|
13369
|
+
};
|
|
13370
|
+
};
|
|
13371
|
+
return worktree.batch ? worktree.batch(run) : run();
|
|
13372
|
+
}
|
|
13373
|
+
/** One output record (`output_pattern`). */
|
|
13374
|
+
line(path, match, sources, quoteFully) {
|
|
13375
|
+
let source = "";
|
|
13376
|
+
if (match) {
|
|
13377
|
+
const s = match.source;
|
|
13378
|
+
source = s.kind === "directory" ? `${s.directory ? `${s.directory}/` : ""}.gitignore` : s.kind === "exclude" && s.name === "info/exclude" ? sources.info : s.kind === "exclude" && s.name === "core.excludesFile" ? sources.excludes ?? "" : "";
|
|
13379
|
+
}
|
|
13380
|
+
if (this.nul) {
|
|
13381
|
+
if (!this.verbose) return `${path}\0`;
|
|
13382
|
+
return match ? `${source}\0${match.line}\0${match.pattern}\0${path}\0` : `\0\0\0${path}\0`;
|
|
13383
|
+
}
|
|
13384
|
+
if (!this.verbose) return `${quotePath(path, quoteFully)}\n`;
|
|
13385
|
+
return `${match ? `${quotePath(source, quoteFully)}:${match.line}:${match.pattern}\t` : ":: "}${quotePath(path, quoteFully)}\n`;
|
|
13386
|
+
}
|
|
13387
|
+
/** The index's entries git asks (`PS_HEED_SKIP_WORKTREE`: skip-worktree ones left out). */
|
|
13388
|
+
async indexEntries() {
|
|
13389
|
+
const staging = this._workingCopy.checkout.staging;
|
|
13390
|
+
const out = [];
|
|
13391
|
+
for await (const e of staging.entries()) if (!e.skipWorktree) out.push({
|
|
13392
|
+
path: e.path,
|
|
13393
|
+
mode: e.mode
|
|
13394
|
+
});
|
|
13395
|
+
return out;
|
|
13396
|
+
}
|
|
13397
|
+
/** `find_pathspecs_matching_against_index`: whether the element names an index entry. */
|
|
13398
|
+
seenInIndex(full, index) {
|
|
13399
|
+
let item;
|
|
13400
|
+
try {
|
|
13401
|
+
item = parsePathspecItem(full === "" ? "." : full);
|
|
13402
|
+
} catch {
|
|
13403
|
+
return false;
|
|
13404
|
+
}
|
|
13405
|
+
for (const e of index) {
|
|
13406
|
+
const dir = (e.mode & S_IFMT$6) === S_IFGITLINK$3 || (e.mode & S_IFMT$6) === S_IFDIR$4;
|
|
13407
|
+
if (matchPathspec([item], e.path, dir ? 1 : 0)) return true;
|
|
13408
|
+
}
|
|
13409
|
+
return false;
|
|
13410
|
+
}
|
|
13411
|
+
/** How git names the exclude files in `-v` lines. */
|
|
13412
|
+
async sourceNames() {
|
|
13413
|
+
const environment = hostEnvironmentOf(this._workingCopy);
|
|
13414
|
+
const configured = configValue(this._workingCopy, "core.excludesFile");
|
|
13415
|
+
const excludes = typeof configured === "string" && configured !== "" ? expandUserPath(configured, environment) : xdgConfigPath(environment, "ignore");
|
|
13416
|
+
const gitDir = this._workingCopy.config?.hostGitDir;
|
|
13417
|
+
const top = await worktreeHostPath(this._workingCopy);
|
|
13418
|
+
const trimmed = gitDir?.replace(/\/+$/, "");
|
|
13419
|
+
return {
|
|
13420
|
+
info: trimmed === void 0 || top !== void 0 && trimmed === `${top.replace(/\/+$/, "")}/.git` ? ".git/info/exclude" : `${trimmed}/info/exclude`,
|
|
13421
|
+
excludes
|
|
13422
|
+
};
|
|
13423
|
+
}
|
|
13424
|
+
};
|
|
13425
|
+
//#endregion
|
|
13426
|
+
//#region src/commands/check-mailmap-command.ts
|
|
13427
|
+
/**
|
|
13428
|
+
* `git check-mailmap` (builtin/check-mailmap.c): each contact as the repository's mailmap
|
|
13429
|
+
* maps it (`.mailmap`, `mailmap.blob`, `mailmap.file`, plus `--mailmap-blob` and
|
|
13430
|
+
* `--mailmap-file`).
|
|
13431
|
+
*
|
|
13432
|
+
* @example
|
|
13433
|
+
* ```typescript
|
|
13434
|
+
* // git check-mailmap "nick1 <bugs@company.xx>"
|
|
13435
|
+
* await git.checkMailmap().addContact("nick1 <bugs@company.xx>").call();
|
|
13436
|
+
* // "Some Dude <some@dude.xx>\n"
|
|
13437
|
+
* ```
|
|
13438
|
+
*/
|
|
13439
|
+
/**
|
|
13440
|
+
* The contacts of `git check-mailmap <contact>...` (and `--stdin`'s lines after them), one
|
|
13441
|
+
* output line each: `Name <email>`, or `<email>` when the result has no name.
|
|
13442
|
+
*
|
|
13443
|
+
* git 2.43 (`setCompatibility("2.43")`) takes only `Name <email>` contacts (`fatal: unable
|
|
13444
|
+
* to parse contact: <contact>`) and has no `--mailmap-file`/`--mailmap-blob`; 2.47 and later
|
|
13445
|
+
* also map a bare address. Where git dies, the error carries what was printed before
|
|
13446
|
+
* ({@link getOutput}).
|
|
13447
|
+
*/
|
|
13448
|
+
var CheckMailmapCommand = class extends GitCommand {
|
|
13449
|
+
contacts = [];
|
|
13450
|
+
stdin;
|
|
13451
|
+
mailmapFile;
|
|
13452
|
+
mailmapBlob;
|
|
13453
|
+
compatibility = "2.56";
|
|
13454
|
+
output = "";
|
|
13455
|
+
errors = [];
|
|
13456
|
+
/** A contact argument. */
|
|
13457
|
+
addContact(contact) {
|
|
13458
|
+
this.checkCallable();
|
|
13459
|
+
this.contacts.push(contact);
|
|
13460
|
+
return this;
|
|
13461
|
+
}
|
|
13462
|
+
/** `--stdin`: these lines (git's stdin) checked after the arguments. */
|
|
13463
|
+
setStdin(text) {
|
|
13464
|
+
this.checkCallable();
|
|
13465
|
+
this.stdin = text;
|
|
13466
|
+
return this;
|
|
13467
|
+
}
|
|
13468
|
+
/** `--mailmap-file=<file>` (git 2.47+): more entries from this host file. */
|
|
13469
|
+
setMailmapFile(path) {
|
|
13470
|
+
this.checkCallable();
|
|
13471
|
+
this.mailmapFile = path;
|
|
13472
|
+
return this;
|
|
13473
|
+
}
|
|
13474
|
+
/** `--mailmap-blob=<blob>` (git 2.47+): more entries from this blob. */
|
|
13475
|
+
setMailmapBlob(name) {
|
|
13476
|
+
this.checkCallable();
|
|
13477
|
+
this.mailmapBlob = name;
|
|
13478
|
+
return this;
|
|
13479
|
+
}
|
|
13480
|
+
/** The git version whose behaviour to follow (default 2.56). */
|
|
13481
|
+
setCompatibility(version) {
|
|
13482
|
+
this.checkCallable();
|
|
13483
|
+
this.compatibility = version;
|
|
13484
|
+
return this;
|
|
13485
|
+
}
|
|
13486
|
+
/** What was printed on stdout (also after a death). */
|
|
13487
|
+
getOutput() {
|
|
13488
|
+
return this.output;
|
|
13489
|
+
}
|
|
13490
|
+
/** git's `error:` lines (a mailmap blob that is no blob). */
|
|
13491
|
+
getErrors() {
|
|
13492
|
+
return [...this.errors];
|
|
13493
|
+
}
|
|
13494
|
+
/** The output. */
|
|
13495
|
+
async call() {
|
|
13496
|
+
this.checkCallable();
|
|
13497
|
+
this.setCallable(false);
|
|
13498
|
+
const legacy = this.compatibility === "2.43";
|
|
13499
|
+
if (legacy && (this.mailmapFile !== void 0 || this.mailmapBlob !== void 0)) {
|
|
13500
|
+
const option = this.mailmapFile !== void 0 ? "mailmap-file" : "mailmap-blob";
|
|
13501
|
+
throw new GitApiError(`error: unknown option \`${option}'\nusage: git check-mailmap [<options>] <contact>...`);
|
|
13502
|
+
}
|
|
13503
|
+
if (this.contacts.length === 0 && this.stdin === void 0) throw new GitApiError("fatal: no contacts specified");
|
|
13504
|
+
const onError = (line) => this.errors.push(line);
|
|
13505
|
+
const mailmap = await this.readMailmap(onError);
|
|
13506
|
+
if (this.mailmapBlob !== void 0) {
|
|
13507
|
+
const bytes = await readMailmapBlob({
|
|
13508
|
+
readObjectNamed: (name) => this.readObjectNamed(name),
|
|
13509
|
+
onError
|
|
13510
|
+
}, this.mailmapBlob);
|
|
13511
|
+
if (bytes) mailmap.read(decodeGitPath(bytes));
|
|
13512
|
+
}
|
|
13513
|
+
if (this.mailmapFile !== void 0) {
|
|
13514
|
+
const bytes = await readMailmapFile(this.mailmapFile, hostEnvironmentOf(this._workingCopy), this.worktreeAccess);
|
|
13515
|
+
if (bytes) mailmap.read(decodeGitPath(bytes));
|
|
13516
|
+
}
|
|
13517
|
+
for (const contact of this.contacts) this.check(mailmap, contact, legacy);
|
|
13518
|
+
if (this.stdin !== void 0) for (const line of inputLines$2(this.stdin)) this.check(mailmap, line, legacy);
|
|
13519
|
+
return this.output;
|
|
13520
|
+
}
|
|
13521
|
+
check(mailmap, contact, legacy) {
|
|
13522
|
+
let ident = splitIdent(contact);
|
|
13523
|
+
if (!ident) {
|
|
13524
|
+
if (legacy) throw new GitApiError(`fatal: unable to parse contact: ${contact}`);
|
|
13525
|
+
ident = {
|
|
13526
|
+
name: "",
|
|
13527
|
+
email: contact
|
|
13528
|
+
};
|
|
13529
|
+
}
|
|
13530
|
+
const mapped = mailmap.map(ident.name, ident.email);
|
|
13531
|
+
this.output += `${mapped.name ? `${mapped.name} ` : ""}<${mapped.email}>\n`;
|
|
13532
|
+
}
|
|
13533
|
+
};
|
|
13534
|
+
//#endregion
|
|
13535
|
+
//#region src/commands/check-ref-format-command.ts
|
|
13536
|
+
/**
|
|
13537
|
+
* `git check-ref-format` (builtin/check-ref-format.c): whether a name is a valid ref name,
|
|
12941
13538
|
* refs.c's `check_refname_format`, and `--branch`'s branch name as `check_branch_ref` reads it.
|
|
12942
13539
|
*
|
|
12943
13540
|
* @example
|
|
@@ -14566,7 +15163,7 @@ var CommitCommand = class extends GitCommand {
|
|
|
14566
15163
|
await state.write("COMMIT_EDITMSG", template);
|
|
14567
15164
|
template = await this.withTrailers(template, state, comment);
|
|
14568
15165
|
const isMerge = (ctx.previousCommit?.parents.length ?? 0) > 1;
|
|
14569
|
-
if (!committable && whence !== "merge" && !this.allowEmpty && !(this.amend && isMerge)) throw
|
|
15166
|
+
if (!committable && whence !== "merge" && !this.allowEmpty && !(this.amend && isMerge)) throw await this.emptyCommitError(ctx.partialTree, whence);
|
|
14570
15167
|
let text = "";
|
|
14571
15168
|
let edited;
|
|
14572
15169
|
const hookArgs = this.prepareMessageHookArgs(mergeMsg, squashMsg, fromTemplate ? templateText : void 0, ctx.mergeHeads, ctx.pickHead);
|
|
@@ -15294,7 +15891,7 @@ var CommitCommand = class extends GitCommand {
|
|
|
15294
15891
|
sb = this.signedOff(sb, committer);
|
|
15295
15892
|
await state.write("COMMIT_EDITMSG", sb);
|
|
15296
15893
|
sb = await this.withTrailers(sb, state, void 0);
|
|
15297
|
-
await this.refuseNothingToCommit(treeId, parents, mergeHeads, previousCommit);
|
|
15894
|
+
await this.refuseNothingToCommit(treeId, parents, mergeHeads, previousCommit, partialTree);
|
|
15298
15895
|
const hookArgs = this.hooks.enabled ? this.prepareMessageHookArgs(await state.read("MERGE_MSG"), await state.read("SQUASH_MSG"), void 0, mergeHeads, pickHead) : [];
|
|
15299
15896
|
let text = sb;
|
|
15300
15897
|
if (await this.runMessageHooks(hookEnv, hookArgs, void 0)) text = await state.read("COMMIT_EDITMSG") ?? "";
|
|
@@ -15329,15 +15926,36 @@ var CommitCommand = class extends GitCommand {
|
|
|
15329
15926
|
* parent's (HEAD's, HEAD^1's when amending), or empty without a first parent, unless a merge is concluded, empty commits are
|
|
15330
15927
|
* allowed, or a merge commit is amended.
|
|
15331
15928
|
*/
|
|
15332
|
-
async refuseNothingToCommit(treeId, parents, mergeHeads, previousCommit) {
|
|
15929
|
+
async refuseNothingToCommit(treeId, parents, mergeHeads, previousCommit, partialTree) {
|
|
15333
15930
|
if (this.allowEmpty || mergeHeads.length > 0) return;
|
|
15334
15931
|
if (parents.length === 0) {
|
|
15335
|
-
if (treeId === this.objectFormat.emptyTreeId) throw
|
|
15932
|
+
if (treeId === this.objectFormat.emptyTreeId) throw await this.emptyCommitError(partialTree);
|
|
15336
15933
|
return;
|
|
15337
15934
|
}
|
|
15338
15935
|
if (this.amend && (previousCommit?.parents.length ?? 0) > 1) return;
|
|
15339
15936
|
const parentCommit = await this.commits.load(parents[0]);
|
|
15340
|
-
if (parentCommit && parentCommit.tree === treeId) throw
|
|
15937
|
+
if (parentCommit && parentCommit.tree === treeId) throw await this.emptyCommitError(partialTree);
|
|
15938
|
+
}
|
|
15939
|
+
/**
|
|
15940
|
+
* prepare_to_commit's refusal of an empty commit: run_status on stdout (the status of the
|
|
15941
|
+
* index the commit would record, against HEAD^1 when amending: `git commit --dry-run`'s
|
|
15942
|
+
* text), then `empty_amend_advice` on stderr when amending; exit status 1, nothing written.
|
|
15943
|
+
*/
|
|
15944
|
+
async emptyCommitError(partialTree, whence) {
|
|
15945
|
+
const run = () => this.commitStatus({
|
|
15946
|
+
format: "long",
|
|
15947
|
+
...this.showBranch !== void 0 ? { branch: this.showBranch } : {},
|
|
15948
|
+
...this.aheadBehind !== void 0 ? { aheadBehind: this.aheadBehind } : {},
|
|
15949
|
+
verbose: this.verboseLevel(),
|
|
15950
|
+
commitTemplate: true,
|
|
15951
|
+
amend: this.amend,
|
|
15952
|
+
...whence ? { whence } : {}
|
|
15953
|
+
});
|
|
15954
|
+
const status = partialTree ? await this.withIndexOfTree(partialTree, run) : await run();
|
|
15955
|
+
return new EmptyCommitError(void 0, {
|
|
15956
|
+
stdout: status.text,
|
|
15957
|
+
stderr: this.amend ? EMPTY_AMEND_ADVICE : ""
|
|
15958
|
+
});
|
|
15341
15959
|
}
|
|
15342
15960
|
/** The commit of `treeId` made, HEAD moved to it, and what was in progress ended. */
|
|
15343
15961
|
async finishCommit(treeId, parents, mergeHeads, pickHead, info) {
|
|
@@ -15445,12 +16063,18 @@ var CommitCommand = class extends GitCommand {
|
|
|
15445
16063
|
if (!this.noVerify) ran = await this.runCommitHook("commit-msg", env, [file]) || ran;
|
|
15446
16064
|
return ran;
|
|
15447
16065
|
}
|
|
15448
|
-
/**
|
|
16066
|
+
/**
|
|
16067
|
+
* The commits MERGE_HEAD names (one per line, a merged tag peeled as git's
|
|
16068
|
+
* `lookup_commit_reference`), none without a merge in progress.
|
|
16069
|
+
*/
|
|
15449
16070
|
async mergeHeads(state) {
|
|
15450
16071
|
const text = await state.read("MERGE_HEAD");
|
|
15451
|
-
if (text !== void 0)
|
|
16072
|
+
if (text !== void 0) {
|
|
16073
|
+
const ids = text.split("\n").map((l) => l.trim()).filter((l) => /^[0-9a-f]{40,64}$/.test(l));
|
|
16074
|
+
return peelMergeHeads(this.revisionResolver(), ids);
|
|
16075
|
+
}
|
|
15452
16076
|
const id = await state.ref("MERGE_HEAD");
|
|
15453
|
-
return id ? [id] : [];
|
|
16077
|
+
return id ? peelMergeHeads(this.revisionResolver(), [id]) : [];
|
|
15454
16078
|
}
|
|
15455
16079
|
/** The heads none of the others reaches (git's reduce_heads), in their order. */
|
|
15456
16080
|
async reduceHeads(heads) {
|
|
@@ -17465,6 +18089,11 @@ const UNMERGED_FILES_MESSAGE = (action) => [
|
|
|
17465
18089
|
*/
|
|
17466
18090
|
var MergeCommand = class extends GitCommand {
|
|
17467
18091
|
includes = [];
|
|
18092
|
+
/**
|
|
18093
|
+
* The object each merged commit was named by (git's `merge_remote_desc.obj`, the first
|
|
18094
|
+
* name's): an annotated tag's own id, which `write_merge_heads` puts in MERGE_HEAD.
|
|
18095
|
+
*/
|
|
18096
|
+
mergeObjects = /* @__PURE__ */ new Map();
|
|
17468
18097
|
fastForwardMode = "ff";
|
|
17469
18098
|
strategy = "recursive";
|
|
17470
18099
|
/** Whether `-s` was given (`-s recursive` names itself in git's messages) */
|
|
@@ -18487,7 +19116,7 @@ var MergeCommand = class extends GitCommand {
|
|
|
18487
19116
|
return giveUp([refused.message], stop ? output.slice(0, stop.output) : output);
|
|
18488
19117
|
}
|
|
18489
19118
|
const writeState = async (text) => {
|
|
18490
|
-
await state.write("MERGE_HEAD", remoteIds.map((id) => `${id}\n`).join(""));
|
|
19119
|
+
await state.write("MERGE_HEAD", remoteIds.map((id) => `${this.mergeObjectOf(id)}\n`).join(""));
|
|
18491
19120
|
await state.write("MERGE_MSG", text);
|
|
18492
19121
|
await state.write("MERGE_MODE", this.ffMode() === "no-ff" ? "no-ff" : "");
|
|
18493
19122
|
};
|
|
@@ -18558,12 +19187,21 @@ var MergeCommand = class extends GitCommand {
|
|
|
18558
19187
|
output
|
|
18559
19188
|
};
|
|
18560
19189
|
}
|
|
18561
|
-
/**
|
|
19190
|
+
/**
|
|
19191
|
+
* The commits MERGE_HEAD names (one per line: several for an octopus), each peeled as
|
|
19192
|
+
* git's `read_merge_heads` → `lookup_commit_reference` (a merged tag is named by its own id).
|
|
19193
|
+
*/
|
|
18562
19194
|
async mergeHeads(state) {
|
|
18563
|
-
|
|
18564
|
-
if (lines.length
|
|
18565
|
-
|
|
18566
|
-
|
|
19195
|
+
let lines = (await state.read("MERGE_HEAD") ?? "").split("\n").filter((l) => /^[0-9a-f]{40,64}$/.test(l));
|
|
19196
|
+
if (lines.length === 0) {
|
|
19197
|
+
const single = await state.ref("MERGE_HEAD");
|
|
19198
|
+
lines = single ? [single] : [];
|
|
19199
|
+
}
|
|
19200
|
+
return peelMergeHeads(this.revisionResolver(), lines);
|
|
19201
|
+
}
|
|
19202
|
+
/** The object a merged commit was named by (the commit itself unless a tag named it). */
|
|
19203
|
+
mergeObjectOf(commitId) {
|
|
19204
|
+
return this.mergeObjects.get(commitId) ?? commitId;
|
|
18567
19205
|
}
|
|
18568
19206
|
/** `git merge --continue`: commits the resolved merge with MERGE_MSG. */
|
|
18569
19207
|
async continueMerge(state) {
|
|
@@ -18900,7 +19538,7 @@ var MergeCommand = class extends GitCommand {
|
|
|
18900
19538
|
}
|
|
18901
19539
|
/** MERGE_HEAD, MERGE_MSG and MERGE_MODE of a merge stopped before its commit. */
|
|
18902
19540
|
async writeMergeState(state, srcId, message) {
|
|
18903
|
-
await state.setRef("MERGE_HEAD", srcId);
|
|
19541
|
+
await state.setRef("MERGE_HEAD", this.mergeObjectOf(srcId));
|
|
18904
19542
|
await state.write("MERGE_MSG", message);
|
|
18905
19543
|
await state.write("MERGE_MODE", this.ffMode() === "no-ff" ? "no-ff" : "");
|
|
18906
19544
|
}
|
|
@@ -18991,7 +19629,12 @@ var MergeCommand = class extends GitCommand {
|
|
|
18991
19629
|
*/
|
|
18992
19630
|
async mergeHeadOf(name) {
|
|
18993
19631
|
try {
|
|
18994
|
-
|
|
19632
|
+
const commitId = await this.resolveRef(name);
|
|
19633
|
+
if (!this.mergeObjects.has(commitId)) {
|
|
19634
|
+
const objectId = await this.resolveRevision(name, { hint: "committish" });
|
|
19635
|
+
this.mergeObjects.set(commitId, objectId);
|
|
19636
|
+
}
|
|
19637
|
+
return commitId;
|
|
18995
19638
|
} catch (error) {
|
|
18996
19639
|
if (!(error instanceof NotACommitError)) throw error;
|
|
18997
19640
|
const lines = error.objectType ? [`error: ${name}: expected commit type, but the object dereferences to ${error.objectType} type`] : [];
|
|
@@ -22795,7 +23438,7 @@ const CONE_HELP = " --[no-]cone initialize the sparse-checkout in c
|
|
|
22795
23438
|
const SPARSE_INDEX_HELP = " --[no-]sparse-index toggle the use of a sparse index";
|
|
22796
23439
|
const SKIP_CHECKS_HELP = " --skip-checks skip some sanity checks on the given paths that might give false positives";
|
|
22797
23440
|
/** Each subcommand's usage line and option help, as parse_options prints them. */
|
|
22798
|
-
const USAGE$
|
|
23441
|
+
const USAGE$8 = {
|
|
22799
23442
|
list: {
|
|
22800
23443
|
line: "git sparse-checkout list",
|
|
22801
23444
|
options: []
|
|
@@ -23027,7 +23670,7 @@ var SparseCheckoutCommand = class extends GitCommand {
|
|
|
23027
23670
|
/** parse_options' usage error: `error: <message>`, the usage and option help, exit 129. */
|
|
23028
23671
|
usage(sub, message) {
|
|
23029
23672
|
if (sub === "") return new SparseDie(`error: ${message}\nusage: git sparse-checkout (${`init | list | set | add | reapply | disable | check-rules${this.compatibility === "2.43" ? "" : " | clean"}`}) [<options>]\n\n`, 129, true);
|
|
23030
|
-
const usage = USAGE$
|
|
23673
|
+
const usage = USAGE$8[sub];
|
|
23031
23674
|
const options = usage.options.length > 0 ? `${usage.options.join("\n")}\n\n` : "";
|
|
23032
23675
|
return new SparseDie(`error: ${message}\nusage: ${usage.line}\n\n${options}`, 129, true);
|
|
23033
23676
|
}
|
|
@@ -26508,9 +27151,9 @@ var InitCommand = class {
|
|
|
26508
27151
|
let initialBranch = "";
|
|
26509
27152
|
let hints;
|
|
26510
27153
|
const warnings = [];
|
|
26511
|
-
const chooseBranch = async () => {
|
|
27154
|
+
const chooseBranch = async (config) => {
|
|
26512
27155
|
if (this.initialBranch !== void 0 && !isValidBranchName$1(this.initialBranch)) throw new InvalidInitialBranchError(this.initialBranch);
|
|
26513
|
-
const chosen = this.initialBranch !== void 0 ? { name: this.initialBranch } : await defaultInitialBranch(this.environment);
|
|
27156
|
+
const chosen = this.initialBranch !== void 0 ? { name: this.initialBranch } : await defaultInitialBranch(this.environment, config);
|
|
26514
27157
|
initialBranch = chosen.name;
|
|
26515
27158
|
hints = chosen.hint;
|
|
26516
27159
|
};
|
|
@@ -26554,8 +27197,8 @@ var InitCommand = class {
|
|
|
26554
27197
|
objectFormat = (await readRepositoryFormat(repoFiles, dir)).objectFormat;
|
|
26555
27198
|
if (explicitFormat && explicitFormat.name !== objectFormat.name) throw new ReinitializeHashError();
|
|
26556
27199
|
}
|
|
26557
|
-
if (!hasHead) await chooseBranch();
|
|
26558
|
-
else if (this.initialBranch !== void 0) warnings.push(`warning: re-init: ignored --initial-branch=${this.initialBranch}`);
|
|
27200
|
+
if (!hasHead && this.initialBranch !== void 0) await chooseBranch();
|
|
27201
|
+
else if (hasHead && this.initialBranch !== void 0) warnings.push(`warning: re-init: ignored --initial-branch=${this.initialBranch}`);
|
|
26559
27202
|
const refFormat = fresh ? await defaultRefFormat(this.environment, this.refFormat) : void 0;
|
|
26560
27203
|
if (refFormat) warnings.push(...refFormat.warnings);
|
|
26561
27204
|
warnings.push(...await checkDefaultObjectStorage(this.environment, fresh));
|
|
@@ -26565,6 +27208,10 @@ var InitCommand = class {
|
|
|
26565
27208
|
await this.copyTemplates(sharedFiles, dir, warnings);
|
|
26566
27209
|
shared = this.shared ?? await this.configuredShared(repoFiles, dir);
|
|
26567
27210
|
if (shared) await adjustSharedPerm(repoFiles, dir, shared);
|
|
27211
|
+
if (!hasHead && this.initialBranch === void 0) await chooseBranch(await createWorkingCopyConfig(configFilesApiOf(repoFiles, { readOnly: "init reads the configuration only" }), dir, void 0, {
|
|
27212
|
+
...this.environment ? { environment: this.environment } : {},
|
|
27213
|
+
gitDirPath: await this.hostPath(repoFiles, dir)
|
|
27214
|
+
}));
|
|
26568
27215
|
const configPath = `${dir}/config`;
|
|
26569
27216
|
const configExisted = await isFile(configPath);
|
|
26570
27217
|
const readText = async () => configExisted || await isFile(configPath) ? decodeGitPath$1(await readFile(repoFiles, configPath)) : void 0;
|
|
@@ -34730,6 +35377,7 @@ const CLONE_SETTINGS = [
|
|
|
34730
35377
|
"rejectShallow",
|
|
34731
35378
|
"serverOptions",
|
|
34732
35379
|
"compatibility",
|
|
35380
|
+
"bundleUri",
|
|
34733
35381
|
"cloneAllBranches",
|
|
34734
35382
|
"mirror",
|
|
34735
35383
|
"singleBranch",
|
|
@@ -34853,6 +35501,11 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
34853
35501
|
/** The git version reproduced; default the hooks' */
|
|
34854
35502
|
compatibility;
|
|
34855
35503
|
bundleUri;
|
|
35504
|
+
/**
|
|
35505
|
+
* The hash `--bundle-uri`'s bundles are read in: git 2.43 fetches them before it learns the
|
|
35506
|
+
* remote's hash, in the destination's first one (set on a clone reopened under 2.43)
|
|
35507
|
+
*/
|
|
35508
|
+
bundleObjectFormat;
|
|
34856
35509
|
cloneAllBranches = true;
|
|
34857
35510
|
mirror = false;
|
|
34858
35511
|
singleBranch;
|
|
@@ -34959,11 +35612,19 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
34959
35612
|
* Objects left out are fetched lazily from the remote when read (the checkout fetches the
|
|
34960
35613
|
* blobs it writes in one batch, as git's).
|
|
34961
35614
|
*
|
|
35615
|
+
* `auto` (git 2.54) takes the filter the promisor remotes accepted from the server's
|
|
35616
|
+
* `promisor-remote` capability advertise (none: no filter) and is recorded as `auto`, so
|
|
35617
|
+
* later fetches resolve it again.
|
|
35618
|
+
*
|
|
34962
35619
|
* @param spec The filter spec; `blob:limit=1k` is recorded and sent as `blob:limit=1024`
|
|
34963
35620
|
* @throws ObjectFilterError with git's message for a spec git refuses
|
|
34964
35621
|
*/
|
|
34965
35622
|
setFilter(spec) {
|
|
34966
35623
|
this.checkCallable();
|
|
35624
|
+
if (spec === "auto") {
|
|
35625
|
+
this.filterSpec = spec;
|
|
35626
|
+
return this;
|
|
35627
|
+
}
|
|
34967
35628
|
const filter = parseObjectFilter(spec);
|
|
34968
35629
|
this.filterSpec = filter.choice === "blob:limit" ? `blob:limit=${filter.limit}` : spec;
|
|
34969
35630
|
return this;
|
|
@@ -35426,6 +36087,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35426
36087
|
const self = this;
|
|
35427
36088
|
const other = next;
|
|
35428
36089
|
for (const key of CLONE_SETTINGS) if (key in self) other[key] = self[key];
|
|
36090
|
+
if ((this.compatibility ?? this.hooks.compatibility) === "2.43") other.bundleObjectFormat = this.bundleObjectFormat ?? this.objectFormat;
|
|
35429
36091
|
next.shareHooksOf(this);
|
|
35430
36092
|
const result = await next.call();
|
|
35431
36093
|
this.reopenedListener?.(workingCopy);
|
|
@@ -35455,6 +36117,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35455
36117
|
if (this.alsoFilterSubmodules === true && this.filterSpec === void 0) throw new GitApiError("fatal: the option '--also-filter-submodules' requires '--filter'");
|
|
35456
36118
|
if (this.alsoFilterSubmodules === true && this.recurseSubmodules.length === 0) throw new GitApiError("fatal: the option '--also-filter-submodules' requires '--recurse-submodules'");
|
|
35457
36119
|
const compatibility = this.compatibility ?? this.hooks.compatibility;
|
|
36120
|
+
if (this.filterSpec === "auto" && compatibility === "2.43") throw new ObjectFilterError("invalid filter-spec 'auto'");
|
|
35458
36121
|
if (this.revision !== void 0 && compatibility === "2.43") throw new GitApiError(`error: unknown option \`revision=${this.revision}'`, { exitCode: 129 });
|
|
35459
36122
|
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");
|
|
35460
36123
|
const uri = this.uri;
|
|
@@ -35501,6 +36164,9 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35501
36164
|
else serverOptions.push(value);
|
|
35502
36165
|
}
|
|
35503
36166
|
this.repoUrl = repo;
|
|
36167
|
+
store.setValue(`remote.${this.remoteName}.url`, repo);
|
|
36168
|
+
if (this.tagOption === "no-tags" || this.mirror) store.setValue(`remote.${this.remoteName}.tagOpt`, "--no-tags");
|
|
36169
|
+
await store.save();
|
|
35504
36170
|
const sourceUrl = store.aliasUrl(repo) ?? repo;
|
|
35505
36171
|
const remote = await this.prepareRemote(bundleFile ?? sourceUrl);
|
|
35506
36172
|
if (remote.kind === "bundle" && remote.remote.bundle.header.filter !== void 0) throw new TransportError$1("fatal: cannot clone from filtered bundle");
|
|
@@ -35616,6 +36282,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35616
36282
|
baseDir: await this.hostWorkingDir()
|
|
35617
36283
|
});
|
|
35618
36284
|
const sessionId = clientSessionIdOf(this.workingCopy);
|
|
36285
|
+
resetPromisorAcceptance(this.workingCopy);
|
|
35619
36286
|
const fetchOptions = {
|
|
35620
36287
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
35621
36288
|
...uriProtocolsOption(RemoteConfigStore.from(this.workingCopy).value("fetch.uriprotocols")),
|
|
@@ -35627,6 +36294,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35627
36294
|
repository: createRepositoryFacade({ history: historyWithoutLazyFetch(history) }),
|
|
35628
36295
|
refStore: createTransportRefStore(history.refs),
|
|
35629
36296
|
refspecs,
|
|
36297
|
+
missingRefsOk: true,
|
|
35630
36298
|
tags,
|
|
35631
36299
|
depth,
|
|
35632
36300
|
deepenSince: shallowSince,
|
|
@@ -35640,6 +36308,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35640
36308
|
...this.filterSpec !== void 0 && !isLocal ? { filter: this.filterSpec } : {},
|
|
35641
36309
|
onWarning: (line) => messages.push(`${line}\n`),
|
|
35642
36310
|
promisorRemote: promisorRemoteReplyOf(this.workingCopy, (line) => messages.push(`${line}\n`)),
|
|
36311
|
+
autoFilter: () => promisorAutoFilter(this.workingCopy, (line) => messages.push(`${line}\n`)),
|
|
35643
36312
|
...fsck ? { fsckObjects: fsck } : {},
|
|
35644
36313
|
...serverOptions.length > 0 ? { serverOptions } : {},
|
|
35645
36314
|
...rejectShallow ? { rejectShallow: true } : {},
|
|
@@ -35686,14 +36355,15 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35686
36355
|
if (advertisedDefaultBranch === void 0 && remoteHeadRef?.oid !== void 0) {
|
|
35687
36356
|
const cloned = new Set(result.fetched.map((f) => f.remoteRef));
|
|
35688
36357
|
const branches = result.remoteRefs.filter((r) => r.name.startsWith("refs/heads/") && cloned.has(r.name) && r.oid === remoteHeadRef.oid);
|
|
35689
|
-
const preferred = (await defaultInitialBranch(
|
|
36358
|
+
const preferred = (await this.defaultInitialBranch()).name;
|
|
35690
36359
|
advertisedDefaultBranch = (branches.find((r) => r.name === `refs/heads/${preferred}`) ?? branches.find((r) => r.name === "refs/heads/master") ?? branches[0])?.name;
|
|
35691
36360
|
}
|
|
35692
36361
|
let defaultBranch = branchToClone ?? toBranchName(advertisedDefaultBranch);
|
|
36362
|
+
const unbornHead = remoteHeadRef !== void 0 && remoteHeadRef.oid === void 0 && remoteHeadRef.symref !== void 0;
|
|
35693
36363
|
let headCommit;
|
|
35694
36364
|
let checkedOutBranch;
|
|
35695
36365
|
let checkoutId;
|
|
35696
|
-
if (!detachedTag && !this.bare && defaultBranch === void 0 && result.isEmpty) defaultBranch = await this.localHeadBranch() ?? (await defaultInitialBranch(
|
|
36366
|
+
if (!detachedTag && !this.bare && defaultBranch === void 0 && result.isEmpty) defaultBranch = await this.localHeadBranch() ?? (await this.defaultInitialBranch()).name;
|
|
35697
36367
|
const remoteHead = this.revision === void 0 && advertisedDefaultBranch?.startsWith("refs/heads/") ? toBranchName(advertisedDefaultBranch) : void 0;
|
|
35698
36368
|
const headMapping = remoteHead ? result.fetched.find((f) => f.remoteRef === advertisedDefaultBranch) : void 0;
|
|
35699
36369
|
if (!this.bare && remoteHead && headMapping?.localRef) {
|
|
@@ -35736,7 +36406,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35736
36406
|
headCommit = tip.objectId;
|
|
35737
36407
|
if (!this.noCheckout) checkoutId = tip.objectId;
|
|
35738
36408
|
}
|
|
35739
|
-
if (tip?.objectId || result.isEmpty) checkedOutBranch = defaultBranch;
|
|
36409
|
+
if (tip?.objectId || result.isEmpty || unbornHead) checkedOutBranch = defaultBranch;
|
|
35740
36410
|
} else if (this.bare || this.mirror) {
|
|
35741
36411
|
if (defaultBranch) {
|
|
35742
36412
|
await this.refsStore.setSymbolic("HEAD", `refs/heads/${defaultBranch}`);
|
|
@@ -35750,7 +36420,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35750
36420
|
detachedTag,
|
|
35751
36421
|
remoteHead,
|
|
35752
36422
|
checkedOutBranch,
|
|
35753
|
-
isEmpty: result.isEmpty,
|
|
36423
|
+
isEmpty: result.isEmpty || singleBranch && unbornHead && branchToClone === void 0,
|
|
35754
36424
|
revision: this.revision !== void 0
|
|
35755
36425
|
});
|
|
35756
36426
|
const advertisedRefs = /* @__PURE__ */ new Map();
|
|
@@ -35765,7 +36435,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35765
36435
|
isEmpty: result.isEmpty,
|
|
35766
36436
|
messages: []
|
|
35767
36437
|
},
|
|
35768
|
-
defaultBranch: defaultBranch ?? await this.localHeadBranch() ?? (await defaultInitialBranch(
|
|
36438
|
+
defaultBranch: defaultBranch ?? await this.localHeadBranch() ?? (await this.defaultInitialBranch()).name,
|
|
35769
36439
|
remoteName: this.remoteName,
|
|
35770
36440
|
bare: this.bare,
|
|
35771
36441
|
headCommit,
|
|
@@ -35777,11 +36447,19 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35777
36447
|
}
|
|
35778
36448
|
if (this.dissociate) await history.objects?.alternates?.dissociate?.();
|
|
35779
36449
|
if (checkoutId) {
|
|
36450
|
+
const promisorWarnings = promisorOf(this._workingCopy)?.warnings;
|
|
36451
|
+
const warned = promisorWarnings?.length ?? 0;
|
|
35780
36452
|
try {
|
|
35781
36453
|
const collided = await this.checkoutHead(checkoutId);
|
|
35782
36454
|
if (collided.length > 0) cloneResult.collidedPaths = collided;
|
|
35783
36455
|
} catch (error) {
|
|
35784
36456
|
throw new CloneCheckoutError(cloneResult, error);
|
|
36457
|
+
} finally {
|
|
36458
|
+
const lines = promisorWarnings?.slice(warned) ?? [];
|
|
36459
|
+
if (lines.length > 0) {
|
|
36460
|
+
messages.push(...lines.map((line) => `${line}\n`));
|
|
36461
|
+
if (cloneResult.messages === void 0) cloneResult.messages = messages;
|
|
36462
|
+
}
|
|
35785
36463
|
}
|
|
35786
36464
|
const gitDir = this.hooks.enabled ? await this.hooks.hostGitDir() : void 0;
|
|
35787
36465
|
const code = await runPostCheckoutHook(this.hooks, void 0, checkoutId, true, gitDir ? { GIT_DIR: gitDir } : void 0, void 0, false);
|
|
@@ -35808,6 +36486,7 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
35808
36486
|
remoteUrl,
|
|
35809
36487
|
compatibility,
|
|
35810
36488
|
message,
|
|
36489
|
+
...this.bundleUri !== void 0 && this.bundleObjectFormat ? { objectFormat: this.bundleObjectFormat } : {},
|
|
35811
36490
|
setConfigValue: (key, value) => this.writeConfigValue(key, value, "add"),
|
|
35812
36491
|
tempFileName: () => absolutePathOf(worktree, `${this.bare ? "" : ".git/"}objects/bundles/tmp_uri_${randomSuffix()}`)
|
|
35813
36492
|
});
|
|
@@ -36093,6 +36772,16 @@ var CloneCommand = class CloneCommand extends TransportCommand {
|
|
|
36093
36772
|
await store.save();
|
|
36094
36773
|
if (this.filterSpec !== void 0) promisorOf(this._workingCopy)?.fetcher?.invalidate?.();
|
|
36095
36774
|
}
|
|
36775
|
+
/**
|
|
36776
|
+
* git's `repo_default_branch_name` in the new repository: its whole configuration
|
|
36777
|
+
* (`includeIf "gitdir:"` matching its git directory), as the working copy's config reads it
|
|
36778
|
+
* when that is the user's chain (it has the environment); else the protected configuration.
|
|
36779
|
+
*/
|
|
36780
|
+
defaultInitialBranch() {
|
|
36781
|
+
const config = this._workingCopy.config;
|
|
36782
|
+
const environment = hostEnvironmentOf(this._workingCopy);
|
|
36783
|
+
return defaultInitialBranch(environment, environment && config?.listWithOrigin ? config : void 0);
|
|
36784
|
+
}
|
|
36096
36785
|
/** The branch the local HEAD names (`init.defaultBranch` of the new repository), if any. */
|
|
36097
36786
|
async localHeadBranch() {
|
|
36098
36787
|
const head = await this.refsStore.get("HEAD");
|
|
@@ -41506,7 +42195,7 @@ function patchDiff(a, b, options) {
|
|
|
41506
42195
|
}
|
|
41507
42196
|
//#endregion
|
|
41508
42197
|
//#region src/commands/range-diff/range-diff-command.ts
|
|
41509
|
-
const USAGE$
|
|
42198
|
+
const USAGE$7 = [
|
|
41510
42199
|
"usage: git range-diff [<options>] <old-base>..<old-tip> <new-base>..<new-tip>",
|
|
41511
42200
|
" or: git range-diff [<options>] <old-tip>...<new-tip>",
|
|
41512
42201
|
" or: git range-diff [<options>] <base> <old-tip> <new-tip>"
|
|
@@ -41740,7 +42429,7 @@ var RangeDiffCommand = class extends RangeDiffBase {
|
|
|
41740
42429
|
let maxMemory;
|
|
41741
42430
|
if (typeof this.maxMemory === "string") {
|
|
41742
42431
|
maxMemory = parseRangeDiffMaxMemory(this.maxMemory);
|
|
41743
|
-
if (maxMemory === void 0) throw new GitApiError(`error: invalid max-memory value: ${this.maxMemory}\n\n${USAGE$
|
|
42432
|
+
if (maxMemory === void 0) throw new GitApiError(`error: invalid max-memory value: ${this.maxMemory}\n\n${USAGE$7}`, { exitCode: 129 });
|
|
41744
42433
|
} else maxMemory = this.maxMemory;
|
|
41745
42434
|
const { range1, range2, logArgs } = await this.ranges();
|
|
41746
42435
|
const color = this.simpleColor === 0 ? true : this.color;
|
|
@@ -41771,7 +42460,7 @@ var RangeDiffCommand = class extends RangeDiffBase {
|
|
|
41771
42460
|
async ranges() {
|
|
41772
42461
|
const argv = this.args;
|
|
41773
42462
|
const dashDash = argv.indexOf("--");
|
|
41774
|
-
const usage = (message) => new GitApiError(`fatal: ${message}\n\n${USAGE$
|
|
42463
|
+
const usage = (message) => new GitApiError(`fatal: ${message}\n\n${USAGE$7}`, { exitCode: 129 });
|
|
41775
42464
|
const argc = argv.length;
|
|
41776
42465
|
const arg = (k) => argv[k];
|
|
41777
42466
|
if (dashDash === 3 || dashDash < 0 && argc > 2 && await this.isCommittish(arg(0)) && await this.isCommittish(arg(1)) && await this.isCommittish(arg(2))) {
|
|
@@ -44863,7 +45552,7 @@ function prefixedElement(arg, prefix, top) {
|
|
|
44863
45552
|
* `git last-modified` (builtin/last-modified.c, git 2.52+): for each path of a commit's tree,
|
|
44864
45553
|
* the commit that last changed it.
|
|
44865
45554
|
*/
|
|
44866
|
-
const USAGE$
|
|
45555
|
+
const USAGE$6 = "usage: git last-modified [--recursive] [--show-trees] [--max-depth=<depth>] [-z]\n [<revision-range>] [[--] <pathspec>...]";
|
|
44867
45556
|
const PARENT1 = 1;
|
|
44868
45557
|
const PARENT2 = 2;
|
|
44869
45558
|
const BOUNDARY = 4;
|
|
@@ -44976,7 +45665,7 @@ var LastModifiedCommand = class extends PlumbingCommand {
|
|
|
44976
45665
|
return entries;
|
|
44977
45666
|
}
|
|
44978
45667
|
async run() {
|
|
44979
|
-
for (const r of this.revisions) if (r.startsWith("-")) throw new PlumbingError(`error: unknown last-modified argument: ${r}\n${USAGE$
|
|
45668
|
+
for (const r of this.revisions) if (r.startsWith("-")) throw new PlumbingError(`error: unknown last-modified argument: ${r}\n${USAGE$6}`, 129);
|
|
44980
45669
|
const items = await this.parsePaths();
|
|
44981
45670
|
const ps = items.length > 0 ? treePathspec(items) : void 0;
|
|
44982
45671
|
const depthValid = this.maxDepth >= 0;
|
|
@@ -46494,716 +47183,173 @@ var LsRemoteCommand = class extends TransportCommand {
|
|
|
46494
47183
|
remoteName;
|
|
46495
47184
|
/**
|
|
46496
47185
|
* Set the remote to query.
|
|
46497
|
-
*
|
|
46498
|
-
* Can be either a remote name (e.g., "origin") or a URL.
|
|
46499
|
-
*
|
|
46500
|
-
* @param remote Remote name or URL
|
|
46501
|
-
*/
|
|
46502
|
-
setRemote(remote) {
|
|
46503
|
-
this.checkCallable();
|
|
46504
|
-
this.remote = remote;
|
|
46505
|
-
return this;
|
|
46506
|
-
}
|
|
46507
|
-
/**
|
|
46508
|
-
* Get the remote being queried.
|
|
46509
|
-
*/
|
|
46510
|
-
getRemote() {
|
|
46511
|
-
return this.remote;
|
|
46512
|
-
}
|
|
46513
|
-
/**
|
|
46514
|
-
* Set whether to show only refs under refs/heads.
|
|
46515
|
-
*
|
|
46516
|
-
* @param heads Whether to show only heads
|
|
46517
|
-
*/
|
|
46518
|
-
setHeads(heads) {
|
|
46519
|
-
this.checkCallable();
|
|
46520
|
-
this.heads = heads;
|
|
46521
|
-
return this;
|
|
46522
|
-
}
|
|
46523
|
-
/**
|
|
46524
|
-
* Whether to show only heads.
|
|
46525
|
-
*/
|
|
46526
|
-
isHeads() {
|
|
46527
|
-
return this.heads;
|
|
46528
|
-
}
|
|
46529
|
-
/**
|
|
46530
|
-
* Set whether to show only refs under refs/tags.
|
|
46531
|
-
*
|
|
46532
|
-
* @param tags Whether to show only tags
|
|
46533
|
-
*/
|
|
46534
|
-
setTags(tags) {
|
|
46535
|
-
this.checkCallable();
|
|
46536
|
-
this.tags = tags;
|
|
46537
|
-
return this;
|
|
46538
|
-
}
|
|
46539
|
-
/**
|
|
46540
|
-
* Whether to show only tags.
|
|
46541
|
-
*/
|
|
46542
|
-
isTags() {
|
|
46543
|
-
return this.tags;
|
|
46544
|
-
}
|
|
46545
|
-
/**
|
|
46546
|
-
* Set the program the remote runs for upload-pack (git's `--upload-pack`, over the
|
|
46547
|
-
* `remote.<name>.uploadpack` of the remote listed, given or default): what an ssh connector runs, and
|
|
46548
|
-
* what git:// names in its request line.
|
|
46549
|
-
*
|
|
46550
|
-
* @param uploadPack Path to git-upload-pack on remote
|
|
46551
|
-
*/
|
|
46552
|
-
setUploadPack(uploadPack) {
|
|
46553
|
-
this.checkCallable();
|
|
46554
|
-
this.uploadPack = uploadPack;
|
|
46555
|
-
return this;
|
|
46556
|
-
}
|
|
46557
|
-
/**
|
|
46558
|
-
* Execute the ls-remote operation.
|
|
46559
|
-
*
|
|
46560
|
-
* @returns Refs from the remote repository
|
|
46561
|
-
* @throws InvalidRemoteError git's "No remote configured to list refs from." when no remote
|
|
46562
|
-
* is given and git's default one has no URL
|
|
46563
|
-
*/
|
|
46564
|
-
async call() {
|
|
46565
|
-
this.checkCallable();
|
|
46566
|
-
this.setCallable(false);
|
|
46567
|
-
const remoteUrl = await this.remoteUrl();
|
|
46568
|
-
const remote = await this.prepareRemote(remoteUrl);
|
|
46569
|
-
const uploadPack = this.uploadPack ?? (this.remoteName !== void 0 ? this.remoteProgram(this.remoteName, "uploadpack") : void 0);
|
|
46570
|
-
const options = {
|
|
46571
|
-
...this.remoteSessionOptions(),
|
|
46572
|
-
...uploadPack !== void 0 ? { program: uploadPack } : {}
|
|
46573
|
-
};
|
|
46574
|
-
const prefixes = [...this.tags ? ["refs/tags/"] : [], ...this.heads ? ["refs/heads/"] : []];
|
|
46575
|
-
if (prefixes.length > 0) prefixes.push("HEAD");
|
|
46576
|
-
const listRefs = async (connection) => connection.version === 2 ? await lsRefs(connection, prefixes) : [...connection.advertisedRefs ?? []];
|
|
46577
|
-
const listed = await withRemoteUploadPack(remote, options, listRefs);
|
|
46578
|
-
const filteredRefs = [];
|
|
46579
|
-
for (const ref of listed) {
|
|
46580
|
-
if (ref.name === "HEAD" || !ref.oid) continue;
|
|
46581
|
-
if (!(!this.heads && !this.tags || this.heads && ref.name.startsWith("refs/heads/") || this.tags && ref.name.startsWith("refs/tags/"))) continue;
|
|
46582
|
-
filteredRefs.push({
|
|
46583
|
-
name: ref.name,
|
|
46584
|
-
objectId: ref.oid,
|
|
46585
|
-
...ref.peeled ? { peeledObjectId: ref.peeled } : {},
|
|
46586
|
-
...ref.symref ? {
|
|
46587
|
-
symbolic: true,
|
|
46588
|
-
target: ref.symref
|
|
46589
|
-
} : {}
|
|
46590
|
-
});
|
|
46591
|
-
}
|
|
46592
|
-
let defaultBranch;
|
|
46593
|
-
const head = listed.find((r) => r.name === "HEAD");
|
|
46594
|
-
if (head?.symref?.startsWith("refs/heads/")) defaultBranch = head.symref.slice(11);
|
|
46595
|
-
else if (head?.oid) {
|
|
46596
|
-
const match = listed.find((r) => r.name.startsWith("refs/heads/") && r.oid === head.oid);
|
|
46597
|
-
if (match) defaultBranch = match.name.slice(11);
|
|
46598
|
-
}
|
|
46599
|
-
return {
|
|
46600
|
-
uri: remoteUrl,
|
|
46601
|
-
refs: filteredRefs,
|
|
46602
|
-
defaultBranch,
|
|
46603
|
-
...head?.oid && !this.heads && !this.tags ? { head: head.oid } : {}
|
|
46604
|
-
};
|
|
46605
|
-
}
|
|
46606
|
-
/**
|
|
46607
|
-
* Call and return just the refs map.
|
|
46608
|
-
*
|
|
46609
|
-
* Convenience method for simple use cases.
|
|
46610
|
-
*/
|
|
46611
|
-
async callAsMap() {
|
|
46612
|
-
const result = await this.call();
|
|
46613
|
-
const map = /* @__PURE__ */ new Map();
|
|
46614
|
-
for (const ref of result.refs) map.set(ref.name, ref.objectId);
|
|
46615
|
-
return map;
|
|
46616
|
-
}
|
|
46617
|
-
/**
|
|
46618
|
-
* The URL a remote resolves to, without contacting it: `git ls-remote --get-url
|
|
46619
|
-
* [<remote>]` (the remote's first URL, or the URL given, with `insteadOf` applied). Without
|
|
46620
|
-
* a remote, git's `remote_get(NULL)`: the current branch's `branch.<name>.remote` (read as a
|
|
46621
|
-
* URL when no such remote has one), else the only configured remote, else `origin`; when
|
|
46622
|
-
* that names no remote with a URL, git's "No remote configured to list refs from.".
|
|
46623
|
-
*
|
|
46624
|
-
* @example
|
|
46625
|
-
* ```typescript
|
|
46626
|
-
* // [url "https://example.com/"] insteadOf = ex:
|
|
46627
|
-
* await git.lsRemote().setRemote("ex:repo.git").callGetUrl(); // "https://example.com/repo.git"
|
|
46628
|
-
* ```
|
|
46629
|
-
*
|
|
46630
|
-
* @throws InvalidRemoteError "fatal: No remote configured to list refs from." (exit 128)
|
|
46631
|
-
*/
|
|
46632
|
-
async callGetUrl() {
|
|
46633
|
-
this.checkCallable();
|
|
46634
|
-
this.setCallable(false);
|
|
46635
|
-
return this.remoteUrl();
|
|
46636
|
-
}
|
|
46637
|
-
/** The URL of the remote given, or of git's default remote (see {@link callGetUrl}). */
|
|
46638
|
-
async remoteUrl() {
|
|
46639
|
-
const store = RemoteConfigStore.from(this.workingCopy);
|
|
46640
|
-
if (this.remote !== void 0) {
|
|
46641
|
-
this.remoteName = this.remote;
|
|
46642
|
-
await this.loadLegacyRemote(this.remote);
|
|
46643
|
-
return store.remoteUrlOf(this.remote);
|
|
46644
|
-
}
|
|
46645
|
-
const head = await this.refsStore.get("HEAD");
|
|
46646
|
-
if (head && isSymbolicRef(head) && head.target.startsWith("refs/heads/")) {
|
|
46647
|
-
const branch = head.target.slice(11);
|
|
46648
|
-
const explicit = store.value(`branch.${branch}.remote`);
|
|
46649
|
-
if (explicit !== void 0) {
|
|
46650
|
-
this.remoteName = explicit;
|
|
46651
|
-
await this.loadLegacyRemote(explicit);
|
|
46652
|
-
return store.remoteUrlOf(explicit);
|
|
46653
|
-
}
|
|
46654
|
-
}
|
|
46655
|
-
const names = store.configuredNames();
|
|
46656
|
-
const name = names.length === 1 ? names[0] ?? "origin" : "origin";
|
|
46657
|
-
await this.loadLegacyRemote(name);
|
|
46658
|
-
const url = store.urlFor(name);
|
|
46659
|
-
if (url === void 0) throw new InvalidRemoteError(name, "fatal: No remote configured to list refs from.");
|
|
46660
|
-
this.remoteName = name;
|
|
46661
|
-
return url;
|
|
46662
|
-
}
|
|
46663
|
-
};
|
|
46664
|
-
//#endregion
|
|
46665
|
-
//#region src/commands/ls-tree-command.ts
|
|
46666
|
-
/**
|
|
46667
|
-
* `git ls-tree` (builtin/ls-tree.c): the entries of a tree, byte for byte as git prints them.
|
|
46668
|
-
*
|
|
46669
|
-
* @example
|
|
46670
|
-
* ```typescript
|
|
46671
|
-
* // git ls-tree -r --name-only HEAD src/
|
|
46672
|
-
* const { stdout } = await git.lsTree().setTreeish("HEAD").setRecursive(true)
|
|
46673
|
-
* .setNameOnly().addPaths("src/").callOutput();
|
|
46674
|
-
* ```
|
|
46675
|
-
*/
|
|
46676
|
-
/** The fast paths ls-tree takes for a `--format` equal to a mode's own format. */
|
|
46677
|
-
const MODE_FORMATS = [
|
|
46678
|
-
["default", "%(objectmode) %(objecttype) %(objectname)%x09%(path)"],
|
|
46679
|
-
["long", "%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)"],
|
|
46680
|
-
["name-only", "%(path)"],
|
|
46681
|
-
["object-only", "%(objectname)"]
|
|
46682
|
-
];
|
|
46683
|
-
const USAGE$6 = "usage: git ls-tree [<options>] <tree-ish> [<path>...]";
|
|
46684
|
-
/** pathspec.c's `pathspec_magic`: the bits, mnemonics and names, in its order */
|
|
46685
|
-
const MAGIC$2 = [
|
|
46686
|
-
{
|
|
46687
|
-
name: "top",
|
|
46688
|
-
mnemonic: "/"
|
|
46689
|
-
},
|
|
46690
|
-
{
|
|
46691
|
-
name: "literal",
|
|
46692
|
-
mnemonic: ""
|
|
46693
|
-
},
|
|
46694
|
-
{
|
|
46695
|
-
name: "glob",
|
|
46696
|
-
mnemonic: ""
|
|
46697
|
-
},
|
|
46698
|
-
{
|
|
46699
|
-
name: "icase",
|
|
46700
|
-
mnemonic: ""
|
|
46701
|
-
},
|
|
46702
|
-
{
|
|
46703
|
-
name: "exclude",
|
|
46704
|
-
mnemonic: "!"
|
|
46705
|
-
},
|
|
46706
|
-
{
|
|
46707
|
-
name: "attr",
|
|
46708
|
-
mnemonic: ""
|
|
46709
|
-
}
|
|
46710
|
-
];
|
|
46711
|
-
const FLUSH_AT = 65536;
|
|
46712
|
-
/**
|
|
46713
|
-
* `git ls-tree [<options>] <tree-ish> [<path>...]`.
|
|
46714
|
-
*
|
|
46715
|
-
* Paths are ls-tree's own: literal pathspecs (only `:(top)` and `:(literal)` magic), a tree
|
|
46716
|
-
* shown or entered by leading path components (`show_recursive`), not wildcard matches.
|
|
46717
|
-
* Output paths are relative to {@link setPrefix} unless `--full-name`/`--full-tree`.
|
|
46718
|
-
*
|
|
46719
|
-
* git 2.43 (`setCompatibility("2.43")`) words the conflict of two output modes as
|
|
46720
|
-
* `error: <b> is incompatible with <a>`, 2.45 and later as `error: options '<b>' and '<a>'
|
|
46721
|
-
* cannot be used together`. Usage errors exit 129 with that first line only (git prints its
|
|
46722
|
-
* usage after it).
|
|
46723
|
-
*/
|
|
46724
|
-
var LsTreeCommand = class extends PlumbingCommand {
|
|
46725
|
-
treeish;
|
|
46726
|
-
paths = [];
|
|
46727
|
-
treesOnly = false;
|
|
46728
|
-
recursive = false;
|
|
46729
|
-
showTrees = false;
|
|
46730
|
-
nul = false;
|
|
46731
|
-
modes = [];
|
|
46732
|
-
fullName;
|
|
46733
|
-
fullTree = false;
|
|
46734
|
-
format;
|
|
46735
|
-
abbrev = 0;
|
|
46736
|
-
prefix = "";
|
|
46737
|
-
compatibility = "2.56";
|
|
46738
|
-
/** The `<tree-ish>` argument. */
|
|
46739
|
-
setTreeish(name) {
|
|
46740
|
-
this.checkCallable();
|
|
46741
|
-
this.treeish = name;
|
|
46742
|
-
return this;
|
|
46743
|
-
}
|
|
46744
|
-
/** `<path>...` arguments, read against {@link setPrefix}. */
|
|
46745
|
-
addPaths(...paths) {
|
|
46746
|
-
this.checkCallable();
|
|
46747
|
-
this.paths.push(...paths);
|
|
46748
|
-
return this;
|
|
46749
|
-
}
|
|
46750
|
-
/** `-d`: only trees (and gitlinks). */
|
|
46751
|
-
setTreesOnly(on = true) {
|
|
46752
|
-
this.checkCallable();
|
|
46753
|
-
this.treesOnly = on;
|
|
46754
|
-
return this;
|
|
46755
|
-
}
|
|
46756
|
-
/** `-r`: recurse into subtrees. */
|
|
46757
|
-
setRecursive(on = true) {
|
|
46758
|
-
this.checkCallable();
|
|
46759
|
-
this.recursive = on;
|
|
46760
|
-
return this;
|
|
46761
|
-
}
|
|
46762
|
-
/** `-t`: show the trees recursed into. */
|
|
46763
|
-
setShowTrees(on = true) {
|
|
46764
|
-
this.checkCallable();
|
|
46765
|
-
this.showTrees = on;
|
|
46766
|
-
return this;
|
|
46767
|
-
}
|
|
46768
|
-
/** `-z`: entries end with NUL, paths unquoted. */
|
|
46769
|
-
setNullTerminated(on = true) {
|
|
46770
|
-
this.checkCallable();
|
|
46771
|
-
this.nul = on;
|
|
46772
|
-
return this;
|
|
46773
|
-
}
|
|
46774
|
-
/**
|
|
46775
|
-
* An output mode option (`-l`/`--long`, `--name-only`, `--name-status`, `--object-only`),
|
|
46776
|
-
* `option` its spelling for git's conflict message; a second, different mode is refused.
|
|
46777
|
-
*/
|
|
46778
|
-
addMode(mode, option = `--${mode}`) {
|
|
46779
|
-
this.checkCallable();
|
|
46780
|
-
this.modes.push({
|
|
46781
|
-
mode,
|
|
46782
|
-
option
|
|
46783
|
-
});
|
|
46784
|
-
return this;
|
|
46785
|
-
}
|
|
46786
|
-
/** `-l`/`--long`: object sizes. */
|
|
46787
|
-
setLong(option = "--long") {
|
|
46788
|
-
return this.addMode("long", option);
|
|
46789
|
-
}
|
|
46790
|
-
/** `--name-only`: paths only. */
|
|
46791
|
-
setNameOnly() {
|
|
46792
|
-
return this.addMode("name-only");
|
|
46793
|
-
}
|
|
46794
|
-
/** `--name-status`: as `--name-only`. */
|
|
46795
|
-
setNameStatus() {
|
|
46796
|
-
return this.addMode("name-status");
|
|
46797
|
-
}
|
|
46798
|
-
/** `--object-only`: object names only. */
|
|
46799
|
-
setObjectOnly() {
|
|
46800
|
-
return this.addMode("object-only");
|
|
46801
|
-
}
|
|
46802
|
-
/** `--[no-]full-name`: paths from the top (default: on when there is no prefix). */
|
|
46803
|
-
setFullName(on = true) {
|
|
47186
|
+
*
|
|
47187
|
+
* Can be either a remote name (e.g., "origin") or a URL.
|
|
47188
|
+
*
|
|
47189
|
+
* @param remote Remote name or URL
|
|
47190
|
+
*/
|
|
47191
|
+
setRemote(remote) {
|
|
46804
47192
|
this.checkCallable();
|
|
46805
|
-
this.
|
|
47193
|
+
this.remote = remote;
|
|
46806
47194
|
return this;
|
|
46807
47195
|
}
|
|
46808
|
-
/**
|
|
46809
|
-
|
|
46810
|
-
|
|
46811
|
-
|
|
46812
|
-
return this;
|
|
47196
|
+
/**
|
|
47197
|
+
* Get the remote being queried.
|
|
47198
|
+
*/
|
|
47199
|
+
getRemote() {
|
|
47200
|
+
return this.remote;
|
|
46813
47201
|
}
|
|
46814
|
-
/**
|
|
46815
|
-
|
|
47202
|
+
/**
|
|
47203
|
+
* Set whether to show only refs under refs/heads.
|
|
47204
|
+
*
|
|
47205
|
+
* @param heads Whether to show only heads
|
|
47206
|
+
*/
|
|
47207
|
+
setHeads(heads) {
|
|
46816
47208
|
this.checkCallable();
|
|
46817
|
-
this.
|
|
47209
|
+
this.heads = heads;
|
|
46818
47210
|
return this;
|
|
46819
47211
|
}
|
|
46820
47212
|
/**
|
|
46821
|
-
*
|
|
46822
|
-
* id (`--no-abbrev`), else at least `n` digits (4 at least).
|
|
47213
|
+
* Whether to show only heads.
|
|
46823
47214
|
*/
|
|
46824
|
-
|
|
46825
|
-
this.
|
|
46826
|
-
this.abbrev = length === void 0 ? -1 : length;
|
|
46827
|
-
return this;
|
|
47215
|
+
isHeads() {
|
|
47216
|
+
return this.heads;
|
|
46828
47217
|
}
|
|
46829
|
-
/**
|
|
46830
|
-
|
|
47218
|
+
/**
|
|
47219
|
+
* Set whether to show only refs under refs/tags.
|
|
47220
|
+
*
|
|
47221
|
+
* @param tags Whether to show only tags
|
|
47222
|
+
*/
|
|
47223
|
+
setTags(tags) {
|
|
46831
47224
|
this.checkCallable();
|
|
46832
|
-
|
|
46833
|
-
this.prefix = p ? `${p}/` : "";
|
|
47225
|
+
this.tags = tags;
|
|
46834
47226
|
return this;
|
|
46835
47227
|
}
|
|
46836
|
-
/**
|
|
46837
|
-
|
|
47228
|
+
/**
|
|
47229
|
+
* Whether to show only tags.
|
|
47230
|
+
*/
|
|
47231
|
+
isTags() {
|
|
47232
|
+
return this.tags;
|
|
47233
|
+
}
|
|
47234
|
+
/**
|
|
47235
|
+
* Set the program the remote runs for upload-pack (git's `--upload-pack`, over the
|
|
47236
|
+
* `remote.<name>.uploadpack` of the remote listed, given or default): what an ssh connector runs, and
|
|
47237
|
+
* what git:// names in its request line.
|
|
47238
|
+
*
|
|
47239
|
+
* @param uploadPack Path to git-upload-pack on remote
|
|
47240
|
+
*/
|
|
47241
|
+
setUploadPack(uploadPack) {
|
|
46838
47242
|
this.checkCallable();
|
|
46839
|
-
this.
|
|
47243
|
+
this.uploadPack = uploadPack;
|
|
46840
47244
|
return this;
|
|
46841
47245
|
}
|
|
46842
|
-
|
|
46843
|
-
|
|
46844
|
-
|
|
46845
|
-
|
|
46846
|
-
|
|
46847
|
-
|
|
46848
|
-
|
|
46849
|
-
|
|
46850
|
-
|
|
46851
|
-
|
|
46852
|
-
|
|
46853
|
-
|
|
46854
|
-
const
|
|
46855
|
-
|
|
46856
|
-
|
|
46857
|
-
|
|
46858
|
-
at += c.length;
|
|
46859
|
-
}
|
|
46860
|
-
this.out = [];
|
|
46861
|
-
this.outSize = 0;
|
|
46862
|
-
await this.write(all);
|
|
46863
|
-
}
|
|
46864
|
-
async run() {
|
|
46865
|
-
let mode;
|
|
46866
|
-
let modeOption = "";
|
|
46867
|
-
for (const m of this.modes) {
|
|
46868
|
-
if (mode !== void 0 && m.mode !== mode) throw new PlumbingError(this.compatibility === "2.43" ? `error: ${m.option} is incompatible with ${modeOption}` : `error: options '${m.option}' and '${modeOption}' cannot be used together`, 129);
|
|
46869
|
-
mode = m.mode;
|
|
46870
|
-
modeOption = m.option;
|
|
46871
|
-
}
|
|
46872
|
-
if (mode === "name-status") mode = "name-only";
|
|
46873
|
-
let prefix = this.prefix || void 0;
|
|
46874
|
-
if (this.fullTree) prefix = void 0;
|
|
46875
|
-
const outputPrefix = this.fullName ?? !this.prefix ? void 0 : prefix;
|
|
46876
|
-
let showTrees = this.showTrees;
|
|
46877
|
-
if (this.treesOnly && this.recursive) showTrees = true;
|
|
46878
|
-
if (this.format !== void 0 && mode !== void 0) throw new PlumbingError("fatal: --format can't be combined with other format-altering options", 129);
|
|
46879
|
-
if (this.treeish === void 0) throw new PlumbingError(USAGE$6, 129);
|
|
46880
|
-
const resolver = this.revisionResolver();
|
|
46881
|
-
let id;
|
|
46882
|
-
try {
|
|
46883
|
-
id = await resolver.resolve(this.treeish, { hashAny: true });
|
|
46884
|
-
} catch (e) {
|
|
46885
|
-
if (!(e instanceof RefNotFoundError)) throw e;
|
|
46886
|
-
}
|
|
46887
|
-
for (const w of resolver.warnings) this.warn(w);
|
|
46888
|
-
resolver.warnings.length = 0;
|
|
46889
|
-
if (id === void 0) throw new PlumbingError(`fatal: Not a valid object name ${this.treeish}`);
|
|
46890
|
-
const items = await this.parsePaths(prefix);
|
|
46891
|
-
const tree = await this.peelToTree(id);
|
|
46892
|
-
if (tree === void 0) throw new PlumbingError("fatal: not a tree object");
|
|
46893
|
-
let fn;
|
|
46894
|
-
if (this.format !== void 0) {
|
|
46895
|
-
const fast = MODE_FORMATS.find(([, f]) => f === this.format);
|
|
46896
|
-
fn = fast ? fast[0] : "format";
|
|
46897
|
-
} else fn = mode ?? "default";
|
|
46898
|
-
const quotePathValue = (this._workingCopy.config ? RemoteConfigStore.from(this._workingCopy) : void 0)?.value("core.quotePath");
|
|
46899
|
-
const quoteFully = quotePathValue === void 0 ? true : parseGitBool$1(quotePathValue) ?? true;
|
|
46900
|
-
const ctx = {
|
|
46901
|
-
items,
|
|
46902
|
-
ps: items.length > 0 ? treePathspec(items) : void 0,
|
|
46903
|
-
fn,
|
|
46904
|
-
treesOnly: this.treesOnly,
|
|
46905
|
-
recursive: this.recursive,
|
|
46906
|
-
showTrees,
|
|
46907
|
-
outputPrefix: outputPrefix === void 0 ? void 0 : latin1String(encodeGitPath(outputPrefix)),
|
|
46908
|
-
quoteFully,
|
|
46909
|
-
nulTerminated: this.nul
|
|
47246
|
+
/**
|
|
47247
|
+
* Execute the ls-remote operation.
|
|
47248
|
+
*
|
|
47249
|
+
* @returns Refs from the remote repository
|
|
47250
|
+
* @throws InvalidRemoteError git's "No remote configured to list refs from." when no remote
|
|
47251
|
+
* is given and git's default one has no URL
|
|
47252
|
+
*/
|
|
47253
|
+
async call() {
|
|
47254
|
+
this.checkCallable();
|
|
47255
|
+
this.setCallable(false);
|
|
47256
|
+
const remoteUrl = await this.remoteUrl();
|
|
47257
|
+
const remote = await this.prepareRemote(remoteUrl);
|
|
47258
|
+
const uploadPack = this.uploadPack ?? (this.remoteName !== void 0 ? this.remoteProgram(this.remoteName, "uploadpack") : void 0);
|
|
47259
|
+
const options = {
|
|
47260
|
+
...this.remoteSessionOptions(),
|
|
47261
|
+
...uploadPack !== void 0 ? { program: uploadPack } : {}
|
|
46910
47262
|
};
|
|
46911
|
-
|
|
46912
|
-
|
|
46913
|
-
|
|
46914
|
-
|
|
46915
|
-
|
|
46916
|
-
|
|
46917
|
-
|
|
46918
|
-
|
|
46919
|
-
|
|
46920
|
-
|
|
46921
|
-
|
|
46922
|
-
|
|
46923
|
-
|
|
46924
|
-
|
|
46925
|
-
|
|
46926
|
-
|
|
46927
|
-
|
|
46928
|
-
});
|
|
46929
|
-
if (this.paths.length === 0) return prefix ? [literal(prefix)] : [];
|
|
46930
|
-
for (const p of this.paths) if (p === "") throw new PlumbingError("fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths");
|
|
46931
|
-
const items = [];
|
|
46932
|
-
for (const elem of this.paths) {
|
|
46933
|
-
const { magic, rest } = parseElementMagic(elem);
|
|
46934
|
-
if (magic.has("literal") && magic.has("glob")) throw new PlumbingError(`fatal: ${elem}: 'literal' and 'glob' are incompatible`);
|
|
46935
|
-
let match;
|
|
46936
|
-
if (magic.has("top")) match = rest;
|
|
46937
|
-
else {
|
|
46938
|
-
const normalized = await this.prefixPath(prefix ?? "", rest);
|
|
46939
|
-
if (normalized === void 0) {
|
|
46940
|
-
const top = await this.hostWorkingDir() ?? "";
|
|
46941
|
-
throw new PlumbingError(`fatal: ${elem}: '${rest}' is outside repository at '${top.replace(/\/+$/, "") || "/"}'`);
|
|
46942
|
-
}
|
|
46943
|
-
match = normalized;
|
|
46944
|
-
}
|
|
46945
|
-
const unsupported = MAGIC$2.filter((m) => m.name !== "top" && m.name !== "literal").filter((m) => magic.has(m.name));
|
|
46946
|
-
if (unsupported.length > 0) {
|
|
46947
|
-
const names = unsupported.map((m) => m.mnemonic ? `'${m.name}' (mnemonic: '${m.mnemonic}')` : `'${m.name}'`).join(", ");
|
|
46948
|
-
throw new PlumbingError(`fatal: ${elem}: pathspec magic not supported by this command: ${names}`);
|
|
46949
|
-
}
|
|
46950
|
-
items.push(literal(match));
|
|
46951
|
-
}
|
|
46952
|
-
return items;
|
|
46953
|
-
}
|
|
46954
|
-
/** prefix_path_gently: the path from the top, undefined when it leaves the worktree. */
|
|
46955
|
-
async prefixPath(prefix, path) {
|
|
46956
|
-
return prefixPathGently(prefix, path, path.startsWith("/") ? await this.hostWorkingDir() : void 0);
|
|
46957
|
-
}
|
|
46958
|
-
/** parse_tree_indirect: a commit's tree, a tag's object peeled, a tree itself. */
|
|
46959
|
-
async peelToTree(id) {
|
|
46960
|
-
const compat = this.compatObjects;
|
|
46961
|
-
if (compat && id.length !== this.objectFormat.hexLength) {
|
|
46962
|
-
const type = (await compat.readAsCompat(id).catch(() => void 0))?.type;
|
|
46963
|
-
if (type === "tree") return id;
|
|
46964
|
-
if (type === "commit") this.warn(`error: bogus commit object ${id}`);
|
|
46965
|
-
if (type === "blob") this.warn(`error: hash mismatch ${id}`);
|
|
46966
|
-
return;
|
|
46967
|
-
}
|
|
46968
|
-
const peeled = await this.revisionResolver().peelTags(id);
|
|
46969
|
-
if (peeled.type === "tree") return peeled.id;
|
|
46970
|
-
if (peeled.type === "commit") return (await this.commits.load(peeled.id).catch(() => void 0))?.tree;
|
|
46971
|
-
}
|
|
46972
|
-
/** read_tree_at: false when a tree could not be read (git's `-1`). */
|
|
46973
|
-
async walk(ctx, tree, base) {
|
|
46974
|
-
const entries = await this.listedTreeEntries(tree);
|
|
46975
|
-
if (!entries) {
|
|
46976
|
-
this.warn(`error: Could not read ${tree}`);
|
|
46977
|
-
return false;
|
|
46978
|
-
}
|
|
46979
|
-
const baseBytes = latin1Bytes$3(base);
|
|
46980
|
-
let all = false;
|
|
46981
|
-
for (const e of entries) {
|
|
46982
|
-
const nameBytes = encodeGitPath(e.name);
|
|
46983
|
-
const mode = e.mode;
|
|
46984
|
-
if (ctx.ps && !all) {
|
|
46985
|
-
const r = treeEntryInteresting(ctx.ps, nameBytes, 0, nameBytes.length, mode, baseBytes);
|
|
46986
|
-
if (r === -1) break;
|
|
46987
|
-
if (r === 0) continue;
|
|
46988
|
-
if (r === 2) all = true;
|
|
46989
|
-
}
|
|
46990
|
-
const name = latin1String(nameBytes);
|
|
46991
|
-
const type = objectTypeOfMode(mode);
|
|
46992
|
-
let recurse = false;
|
|
46993
|
-
let show = true;
|
|
46994
|
-
if (type === "blob") {
|
|
46995
|
-
if (ctx.treesOnly) show = false;
|
|
46996
|
-
} else if (type === "tree" && this.showRecursive(ctx, base, name)) {
|
|
46997
|
-
recurse = true;
|
|
46998
|
-
if (!ctx.showTrees) show = false;
|
|
46999
|
-
}
|
|
47000
|
-
if (show) {
|
|
47001
|
-
const pending = this.emit(await this.entryLine(ctx, e.id, mode, type, base + name));
|
|
47002
|
-
if (pending) await pending;
|
|
47003
|
-
}
|
|
47004
|
-
if (recurse && !await this.walk(ctx, e.id, `${base + name}/`)) return false;
|
|
47005
|
-
}
|
|
47006
|
-
return true;
|
|
47007
|
-
}
|
|
47008
|
-
/** show_recursive: whether a tree is entered. */
|
|
47009
|
-
showRecursive(ctx, base, pathname) {
|
|
47010
|
-
if (ctx.recursive) return true;
|
|
47011
|
-
for (const item of ctx.items) {
|
|
47012
|
-
const spec = item.match;
|
|
47013
|
-
if (!spec.startsWith(base)) continue;
|
|
47014
|
-
const rest = spec.slice(base.length);
|
|
47015
|
-
const len = pathname.length;
|
|
47016
|
-
if (rest.length <= len) continue;
|
|
47017
|
-
if (rest[len] !== "/") continue;
|
|
47018
|
-
if (rest.slice(0, len) !== pathname) continue;
|
|
47019
|
-
return true;
|
|
47263
|
+
const prefixes = [...this.tags ? ["refs/tags/"] : [], ...this.heads ? ["refs/heads/"] : []];
|
|
47264
|
+
if (prefixes.length > 0) prefixes.push("HEAD");
|
|
47265
|
+
const listRefs = async (connection) => connection.version === 2 ? await lsRefs(connection, prefixes) : [...connection.advertisedRefs ?? []];
|
|
47266
|
+
const listed = await withRemoteUploadPack(remote, options, listRefs);
|
|
47267
|
+
const filteredRefs = [];
|
|
47268
|
+
for (const ref of listed) {
|
|
47269
|
+
if (ref.name === "HEAD" || !ref.oid) continue;
|
|
47270
|
+
if (!(!this.heads && !this.tags || this.heads && ref.name.startsWith("refs/heads/") || this.tags && ref.name.startsWith("refs/tags/"))) continue;
|
|
47271
|
+
filteredRefs.push({
|
|
47272
|
+
name: ref.name,
|
|
47273
|
+
objectId: ref.oid,
|
|
47274
|
+
...ref.peeled ? { peeledObjectId: ref.peeled } : {},
|
|
47275
|
+
...ref.symref ? {
|
|
47276
|
+
symbolic: true,
|
|
47277
|
+
target: ref.symref
|
|
47278
|
+
} : {}
|
|
47279
|
+
});
|
|
47020
47280
|
}
|
|
47021
|
-
|
|
47022
|
-
|
|
47023
|
-
|
|
47024
|
-
if (
|
|
47025
|
-
|
|
47026
|
-
|
|
47027
|
-
return id.slice(0, Math.min(min, id.length));
|
|
47281
|
+
let defaultBranch;
|
|
47282
|
+
const head = listed.find((r) => r.name === "HEAD");
|
|
47283
|
+
if (head?.symref?.startsWith("refs/heads/")) defaultBranch = head.symref.slice(11);
|
|
47284
|
+
else if (head?.oid) {
|
|
47285
|
+
const match = listed.find((r) => r.name.startsWith("refs/heads/") && r.oid === head.oid);
|
|
47286
|
+
if (match) defaultBranch = match.name.slice(11);
|
|
47028
47287
|
}
|
|
47029
|
-
|
|
47030
|
-
|
|
47031
|
-
|
|
47032
|
-
|
|
47288
|
+
return {
|
|
47289
|
+
uri: remoteUrl,
|
|
47290
|
+
refs: filteredRefs,
|
|
47291
|
+
defaultBranch,
|
|
47292
|
+
...head?.oid && !this.heads && !this.tags ? { head: head.oid } : {}
|
|
47293
|
+
};
|
|
47033
47294
|
}
|
|
47034
|
-
/**
|
|
47035
|
-
|
|
47036
|
-
|
|
47037
|
-
|
|
47038
|
-
|
|
47039
|
-
|
|
47040
|
-
|
|
47041
|
-
|
|
47042
|
-
|
|
47043
|
-
|
|
47044
|
-
if (!obj) return void 0;
|
|
47045
|
-
await obj.content[Symbol.asyncIterator]().return?.();
|
|
47046
|
-
return obj.size;
|
|
47047
|
-
}
|
|
47048
|
-
return await this.blobs.size(id);
|
|
47049
|
-
} catch {
|
|
47050
|
-
return;
|
|
47051
|
-
}
|
|
47295
|
+
/**
|
|
47296
|
+
* Call and return just the refs map.
|
|
47297
|
+
*
|
|
47298
|
+
* Convenience method for simple use cases.
|
|
47299
|
+
*/
|
|
47300
|
+
async callAsMap() {
|
|
47301
|
+
const result = await this.call();
|
|
47302
|
+
const map = /* @__PURE__ */ new Map();
|
|
47303
|
+
for (const ref of result.refs) map.set(ref.name, ref.objectId);
|
|
47304
|
+
return map;
|
|
47052
47305
|
}
|
|
47053
|
-
/**
|
|
47054
|
-
|
|
47055
|
-
|
|
47056
|
-
|
|
47057
|
-
|
|
47306
|
+
/**
|
|
47307
|
+
* The URL a remote resolves to, without contacting it: `git ls-remote --get-url
|
|
47308
|
+
* [<remote>]` (the remote's first URL, or the URL given, with `insteadOf` applied). Without
|
|
47309
|
+
* a remote, git's `remote_get(NULL)`: the current branch's `branch.<name>.remote` (read as a
|
|
47310
|
+
* URL when no such remote has one), else the only configured remote, else `origin`; when
|
|
47311
|
+
* that names no remote with a URL, git's "No remote configured to list refs from.".
|
|
47312
|
+
*
|
|
47313
|
+
* @example
|
|
47314
|
+
* ```typescript
|
|
47315
|
+
* // [url "https://example.com/"] insteadOf = ex:
|
|
47316
|
+
* await git.lsRemote().setRemote("ex:repo.git").callGetUrl(); // "https://example.com/repo.git"
|
|
47317
|
+
* ```
|
|
47318
|
+
*
|
|
47319
|
+
* @throws InvalidRemoteError "fatal: No remote configured to list refs from." (exit 128)
|
|
47320
|
+
*/
|
|
47321
|
+
async callGetUrl() {
|
|
47322
|
+
this.checkCallable();
|
|
47323
|
+
this.setCallable(false);
|
|
47324
|
+
return this.remoteUrl();
|
|
47058
47325
|
}
|
|
47059
|
-
|
|
47060
|
-
|
|
47061
|
-
|
|
47062
|
-
|
|
47063
|
-
|
|
47064
|
-
|
|
47065
|
-
|
|
47066
|
-
return concatBytes([latin1Bytes$3(`${modeText} ${type} ${await this.abbreviated(id)} ${size.padStart(7)}\t`), this.fastPath(ctx, path)]);
|
|
47067
|
-
}
|
|
47068
|
-
case "name-only": return this.fastPath(ctx, path);
|
|
47069
|
-
case "object-only": return latin1Bytes$3(`${await this.abbreviated(id)}${this.nul ? "\0" : "\n"}`);
|
|
47070
|
-
default: return latin1Bytes$3(`${await this.expandFormat(ctx, id, modeText, type, path)}${this.nul ? "\0" : "\n"}`);
|
|
47326
|
+
/** The URL of the remote given, or of git's default remote (see {@link callGetUrl}). */
|
|
47327
|
+
async remoteUrl() {
|
|
47328
|
+
const store = RemoteConfigStore.from(this.workingCopy);
|
|
47329
|
+
if (this.remote !== void 0) {
|
|
47330
|
+
this.remoteName = this.remote;
|
|
47331
|
+
await this.loadLegacyRemote(this.remote);
|
|
47332
|
+
return store.remoteUrlOf(this.remote);
|
|
47071
47333
|
}
|
|
47072
|
-
|
|
47073
|
-
|
|
47074
|
-
|
|
47075
|
-
|
|
47076
|
-
|
|
47077
|
-
|
|
47078
|
-
|
|
47079
|
-
|
|
47080
|
-
if (type === "blob") {
|
|
47081
|
-
const s = await this.blobSize(id);
|
|
47082
|
-
if (s === void 0) throw new PlumbingError(`fatal: could not get object info about '${id}'`);
|
|
47083
|
-
text = String(s);
|
|
47084
|
-
}
|
|
47085
|
-
return padded ? text.padStart(7) : text;
|
|
47086
|
-
};
|
|
47087
|
-
while (i < format.length) {
|
|
47088
|
-
const at = format.indexOf("%", i);
|
|
47089
|
-
if (at < 0) {
|
|
47090
|
-
out += format.slice(i);
|
|
47091
|
-
break;
|
|
47092
|
-
}
|
|
47093
|
-
out += format.slice(i, at);
|
|
47094
|
-
i = at + 1;
|
|
47095
|
-
const rest = format.slice(i);
|
|
47096
|
-
if (rest.startsWith("%")) {
|
|
47097
|
-
out += "%";
|
|
47098
|
-
i += 1;
|
|
47099
|
-
continue;
|
|
47100
|
-
}
|
|
47101
|
-
if (rest.startsWith("n")) {
|
|
47102
|
-
out += "\n";
|
|
47103
|
-
i += 1;
|
|
47104
|
-
continue;
|
|
47105
|
-
}
|
|
47106
|
-
const hex = /^x([0-9a-fA-F]{2})/.exec(rest);
|
|
47107
|
-
if (hex) {
|
|
47108
|
-
out += String.fromCharCode(Number.parseInt(hex[1], 16));
|
|
47109
|
-
i += 3;
|
|
47110
|
-
continue;
|
|
47111
|
-
}
|
|
47112
|
-
const atom = /^\((objectmode|objecttype|objectsize:padded|objectsize|objectname|path)\)/.exec(rest);
|
|
47113
|
-
if (!atom) {
|
|
47114
|
-
const shown = decodeLatin1Path(rest);
|
|
47115
|
-
if (!rest.startsWith("(")) throw new PlumbingError(`fatal: bad ls-tree format: element '${shown}' does not start with '('`);
|
|
47116
|
-
const close = rest.indexOf(")", 1);
|
|
47117
|
-
if (close < 0) throw new PlumbingError(`fatal: bad ls-tree format: element '${shown}' does not end in ')'`);
|
|
47118
|
-
throw new PlumbingError(`fatal: bad ls-tree format: %${decodeLatin1Path(rest.slice(0, close + 1))}`);
|
|
47119
|
-
}
|
|
47120
|
-
i += atom[0].length;
|
|
47121
|
-
switch (atom[1]) {
|
|
47122
|
-
case "objectmode":
|
|
47123
|
-
out += modeText;
|
|
47124
|
-
break;
|
|
47125
|
-
case "objecttype":
|
|
47126
|
-
out += type;
|
|
47127
|
-
break;
|
|
47128
|
-
case "objectsize:padded":
|
|
47129
|
-
out += await size(true);
|
|
47130
|
-
break;
|
|
47131
|
-
case "objectsize":
|
|
47132
|
-
out += await size(false);
|
|
47133
|
-
break;
|
|
47134
|
-
case "objectname":
|
|
47135
|
-
out += await this.abbreviated(id);
|
|
47136
|
-
break;
|
|
47137
|
-
default: out += quoteBytes(relativePath$1(path, ctx.outputPrefix), ctx.quoteFully);
|
|
47334
|
+
const head = await this.refsStore.get("HEAD");
|
|
47335
|
+
if (head && isSymbolicRef(head) && head.target.startsWith("refs/heads/")) {
|
|
47336
|
+
const branch = head.target.slice(11);
|
|
47337
|
+
const explicit = store.value(`branch.${branch}.remote`);
|
|
47338
|
+
if (explicit !== void 0) {
|
|
47339
|
+
this.remoteName = explicit;
|
|
47340
|
+
await this.loadLegacyRemote(explicit);
|
|
47341
|
+
return store.remoteUrlOf(explicit);
|
|
47138
47342
|
}
|
|
47139
47343
|
}
|
|
47140
|
-
|
|
47344
|
+
const names = store.configuredNames();
|
|
47345
|
+
const name = names.length === 1 ? names[0] ?? "origin" : "origin";
|
|
47346
|
+
await this.loadLegacyRemote(name);
|
|
47347
|
+
const url = store.urlFor(name);
|
|
47348
|
+
if (url === void 0) throw new InvalidRemoteError(name, "fatal: No remote configured to list refs from.");
|
|
47349
|
+
this.remoteName = name;
|
|
47350
|
+
return url;
|
|
47141
47351
|
}
|
|
47142
47352
|
};
|
|
47143
|
-
/** A byte string as git prints it in an error message (bytes as they are). */
|
|
47144
|
-
function decodeLatin1Path(s) {
|
|
47145
|
-
return new TextDecoder().decode(latin1Bytes$3(s));
|
|
47146
|
-
}
|
|
47147
|
-
/** quote_c_style of a byte string, as a byte string. */
|
|
47148
|
-
function quoteBytes(path, quoteFully) {
|
|
47149
|
-
const body = quoteCStyleBody(latin1Bytes$3(path), quoteFully);
|
|
47150
|
-
if (body === void 0) return path;
|
|
47151
|
-
return latin1String(encodeGitPath(`"${body}"`));
|
|
47152
|
-
}
|
|
47153
|
-
/** parse_element_magic: the magic names an element carries and the path after them. */
|
|
47154
|
-
function parseElementMagic(elem) {
|
|
47155
|
-
const magic = /* @__PURE__ */ new Set();
|
|
47156
|
-
if (!elem.startsWith(":")) return {
|
|
47157
|
-
magic,
|
|
47158
|
-
rest: elem
|
|
47159
|
-
};
|
|
47160
|
-
if (elem[1] === "(") {
|
|
47161
|
-
let pos = 2;
|
|
47162
|
-
while (pos < elem.length && elem[pos] !== ")") {
|
|
47163
|
-
let len = 0;
|
|
47164
|
-
while (pos + len < elem.length && elem[pos + len] !== "," && elem[pos + len] !== ")") {
|
|
47165
|
-
if (elem[pos + len] === "\\" && pos + len + 1 < elem.length) len++;
|
|
47166
|
-
len++;
|
|
47167
|
-
}
|
|
47168
|
-
const next = elem[pos + len] === "," ? pos + len + 1 : pos + len;
|
|
47169
|
-
const word = elem.slice(pos, pos + len);
|
|
47170
|
-
pos = next;
|
|
47171
|
-
if (!word) continue;
|
|
47172
|
-
if (word.startsWith("prefix:")) {
|
|
47173
|
-
if (!/^-?\d+$/.test(word.slice(7))) throw new PlumbingError("fatal: invalid parameter for pathspec magic 'prefix'");
|
|
47174
|
-
continue;
|
|
47175
|
-
}
|
|
47176
|
-
if (word.startsWith("attr:")) {
|
|
47177
|
-
magic.add("attr");
|
|
47178
|
-
continue;
|
|
47179
|
-
}
|
|
47180
|
-
if (!MAGIC$2.some((m) => m.name === word)) throw new PlumbingError(`fatal: Invalid pathspec magic '${word}' in '${elem}'`);
|
|
47181
|
-
magic.add(word);
|
|
47182
|
-
}
|
|
47183
|
-
if (elem[pos] !== ")") throw new PlumbingError(`fatal: Missing ')' at the end of pathspec magic in '${elem}'`);
|
|
47184
|
-
return {
|
|
47185
|
-
magic,
|
|
47186
|
-
rest: elem.slice(pos + 1)
|
|
47187
|
-
};
|
|
47188
|
-
}
|
|
47189
|
-
let pos = 1;
|
|
47190
|
-
for (; pos < elem.length && elem[pos] !== ":"; pos++) {
|
|
47191
|
-
const ch = elem[pos];
|
|
47192
|
-
if (ch === "^") {
|
|
47193
|
-
magic.add("exclude");
|
|
47194
|
-
continue;
|
|
47195
|
-
}
|
|
47196
|
-
if (!SHORT_MAGIC$1.has(ch)) break;
|
|
47197
|
-
const m = MAGIC$2.find((x) => x.mnemonic === ch);
|
|
47198
|
-
if (!m) throw new PlumbingError(`fatal: Unimplemented pathspec magic '${ch}' in '${elem}'`);
|
|
47199
|
-
magic.add(m.name);
|
|
47200
|
-
}
|
|
47201
|
-
if (elem[pos] === ":") pos++;
|
|
47202
|
-
return {
|
|
47203
|
-
magic,
|
|
47204
|
-
rest: elem.slice(pos)
|
|
47205
|
-
};
|
|
47206
|
-
}
|
|
47207
47353
|
//#endregion
|
|
47208
47354
|
//#region src/commands/merge-base-command.ts
|
|
47209
47355
|
const USAGE$5 = [
|
|
@@ -52313,7 +52459,10 @@ var PushCommand = class PushCommand extends TransportCommand {
|
|
|
52313
52459
|
pushCertSigner(remoteUrl) {
|
|
52314
52460
|
const committer = () => committerIdentOf(this.workingCopy);
|
|
52315
52461
|
return {
|
|
52316
|
-
pusher: () => signingKeyIdOf(this.workingCopy, "", committer()
|
|
52462
|
+
pusher: () => signingKeyIdOf(this.workingCopy, "", committer(), {
|
|
52463
|
+
host: this.hooks,
|
|
52464
|
+
compatibility: this.compatibility ?? this.hooks.compatibility
|
|
52465
|
+
}),
|
|
52317
52466
|
pushee: anonymizeUrl(remoteUrl),
|
|
52318
52467
|
date: () => {
|
|
52319
52468
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
@@ -58101,6 +58250,7 @@ async function servedRepositoryOf(remote, options = {}) {
|
|
|
58101
58250
|
const fsckError = receiveFsckSettingsOf(remote, host).configError;
|
|
58102
58251
|
if (fsckError !== void 0 && full.receivePackConfigError === fsckError) settings.receivePackConfigError = fsckError;
|
|
58103
58252
|
const hooks = options.hooks;
|
|
58253
|
+
if ((options.host?.compatibility ?? hooks?.compatibility) === "2.43") settings.acknowledgeEveryHave = true;
|
|
58104
58254
|
if (options.packObjectsHook !== false && hooks) {
|
|
58105
58255
|
const hook = await packObjectsHookOf(hooks);
|
|
58106
58256
|
if (hook) settings.packObjectsHook = hook;
|
|
@@ -64979,4 +65129,4 @@ var WorktreeRepairCommand = class extends GitCommand {
|
|
|
64979
65129
|
}
|
|
64980
65130
|
};
|
|
64981
65131
|
//#endregion
|
|
64982
|
-
export { RefsMigrateCommand as $,
|
|
65132
|
+
export { RefsMigrateCommand as $, RemoteRenameCommand as $n, BackfillCommand as $r, RangeDiffError as $t, createSshVerifier as A, SubmoduleCommandBase as An, unsupportedPathspecMagic as Ar, LsRemoteCommand as At, RequestPullCommand as B, shellQuote as Bn, SetUpstreamBranchCommand as Br, HookRunCommand as Bt, StashShowCommand as C, ensureUtf8 as Ci, CloneCommand as Cn, CheckoutIndexCommand as Cr, NotesShowCommand as Ct, StashBranchCommand as D, splitMail as Di, RebaseOperation as Dn, CheckIgnoreCommand as Dr, MktagCommand as Dt, StashImportCommand as E, mailsplitFiles as Ei, RebaseCommand as En, CheckMailmapCommand as Er, MvCommand as Et, packObjectsHookOf as F, SubmoduleInitCommand as Fn, RemoteObjectInfoUnsupportedError as Fr, LastModifiedCommand as Ft, humaniseBytesCompact as G, ReinitializeHashError as Gn, CreateBranchCommand as Gr, FormatPatchCommand as Gt, RepoInfoCommand as H, RmCommand as Hn, EditBranchDescriptionCommand as Hr, HistoryRewordCommand as Ht, servedRepositoryOf as I, SubmoduleSetBranchCommand as In, DEFAULT_BATCH_FORMAT as Ir, LsFilesCommand as It, ReplaceCommand as J, SparseCheckoutCommand as Jn, RenameBranchCommand as Jr, RangeDiffCommand as Jt, humaniseCount as K, UnknownHashAlgorithmError as Kn, DeleteBranchCommand as Kr, FormatPatchError as Kt, RevertCommand as L, SubmoduleSetUrlCommand as Ln, expandBatchFormat as Lr, prefixedElement as Lt, ShowCommand as M, SubmoduleDeinitCommand as Mn, attributeWarningLine as Mr, LFS_DEFAULT_COMPATIBILITY as Mt, ShowBranchCommand as N, SubmoduleForeachCommand as Nn, CatFileCommand as Nr, LFS_URL_UNKNOWN as Nt, StashInfoCommand as O, mailinfo as Oi, SUBMODULE_UNSET_ENV as On, LsTreeCommand as Or, MergeTreeCommand as Ot, versionCmp as P, SubmoduleHeadMover as Pn, RemoteObjectInfoCommand as Pr, LfsConfig as Pt, RefsExistsCommand as Q, RemoteRemoveCommand as Qn, BlameCommand as Qr, RANGE_DIFF_MAX_MEMORY_DEFAULT as Qt, RestoreCommand as R, SubmoduleSyncCommand as Rn, parseBatchFormat as Rr, InterpretTrailersCommand as Rt, StashStoreCommand as S, AmCommand as Si, ConfigCommand as Sn, CherryCommand as Sr, NotesRemoveCommand as St, StashExportCommand as T, maildirFilenameCompare as Ti, SubmoduleUpdateCommand as Tn, checkRefFormat as Tr, NameRevCommand as Tt, RepoStructureCommand as U, InitCommand as Un, ShowCurrentBranchCommand as Ur, HistorySplitCommand as Ut, ShortlogCommand as V, submodule_commands_exports as Vn, UnsetUpstreamBranchCommand as Vr, HistoryCommandBase as Vt, gitRelativePath as W, InitOptionsError as Wn, CopyBranchCommand as Wr, FormatRevCommand as Wt, RemoteShowCommand as X, RemoteGetUrlCommand as Xn, ForEachRefCommand as Xr, CREATION_FACTOR_FOR_THE_SAME_SERIES as Xt, RemotePruneCommand as Y, RemoteAddCommand as Yn, DEFAULT_FOR_EACH_REF_FORMAT as Yr, rangeDiffNotesOptions as Yt, trackingSources as Z, RemoteListCommand as Zn, RefListingCommand as Zr, RANGE_DIFF_CREATION_FACTOR_DEFAULT as Zt, SwitchCommand as _, TarArchiveWriter as _i, DiffIndexCommand as _n, parseStrategyOptions as _r, NotesCopyCommand as _t, WorktreeUnlockCommand as a, ArchiveCommand as ai, readRangeDiffPatches as an, parseColumnLayout as ar, pushSucceeded as at, StripspaceCommand as b, Describer as bi, DescribeCommand as bn, fmtMergeMsgConfigOf as br, NotesListCommand as bt, VerifyTagCommand as c, dosTime as ci, FetchMultipleCommand as cn, CherryPickCommand as cr, PackRefsCommand as ct, UrlParseCommand as d, DEFAULT_GREP_COLORS as di, addRemoteOrGroup as dn, MergeOperation as dr, CountObjectsCommand as dt, getTarCommitId as ei, RangeDiffMemoryError as en, RemoteSetBranchesCommand as er, RefsVerifyCommand as et, UpdateIndexCommand as f, GrepEngine as fi, FastImportCommand as fn, UNMERGED_FILES_MESSAGE as fr, checkPackIndex as ft, TagCommand as g, grepPatternFile as gi, DiffFilesCommand as gn, applyStrategyOption as gr, NotesAppendCommand as gt, ListTagCommand as h, grepPattern as hi, DiffPairsCommand as hn, UnknownStrategyOptionError as hr, NotesAddCommand as ht, WorktreeLockCommand as i, uploadArchiveWriterOf as ii, parseRangeDiffMaxMemory as in, CleanCommand as ir, pushOutputText as it, createSshSigner as j, SubmoduleCommandError as jn, CheckAttrCommand as jr, LfsEndpointCommand as jt, StashDropCommand as k, mailsplit as ki, SubmoduleAbsorbGitDirsCommand as kn, parseElementMagic as kr, MergeBaseCommand as kt, GIT_VARIABLES as l, GrepCommand as li, MAX_GROUP_DEPTH as ln, SequencerOperation as lr, ShowIndexCommand as lt, DeleteTagCommand as m, bufferIsBinary as mi, marksFilesOf as mn, favorOf as mr, NotesMergeCommand as mt, WorktreeMoveCommand as n, applyArchiveArgs as ni, getCorrespondences as nn, RemoteSetUrlCommand as nr, PushCommand as nt, WorktreeAddCommand as o, INTERNAL_GZIP_COMMAND as oi, writeRangeDiff as on, printColumns as or, PullCommand as ot, UnpackObjectsCommand as p, GrepError as pi, FastExportCommand as pn, UNRELATED_HISTORIES_MESSAGE as pr, NotesCommands as pt, ReplayCommand as q, Git as qn, ListBranchCommand as qr, RangeDiffBase as qt, WorktreeRemoveCommand as r, runArchiveWriter as ri, humaniseBytes as rn, isValidRemoteName as rr, parsePushRecurseSubmodules as rt, VerifyCommitCommand as s, ZipArchiveWriter as si, computeAssignment as sn, runCleanInteractive as sr, PatchIdCommand as st, WorktreeRepairCommand as t, RemoteArchiveCommand as ti, findExactMatches as tn, RemoteSetHeadCommand as tr, ShowRefCommand as tt, VarCommand as u, grepNoIndex as ui, RemoteUpdateCommand as un, MergeCommand as ur, PruneCommand as ut, SubmoduleAddCommand as v, DESCRIBE_MAX_TAGS as vi, DiffPlumbingCommand as vn, DEFAULT_MERGE_LOG_LENGTH as vr, NotesEditCommand as vt, StashPopCommand as w, isMboxFromLine as wi, SubmoduleStatusCommand as wn, CheckRefFormatCommand as wr, NotesSubcommand as wt, commentLines as x, createDescriber as xi, daemonAccessHookOf as xn, CommitCommand as xr, NotesPruneCommand as xt, gitUrlBasename as y, DescribeDeath as yi, DiffTreeCommand as yn, FmtMergeMsgCommand as yr, NotesGetRefCommand as yt, RerereCommand as z, notFromUser as zn, unsupportedAtom as zr, HookListCommand as zt };
|