{"thread":{"id":"66980","subject":"[PATCH] ls-files: clarify what --error-unmatch matches","startedAt":"2026-12-03T13:41:16Z","lastAt":"2026-12-03T13:41:16Z","messageCount":1,"participants":["Christian Sagstetter"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"559970","messageId":"CAFsHQ-bMu=9X=j7m3rDm6y6Ax4hxN4vYV2eUoh1F9Lx5HebpVA@mail.gmail.com","threadId":"66980","inReplyTo":null,"subject":"[PATCH] ls-files: clarify what --error-unmatch matches","fromName":"Christian Sagstetter","fromEmail":"christian.sagstetter@gmail.com","sentAt":"2026-12-03T13:41:16Z","receivedAt":"2026-12-03T13:41:16Z","isPatch":true,"sender":{"key":"christian.sagstetter@gmail.com","avatar":null},"body":"The manual and short help describe --error-unmatch as a check for\nindex membership. With --others, an untracked file satisfies the\ncheck. With --modified, a tracked file with no unstaged changes\ncauses the command to exit with status 1.\n\nDescribe the check in terms of the paths selected by the other\noptions. Both cases are covered by t3005 and t3010.\n\nSigned-off-by: Christian Sagstetter <christian.sagstetter@gmail.com>\n---\n Documentation/git-ls-files.adoc | 5 +++--\n builtin/ls-files.c              | 2 +-\n 2 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-ls-files.adoc b/Documentation/git-ls-files.adoc\nindex 14ebad8b71..87b3b7f5e3 100644\n--- a/Documentation/git-ls-files.adoc\n+++ b/Documentation/git-ls-files.adoc\n@@ -129,8 +129,9 @@ OPTIONS\n \tin each directory, and the user's global exclusion file.\n\n --error-unmatch::\n-\tIf any <file> does not appear in the index, treat this as an\n-\terror (return 1).\n+\tIf any <file> argument matches no path selected by the other\n+\toptions, report an error and exit with status 1. For example,\n+\t`--others` checks for matches among untracked files.\n\n --with-tree=<tree-ish>::\n \tWhen using --error-unmatch to expand the user supplied\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex b044520f9e..af403b3f5e 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -651,7 +651,7 @@ int cmd_ls_files(int argc,\n \t\tOPT_BOOL(0, \"recurse-submodules\", &recurse_submodules,\n \t\t\tN_(\"recurse through submodules\")),\n \t\tOPT_BOOL(0, \"error-unmatch\", &error_unmatch,\n-\t\t\tN_(\"if any <file> is not in the index, treat this as an error\")),\n+\t\t\tN_(\"report an error if any pathspec matches no selected path\")),\n \t\tOPT_STRING(0, \"with-tree\", &with_tree, N_(\"tree-ish\"),\n \t\t\tN_(\"pretend that paths removed since <tree-ish> are still present\")),\n \t\tOPT__ABBREV(&abbrev),\n\nbase-commit: 566b6997dd4710b625c0882cf10a7443bf52d183\n-- \n2.53.0\n\n"}]}