BulkOperationGitRepo
A git repo holding a vault, driven to wrap bulk operations in commits.
Import:
import { BulkOperationGitRepo } from '@mnaoumov/obsidian-lib/desktop-bulk-operation-git';Signature:
export class BulkOperationGitRepoConstructor
new BulkOperationGitRepo(params: BulkOperationGitRepoConstructorParams)Creates a new instance. Use BulkOperationGitRepo.open to find the repo of a folder.
Properties
| Property | Type | Description |
|---|---|---|
| gitDirectory | string | The absolute path of the repo's git directory. |
| workingDirectory | string | The absolute path of the folder whose changes are committed. |
Methods
| Method | Returns | Description |
|---|---|---|
| assertCanCommitLargeFiles() | Promise<void> | Refuses to go on when the repo routes files through git-annex but git-annex cannot be run, since a plain git add would then put the large files into git itself. |
| listBulkOperationCommits(pluginId) | Promise<BulkOperationCommit[]> | Lists the bulk-operation commits a plugin made on the current branch, newest first. |
| recoverStaleLock() | Promise<null | string> | Commits whatever a stale lock's operation left behind as OP<n> interrupted and removes the lock. |
| revertBulkOperationCommit(commit) | Promise<GitRevertResult> | Reverts a bulk-operation commit with git revert --no-edit.Whatever is pending is committed first, so the revert starts from a clean tree. A conflict is NOT aborted: the repo is left mid-revert for the user to resolve. |
| runBulkOperation(params) | Promise<GitBulkOperationResult<T>> | Runs a bulk operation between two commits. Takes the lease lock, commits whatever is pending as chore: before OP<n>, runs the operation, waits for its follow-ups to settle, commits the result as OP<n>: <summary> and releases the lock. An operation that throws still gets its partial changes committed, as OP<n> interrupted, before the error is rethrown.When the lock was recovered under the operation (it went stale, and another operation, the scheduled autocommit or a reload committed OP<n> interrupted and removed it), the rest is never committed under the recovered id: the lock is taken again and the rest is committed as a fresh OP<m> whose summary names OP<n>. |
| static open(workingDirectory) | Promise<BulkOperationGitRepo | null> | Finds the git repo a folder belongs to. |
Links to this page: