commit 1e022131972893d7b4aa0052ffcd882f3052d24b from: Stefan Sperling date: Sun May 25 16:22:15 2025 UTC ignore arbitrary amounts of leading slashes in ignore patterns, not just one commit - 6ae2855c45508b25adb202d57dd345da8500b7bb commit + 1e022131972893d7b4aa0052ffcd882f3052d24b blob - 4e690714aa90a9b5159147f65bf8292f5ed4c327 blob + d089bc9ca0d1abc94a4a52d9c1aaa70f7b02ef28 --- lib/worktree.c +++ lib/worktree.c @@ -3817,9 +3817,9 @@ match_path(const char *pattern, size_t pattern_len, co size_t len = pattern_len; /* - * For gitignore(7) compatibility, ignore leading slashes + * For gitignore(5) compatibility, ignore leading slashes. */ - if (len > 0 && pat[0] == '/') { + while (len > 0 && pat[0] == '/') { pat++; len--; } blob - 5e57f89a8f3c5c4f999f1f0bd918335e63d74fb7 blob + 0874b88152ef2725e3b0e312b01cda5d76c37b91 --- regress/cmdline/status.sh +++ regress/cmdline/status.sh @@ -736,7 +736,7 @@ test_status_gitignore_leading_slashes() { echo "unversioned file" > $testroot/wt/epsilon/nu/baz echo "/foo" > $testroot/wt/.gitignore - echo "/nu" >> $testroot/wt/.gitignore + echo "//////////////////////////nu" >> $testroot/wt/.gitignore echo '? .gitignore' > $testroot/stdout.expected echo '? epsilon/bar' >> $testroot/stdout.expected