es-git 0.5.0-next.166 → 0.5.0-next.167

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +54 -0
  2. package/index.js +1 -0
  3. package/package.json +11 -11
package/index.d.ts CHANGED
@@ -2640,6 +2640,43 @@ export declare class Repository {
2640
2640
  * @returns An Annotated Commit created from `FETCH_HEAD`.
2641
2641
  */
2642
2642
  getAnnotatedCommitFromFetchHead(branchName: string, remoteUrl: string, id: string): AnnotatedCommit
2643
+ /**
2644
+ * Apply a Diff to the given repo, making changes directly in the working directory, the index, or both.
2645
+ *
2646
+ * @category Repository/Methods
2647
+ * ```ts
2648
+ * class Repository {
2649
+ * apply(diff: Diff, location: ApplyLocation, options?: ApplyOptions | null | undefined): void;
2650
+ * }
2651
+ * ```
2652
+ *
2653
+ * @param {Diff} diff - The diff to apply
2654
+ * @param {ApplyLocation} location - The location to apply
2655
+ * @param {ApplyOptions} [options] - The options for the apply
2656
+ */
2657
+ apply(diff: Diff, location: ApplyLocation, options?: ApplyOptions | undefined | null): void
2658
+ /**
2659
+ * Apply a Diff to the provided tree, and return the resulting Index.
2660
+ *
2661
+ * @category Repository/Methods
2662
+ * @signature
2663
+ * ```ts
2664
+ * class Repository {
2665
+ * applyToTree(
2666
+ * tree: Tree,
2667
+ * diff: Diff,
2668
+ * options?: ApplyOptions | null | undefined
2669
+ * ): Index;
2670
+ * }
2671
+ * ```
2672
+ *
2673
+ * @param {Tree} tree - The tree to apply the diff to
2674
+ * @param {Diff} diff - The diff to apply
2675
+ * @param {ApplyOptions} [options] - The options for the apply
2676
+ *
2677
+ * @returns The postimage of the application
2678
+ */
2679
+ applyToTree(tree: Tree, diff: Diff, options?: ApplyOptions | undefined | null): Index
2643
2680
  /**
2644
2681
  * Creates a blame object for the file at the given path
2645
2682
  *
@@ -5673,6 +5710,23 @@ export interface AmendOptions {
5673
5710
  messageEncoding?: string
5674
5711
  }
5675
5712
 
5713
+ /**
5714
+ * Possible application locations for git_apply
5715
+ * see <https://libgit2.org/libgit2/#HEAD/type/git_apply_options>
5716
+ */
5717
+ export type ApplyLocation = /** Apply the patch to the workdir */
5718
+ 'WorkDir'|
5719
+ /** Apply the patch to the index */
5720
+ 'Index'|
5721
+ /** Apply the patch to both the working directory and the index */
5722
+ 'Both';
5723
+
5724
+ /** Options to specify when applying a diff */
5725
+ export interface ApplyOptions {
5726
+ /** Don't actually make changes, just test that the patch applies. */
5727
+ check?: boolean
5728
+ }
5729
+
5676
5730
  /**
5677
5731
  * - `Unspecified` : Use the setting from the remote's configuration
5678
5732
  * - `Auto` : Ask the server for tags pointing to objects we're already downloading
package/index.js CHANGED
@@ -609,6 +609,7 @@ module.exports.Tag = nativeBinding.Tag
609
609
  module.exports.Tree = nativeBinding.Tree
610
610
  module.exports.TreeEntry = nativeBinding.TreeEntry
611
611
  module.exports.TreeIter = nativeBinding.TreeIter
612
+ module.exports.ApplyLocation = nativeBinding.ApplyLocation
612
613
  module.exports.AutotagOption = nativeBinding.AutotagOption
613
614
  module.exports.BranchType = nativeBinding.BranchType
614
615
  module.exports.cloneRepository = nativeBinding.cloneRepository
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-git",
3
- "version": "0.5.0-next.166+44a2a2d",
3
+ "version": "0.5.0-next.167+3d819b8",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -54,15 +54,15 @@
54
54
  "vitest": "^3.0.5"
55
55
  },
56
56
  "optionalDependencies": {
57
- "es-git-darwin-x64": "0.5.0-next.166+44a2a2d",
58
- "es-git-darwin-arm64": "0.5.0-next.166+44a2a2d",
59
- "es-git-win32-x64-msvc": "0.5.0-next.166+44a2a2d",
60
- "es-git-win32-arm64-msvc": "0.5.0-next.166+44a2a2d",
61
- "es-git-linux-x64-gnu": "0.5.0-next.166+44a2a2d",
62
- "es-git-linux-x64-musl": "0.5.0-next.166+44a2a2d",
63
- "es-git-android-arm64": "0.5.0-next.166+44a2a2d",
64
- "es-git-linux-arm64-gnu": "0.5.0-next.166+44a2a2d",
65
- "es-git-linux-arm64-musl": "0.5.0-next.166+44a2a2d",
66
- "es-git-android-arm-eabi": "0.5.0-next.166+44a2a2d"
57
+ "es-git-darwin-x64": "0.5.0-next.167+3d819b8",
58
+ "es-git-darwin-arm64": "0.5.0-next.167+3d819b8",
59
+ "es-git-win32-x64-msvc": "0.5.0-next.167+3d819b8",
60
+ "es-git-win32-arm64-msvc": "0.5.0-next.167+3d819b8",
61
+ "es-git-linux-x64-gnu": "0.5.0-next.167+3d819b8",
62
+ "es-git-linux-x64-musl": "0.5.0-next.167+3d819b8",
63
+ "es-git-android-arm64": "0.5.0-next.167+3d819b8",
64
+ "es-git-linux-arm64-gnu": "0.5.0-next.167+3d819b8",
65
+ "es-git-linux-arm64-musl": "0.5.0-next.167+3d819b8",
66
+ "es-git-android-arm-eabi": "0.5.0-next.167+3d819b8"
67
67
  }
68
68
  }