dotmd-cli 0.71.1 → 0.71.2

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/git.mjs +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotmd-cli",
3
- "version": "0.71.1",
3
+ "version": "0.71.2",
4
4
  "description": "CLI for managing markdown documents with YAML frontmatter — index, query, validate, graph, export, lifecycle, and AI summaries.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/git.mjs CHANGED
@@ -596,7 +596,17 @@ function prepareMoveIndex(source, target, repoRoot, before, options = {}) {
596
596
  }
597
597
  testHooks.beforeGitIndexPrepare?.({ preparedPath, before, prepared: seed });
598
598
  const env = { ...process.env, GIT_INDEX_FILE: preparedPath };
599
- const result = spawnSync('git', ['add', '-A', '--', paths[1]], {
599
+ // A tracked source relocating into an ignored destination is exactly what
600
+ // `git mv` permits: ignore patterns govern NEW untracked paths, not the
601
+ // relocation of content git already tracks. Bare `git add` doesn't make that
602
+ // distinction and refuses ("paths are ignored by one of your .gitignore
603
+ // files"), which failed the whole transaction and rolled the move back — so
604
+ // `dotmd archive` was unusable in any repo that gitignores its docs root
605
+ // while force-tracking the docs inside it. Force only when the source was
606
+ // tracked; an untracked source stays subject to the ignore.
607
+ const sourceTracked = isTracked(paths[0], repoRoot);
608
+ const addArgs = sourceTracked ? ['add', '-f', '-A', '--', paths[1]] : ['add', '-A', '--', paths[1]];
609
+ const result = spawnSync('git', addArgs, {
600
610
  cwd: repoRoot,
601
611
  encoding: 'utf8',
602
612
  env,