{"thread":{"id":"3422","subject":"[PATCH] git-ls-files: Fix, document, and add test for --error-unmatch option.","startedAt":"2006-02-21T20:48:30Z","lastAt":"2006-02-22T01:59:31Z","messageCount":2,"participants":["Carl Worth","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"16520","messageId":"87vev8sajl.wl%cworth@cworth.org","threadId":"3422","inReplyTo":null,"subject":"[PATCH] git-ls-files: Fix, document, and add test for --error-unmatch option.","fromName":"Carl Worth","fromEmail":"cworth@cworth.org","sentAt":"2006-02-21T20:48:30Z","receivedAt":"2006-02-21T20:48:30Z","isPatch":true,"sender":{"key":"cworth@cworth.org","avatar":"https://gravatar.com/avatar/3746dc28cde609bdbd7f939058356e7e2bbd16d21e32274df0725eb3d998bc5b?d=mp&s=160"},"body":"---\n\n Junio,\n\n I'm still not sure what the easiest way is for me to provide changes\n to you. I've been doing it here on the list, like with the current\n message. But would it be easier for me to send pull requests?\n\n For example, with the git-clone failure cleanup I recently did, it\n seems the new test case I wrote didn't land in your tree. And since\n we went through patches in the mail, the missing commit wasn't\n obvious to me, (I checked and noticed with git-cherry, but it seems\n it would have been much easier if we were working with the same\n commit objects).\n\n If it would help you for me to publish a tree, just let me know how\n best to organize it, (I didn't see any comments on that in\n Documentation/SubmittingPatches).\n\n For now, I've made a tree available at:\n\n\tgit://git.freedesktop.org/~cworth/git\n\n It contains two branches of interest:\n\n\tls-files-error-unmatch\t# The patch in this mail\n\tclone-fail-cleanup\t# The missing test case mentioned above\n\n as well as the version I've currently got installed and am running:\n\n\tcworth\t\t\t# The merge of those two with master\n\n Let me know if any other organization would be more helpful, and how\n to best make pull requests if desired.\n\n Thanks,\n\n -Carl\n\n Documentation/git-ls-files.txt    |    5 +++++\n ls-files.c                        |    1 +\n t/t3020-ls-files-error-unmatch.sh |   27 +++++++++++++++++++++++++++\n 3 files changed, 33 insertions(+), 0 deletions(-)\n create mode 100755 t/t3020-ls-files-error-unmatch.sh\n\nd7e8e6b2bb34db12c4fc1e4f83810db50b7ddf69\ndiff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt\nindex fe53412..28dc533 100644\n--- a/Documentation/git-ls-files.txt\n+++ b/Documentation/git-ls-files.txt\n@@ -14,6 +14,7 @@ SYNOPSIS\n \t\t[-x <pattern>|--exclude=<pattern>]\n \t\t[-X <file>|--exclude-from=<file>]\n \t\t[--exclude-per-directory=<file>] \n+\t\t[--error-unmatch]\n \t\t[--full-name] [--] [<file>]\\*\n \n DESCRIPTION\n@@ -72,6 +73,10 @@ OPTIONS\n \tread additional exclude patterns that apply only to the\n \tdirectory and its subdirectories in <file>.\n \n+--error-unmatch::\n+\tIf any <file> does not appear in the index, treat this as an\n+\terror (return 1).\n+\n -t::\n \tIdentify the file status with the following tags (followed by\n \ta space) at the start of each line:\ndiff --git a/ls-files.c b/ls-files.c\nindex df93cf2..27059e2 100644\n--- a/ls-files.c\n+++ b/ls-files.c\n@@ -758,6 +758,7 @@ int main(int argc, const char **argv)\n \t\t\t\tcontinue;\n \t\t\terror(\"pathspec '%s' did not match any.\",\n \t\t\t      pathspec[num] + prefix_offset);\n+\t\t\terrors++;\n \t\t}\n \t\treturn errors ? 1 : 0;\n \t}\ndiff --git a/t/t3020-ls-files-error-unmatch.sh b/t/t3020-ls-files-error-unmatch.sh\nnew file mode 100755\nindex 0000000..d55559e\n--- /dev/null\n+++ b/t/t3020-ls-files-error-unmatch.sh\n@@ -0,0 +1,27 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2006 Carl D. Worth\n+#\n+\n+test_description='git-ls-files test for --error-unmatch option\n+\n+This test runs git-ls-files --error-unmatch to ensure it correctly\n+returns an error when a non-existent path is provided on the command\n+line.\n+'\n+. ./test-lib.sh\n+\n+touch foo bar\n+git-update-index --add foo bar\n+git-commit -m \"add foo bar\"\n+\n+test_expect_failure \\\n+    'git-ls-files --error-unmatch should fail with unmatched path.' \\\n+    'git-ls-files --error-unmatch foo bar-does-not-match'\n+\n+test_expect_success \\\n+    'git-ls-files --error-unmatch should succeed eith matched paths.' \\\n+    'git-ls-files --error-unmatch foo bar'\n+\n+test_done\n+1\n-- \n1.2.2.g73be-dirty\n\n"},{"id":"16557","messageId":"7vr75wtapo.fsf@assigned-by-dhcp.cox.net","threadId":"3422","inReplyTo":"87vev8sajl.wl%cworth@cworth.org","subject":"Re: [PATCH] git-ls-files: Fix, document, and add test for --error-unmatch option.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-22T01:59:31Z","receivedAt":"2006-02-22T01:59:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Carl Worth <cworth@cworth.org> writes:\n\n>  I'm still not sure what the easiest way is for me to provide changes\n>  to you. I've been doing it here on the list, like with the current\n>  message. But would it be easier for me to send pull requests?\n\nYou can decide what is easier for _you_ ;-).\n\nBut for me, emailed patches are easier to work on than pull\nrequests.  I will need to read and understand most of the\nchanges anyway, unless the change is to an isolated corner of\nthe system that would affect only one class of users and\nbreakage will be noticed either immediately or can be left\nbroken if nobody uses that (e.g. things like contrib/ and some\nforeign SCM interfaces).  I would like others on the list to be\nable to review the same changes that might hit my tree and\nprovide extra sets of eyeballs to spot things I might miss\nmyself alone.\n\n>  For example, with the git-clone failure cleanup I recently did, it\n>  seems the new test case I wrote didn't land in your tree.\n\nSorry, I think I just forgot to apply that one.  I still have\nthe message so no need to resend.  Thanks for reminding.\n"}]}