@moberg_hr/work-tree 1.15.0 → 1.16.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/wd-bin.js CHANGED
@@ -7322,13 +7322,45 @@ function writeTempTree(repoRoot, opts = {}) {
7322
7322
  windowsHide: true,
7323
7323
  maxBuffer: 64 * 1024 * 1024
7324
7324
  });
7325
+ const seedFromRealIndex = () => {
7326
+ try {
7327
+ const out = spawn8.sync("git", ["rev-parse", "--git-path", "index"], {
7328
+ cwd: repoRoot,
7329
+ encoding: "utf-8",
7330
+ windowsHide: true
7331
+ }).stdout;
7332
+ if (!out) return false;
7333
+ const realIndex = path23.resolve(repoRoot, out.trim());
7334
+ if (!fs27.existsSync(realIndex)) return false;
7335
+ fs27.copyFileSync(realIndex, tmpIndex);
7336
+ const st = fs27.statSync(realIndex);
7337
+ fs27.utimesSync(tmpIndex, st.atime, st.mtime);
7338
+ const listed = run2(["ls-files", "-v"]);
7339
+ if (listed.status !== 0) {
7340
+ fs27.unlinkSync(tmpIndex);
7341
+ return false;
7342
+ }
7343
+ const flagged = (listed.stdout ?? "").split("\n").some((line) => {
7344
+ const tag2 = line.charAt(0);
7345
+ return tag2 === "S" || tag2 >= "a" && tag2 <= "z";
7346
+ });
7347
+ if (flagged) {
7348
+ fs27.unlinkSync(tmpIndex);
7349
+ return false;
7350
+ }
7351
+ return true;
7352
+ } catch {
7353
+ return false;
7354
+ }
7355
+ };
7325
7356
  try {
7326
7357
  const headSha = (spawn8.sync("git", ["rev-parse", "--verify", "HEAD"], {
7327
7358
  cwd: repoRoot,
7328
7359
  encoding: "utf-8",
7329
7360
  windowsHide: true
7330
7361
  }).stdout ?? "").trim() || null;
7331
- if (headSha) {
7362
+ const seeded = includeWorkingTree && seedFromRealIndex();
7363
+ if (!seeded && headSha) {
7332
7364
  const r = run2(["read-tree", "HEAD"]);
7333
7365
  if (r.status !== 0) return null;
7334
7366
  }
@@ -11794,7 +11826,7 @@ function completeGroupBranches(groupName, repoAliases, current, config, done) {
11794
11826
  }
11795
11827
 
11796
11828
  // src/version.ts
11797
- var VERSION = true ? "1.15.0" : "dev";
11829
+ var VERSION = true ? "1.16.0" : "dev";
11798
11830
 
11799
11831
  // src/cli.ts
11800
11832
  function showHelp() {