@aspruyt/xfg 1.10.4 → 1.10.5

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/git-ops.d.ts CHANGED
@@ -26,6 +26,13 @@ export declare class GitOps {
26
26
  private validatePath;
27
27
  cleanWorkspace(): void;
28
28
  clone(gitUrl: string): Promise<void>;
29
+ /**
30
+ * Fetch from remote with optional pruning of stale refs.
31
+ * Used to update local tracking refs after remote branch deletion.
32
+ */
33
+ fetch(options?: {
34
+ prune?: boolean;
35
+ }): Promise<void>;
29
36
  /**
30
37
  * Create a new branch from the current HEAD.
31
38
  * Always creates fresh - existing branches should be cleaned up beforehand
package/dist/git-ops.js CHANGED
@@ -51,6 +51,14 @@ export class GitOps {
51
51
  async clone(gitUrl) {
52
52
  await this.execWithRetry(`git clone ${escapeShellArg(gitUrl)} .`, this.workDir);
53
53
  }
54
+ /**
55
+ * Fetch from remote with optional pruning of stale refs.
56
+ * Used to update local tracking refs after remote branch deletion.
57
+ */
58
+ async fetch(options) {
59
+ const pruneFlag = options?.prune ? " --prune" : "";
60
+ await this.execWithRetry(`git fetch origin${pruneFlag}`, this.workDir);
61
+ }
54
62
  /**
55
63
  * Create a new branch from the current HEAD.
56
64
  * Always creates fresh - existing branches should be cleaned up beforehand
@@ -74,6 +74,9 @@ export class RepositoryProcessor {
74
74
  });
75
75
  if (closed) {
76
76
  this.log.info("Closed existing PR and deleted branch for fresh sync");
77
+ // Prune stale remote tracking refs so --force-with-lease works correctly
78
+ // The remote branch was deleted but local git still has tracking info
79
+ await this.gitOps.fetch({ prune: true });
77
80
  }
78
81
  }
79
82
  // Step 4: Create branch (always fresh from base branch)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aspruyt/xfg",
3
- "version": "1.10.4",
3
+ "version": "1.10.5",
4
4
  "description": "CLI tool to sync JSON, JSON5, YAML, or text configuration files across multiple Git repositories via pull requests or direct push",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",