From adee9653e8788fdd3bf4073806ad9174f91825c7 Mon Sep 17 00:00:00 2001 From: Philipp Weiler Date: Tue, 8 Sep 2026 15:03:38 -0400 Subject: [PATCH] fix: resolve wrong merge base in readme-index sync `git show HEAD:"$README"` resolves paths relative to the repo root, not the script's cwd, when given without a leading `./`. The sync-readme-to-index hook always runs from the generated project's own directory, so this fetched the outer template's root README.md as the merge base instead of the project's README.md, corrupting notebooks/index.md with spurious conflict markers on any nontrivial edit. Prefix the path with `./` so the lookup resolves relative to cwd instead of the repo root. --- {{ cookiecutter.project_name }}/.sync_readme_to_index.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.project_name }}/.sync_readme_to_index.sh b/{{ cookiecutter.project_name }}/.sync_readme_to_index.sh index bfddc5a..037a78c 100755 --- a/{{ cookiecutter.project_name }}/.sync_readme_to_index.sh +++ b/{{ cookiecutter.project_name }}/.sync_readme_to_index.sh @@ -4,7 +4,7 @@ README="README.md" INDEX="notebooks/index.md" BASE="$(mktemp)" trap 'rm -f "$BASE"' EXIT -if git show HEAD:"$README" > "$BASE" 2>/dev/null; then +if git show HEAD:"./$README" > "$BASE" 2>/dev/null; then git merge-file --diff3 "$INDEX" "$BASE" "$README" else cp "$README" "$INDEX"