{"thread":{"id":"7668","subject":"[PATCH] Add -q option to \"git rm\" to suppress output when there aren't errors.","startedAt":"2007-04-16T00:04:08Z","lastAt":"2007-04-16T18:29:41Z","messageCount":14,"participants":["Steven Grimm","Junio C Hamano","Alex Riesen","Jeff King","Josef Weidendorfer"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"39432","messageId":"20070416000408.GA19107@midwinter.com","threadId":"7668","inReplyTo":null,"subject":"[PATCH] Add -q option to \"git rm\" to suppress output when there aren't errors.","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2007-04-16T00:04:08Z","receivedAt":"2007-04-16T00:04:08Z","isPatch":true,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"This suppresses the output of \"rm\" commands, and also exits with a zero\nexit code when no files match.  This allows \"git rm\" (and more importantly,\n\"git rm -r\") to be used as an index filter with cg-admin-rewritehist.\n\nSigned-off-by: Steven Grimm <koreth@midwinter.com>\n---\n Documentation/git-rm.txt |    4 ++++\n builtin-rm.c             |   26 ++++++++++++++++++++------\n t/t3600-rm.sh            |   28 ++++++++++++++++++++++++++++\n 3 files changed, 52 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt\nindex 6feebc0..c354134 100644\n--- a/Documentation/git-rm.txt\n+++ b/Documentation/git-rm.txt\n@@ -33,6 +33,10 @@ OPTIONS\n         Don't actually remove the file(s), just show if they exist in\n         the index.\n \n+-q::\n+\tDon't output the names of the files being removed, and exit\n+\twith a zero status even if no files matched.\n+\n -r::\n         Allow recursive removal when a leading directory name is\n         given.\ndiff --git a/builtin-rm.c b/builtin-rm.c\nindex 8a0738f..3d438de 100644\n--- a/builtin-rm.c\n+++ b/builtin-rm.c\n@@ -10,7 +10,7 @@\n #include \"tree-walk.h\"\n \n static const char builtin_rm_usage[] =\n-\"git-rm [-f] [-n] [-r] [--cached] [--] <file>...\";\n+\"git-rm [-f] [-n] [-q] [-r] [--cached] [--] <file>...\";\n \n static struct {\n \tint nr, alloc;\n@@ -104,7 +104,7 @@ static struct lock_file lock_file;\n int cmd_rm(int argc, const char **argv, const char *prefix)\n {\n \tint i, newfd;\n-\tint show_only = 0, force = 0, index_only = 0, recursive = 0;\n+\tint show_only = 0, force = 0, index_only = 0, recursive = 0, quiet = 0;\n \tconst char **pathspec;\n \tchar *seen;\n \n@@ -130,6 +130,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \t\t\tindex_only = 1;\n \t\telse if (!strcmp(arg, \"-f\"))\n \t\t\tforce = 1;\n+\t\telse if (!strcmp(arg, \"-q\"))\n+\t\t\tquiet = 1;\n \t\telse if (!strcmp(arg, \"-r\"))\n \t\t\trecursive = 1;\n \t\telse\n@@ -153,14 +155,24 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \n \tif (pathspec) {\n \t\tconst char *match;\n+\t\tint seen_any = 0;\n \t\tfor (i = 0; (match = pathspec[i]) != NULL ; i++) {\n-\t\t\tif (!seen[i])\n-\t\t\t\tdie(\"pathspec '%s' did not match any files\",\n-\t\t\t\t    match);\n+\t\t\tif (!seen[i]) {\n+\t\t\t\tif (! quiet) {\n+\t\t\t\t\tdie(\"pathspec '%s' did not match any files\",\n+\t\t\t\t\t    match);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t\tseen_any = 1;\n+\t\t\t}\n \t\t\tif (!recursive && seen[i] == MATCHED_RECURSIVELY)\n \t\t\t\tdie(\"not removing '%s' recursively without -r\",\n \t\t\t\t    *match ? match : \".\");\n \t\t}\n+\n+\t\tif (! seen_any)\n+\t\t\texit(0);\n \t}\n \n \t/*\n@@ -187,7 +199,9 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \t */\n \tfor (i = 0; i < list.nr; i++) {\n \t\tconst char *path = list.name[i];\n-\t\tprintf(\"rm '%s'\\n\", path);\n+\t\tif (!quiet) {\n+\t\t\tprintf(\"rm '%s'\\n\", path);\n+\t\t}\n \n \t\tif (remove_file_from_cache(path))\n \t\t\tdie(\"git-rm: unable to remove %s\", path);\ndiff --git a/t/t3600-rm.sh b/t/t3600-rm.sh\nindex e31cf93..bd72feb 100755\n--- a/t/t3600-rm.sh\n+++ b/t/t3600-rm.sh\n@@ -84,6 +84,30 @@ test_expect_success \\\n     'When the rm in \"git-rm -f\" fails, it should not remove the file from the index' \\\n     'git-ls-files --error-unmatch baz'\n \n+test_expect_success 'Remove nonexistent file with -q returns zero exit status' '\n+\tgit rm -q nonexistent\n+'\n+\n+test_expect_success '\"rm\" command printed' '\n+\techo frotz > test-file &&\n+\tgit add test-file &&\n+\tgit commit -m \"add file for rm test\" &&\n+\tgit rm test-file > rm-output &&\n+\ttest `egrep \"^rm \" rm-output | wc -l` = 1 &&\n+\trm -f test-file rm-output &&\n+\tgit commit -m \"remove file from rm test\"\n+'\n+\n+test_expect_success '\"rm\" command suppressed with -q' '\n+\techo frotz > test-file &&\n+\tgit add test-file &&\n+\tgit commit -m \"add file for rm -q test\" &&\n+\tgit rm -q test-file > rm-output &&\n+\ttest `wc -l < rm-output` = 0 &&\n+\trm -f test-file rm-output &&\n+\tgit commit -m \"remove file from rm test\"\n+'\n+\n # Now, failure cases.\n test_expect_success 'Re-add foo and baz' '\n \tgit add foo baz &&\n@@ -154,4 +178,8 @@ test_expect_success 'Recursive with -r -f' '\n \t! test -d frotz\n '\n \n+test_expect_failure 'Remove nonexistent file returns nonzero exit status' '\n+\tgit rm nonexistent\n+'\n+\n test_done\n-- \n1.5.1.1.99.g0ea98\n"},{"id":"39435","messageId":"7v4pnh18hr.fsf@assigned-by-dhcp.cox.net","threadId":"7668","inReplyTo":"20070416000408.GA19107@midwinter.com","subject":"Re: [PATCH] Add -q option to \"git rm\" to suppress output when there aren't errors.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-16T00:13:52Z","receivedAt":"2007-04-16T00:13:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Steven Grimm <koreth@midwinter.com> writes:\n\n> +-q::\n> +\tDon't output the names of the files being removed, and exit\n> +\twith a zero status even if no files matched.\n> +\n\nSuppressing output is understandable and probably is a useful\nthing to do, but I do not see a justification to tie that\nquietness to making the status unuable...\n"},{"id":"39436","messageId":"4622C0AC.8090904@midwinter.com","threadId":"7668","inReplyTo":"7v4pnh18hr.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Add -q option to \"git rm\" to suppress output when there aren't errors.","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2007-04-16T00:17:48Z","receivedAt":"2007-04-16T00:17:48Z","isPatch":true,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Suppressing output is understandable and probably is a useful\n> thing to do, but I do not see a justification to tie that\n> quietness to making the status unuable...\n>   \n\nThe status is unusable as is, actually, for the particular use case of \ncg-admin-rewritehist. If you try to use git-rm as an index filter, \ncg-admin-rewritehist will stop running as soon as you hit a revision \nthat doesn't contain the file you're looking to filter out. (If the file \ndoesn't exist in the first revision in your repo, that means it will do \nno work at all.)\n\nMy justification was that the \"-f\" option to the normal UNIX \"rm\" \ncommand does the same thing: it suppresses output and causes the command \nto exit with a zero status code even if no files match. But \"git rm -f\" \nwas already taken.\n\nIf you like I'll be happy to split it into two separate options.\n\n-Steve\n"},{"id":"39437","messageId":"7vps65yvc1.fsf@assigned-by-dhcp.cox.net","threadId":"7668","inReplyTo":"4622C0AC.8090904@midwinter.com","subject":"Re: [PATCH] Add -q option to \"git rm\" to suppress output when there aren't errors.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-16T01:14:06Z","receivedAt":"2007-04-16T01:14:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Steven Grimm <koreth@midwinter.com> writes:\n\n> Junio C Hamano wrote:\n>\n>> Suppressing output is understandable and probably is a useful\n>> thing to do, but I do not see a justification to tie that\n>> quietness to making the status unuable...\n>\n> The status is unusable as is, actually, for the particular use case of\n> cg-admin-rewritehist. If you try to use git-rm as an index filter,\n> cg-admin-rewritehist will stop running as soon as you hit a revision\n> that doesn't contain the file you're looking to filter out. (If the\n> file doesn't exist in the first revision in your repo, that means it\n> will do no work at all.)\n\nProbably \"git-grep foo\" wouldn't be suitable as the index filter\nfor admin-rewritehist, either, nor \"git-fsck\", nor many other\nthings.\n\nWhat does it have to do with anything?\n\nSaying \"git rm --quiet foo\" from the command line, wishing to\nsupress the output, is very understandable.\n\nSaying \"git rm --ignore-unmatch foo bar baz\", wishing to remove\nbar (which exists) even when foo does not exist, is also very\nunderstandable.\n\nI think they are pretty much independent options.\n"},{"id":"39484","messageId":"20070416074648.GA18719@midwinter.com","threadId":"7668","inReplyTo":"7vps65yvc1.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH 1/2] Add --quiet option to suppress output of \"rm\" commands for removed files.","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2007-04-16T07:46:48Z","receivedAt":"2007-04-16T07:46:48Z","isPatch":true,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"Signed-off-by: Steven Grimm <koreth@midwinter.com>\n---\n\nSplitting this into two different options (and two patches) per Junio's\ncomments.\n\n Documentation/git-rm.txt |    4 ++++\n builtin-rm.c             |   10 +++++++---\n t/t3600-rm.sh            |   24 ++++++++++++++++++++++++\n 3 files changed, 35 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt\nindex 6feebc0..b051ccb 100644\n--- a/Documentation/git-rm.txt\n+++ b/Documentation/git-rm.txt\n@@ -47,6 +47,10 @@ OPTIONS\n \tthe paths only from the index, leaving working tree\n \tfiles.\n \n+\\--quiet::\n+\tgit-rm normally outputs one line (in the form of an \"rm\" command)\n+\tfor each file removed. This option suppresses that output.\n+\n \n DISCUSSION\n ----------\ndiff --git a/builtin-rm.c b/builtin-rm.c\nindex 8a0738f..7eb9a42 100644\n--- a/builtin-rm.c\n+++ b/builtin-rm.c\n@@ -10,7 +10,7 @@\n #include \"tree-walk.h\"\n \n static const char builtin_rm_usage[] =\n-\"git-rm [-f] [-n] [-r] [--cached] [--] <file>...\";\n+\"git-rm [-f] [-n] [-r] [--cached] [--quiet] [--] <file>...\";\n \n static struct {\n \tint nr, alloc;\n@@ -104,7 +104,7 @@ static struct lock_file lock_file;\n int cmd_rm(int argc, const char **argv, const char *prefix)\n {\n \tint i, newfd;\n-\tint show_only = 0, force = 0, index_only = 0, recursive = 0;\n+\tint show_only = 0, force = 0, index_only = 0, recursive = 0, quiet = 0;\n \tconst char **pathspec;\n \tchar *seen;\n \n@@ -132,6 +132,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \t\t\tforce = 1;\n \t\telse if (!strcmp(arg, \"-r\"))\n \t\t\trecursive = 1;\n+\t\telse if (!strcmp(arg, \"--quiet\"))\n+\t\t\tquiet = 1;\n \t\telse\n \t\t\tusage(builtin_rm_usage);\n \t}\n@@ -187,7 +189,9 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \t */\n \tfor (i = 0; i < list.nr; i++) {\n \t\tconst char *path = list.name[i];\n-\t\tprintf(\"rm '%s'\\n\", path);\n+\t\tif (!quiet) {\n+\t\t\tprintf(\"rm '%s'\\n\", path);\n+\t\t}\n \n \t\tif (remove_file_from_cache(path))\n \t\t\tdie(\"git-rm: unable to remove %s\", path);\ndiff --git a/t/t3600-rm.sh b/t/t3600-rm.sh\nindex e31cf93..da9da92 100755\n--- a/t/t3600-rm.sh\n+++ b/t/t3600-rm.sh\n@@ -84,6 +84,26 @@ test_expect_success \\\n     'When the rm in \"git-rm -f\" fails, it should not remove the file from the index' \\\n     'git-ls-files --error-unmatch baz'\n \n+test_expect_success '\"rm\" command printed' '\n+\techo frotz > test-file &&\n+\tgit add test-file &&\n+\tgit commit -m \"add file for rm test\" &&\n+\tgit rm test-file > rm-output &&\n+\ttest `egrep \"^rm \" rm-output | wc -l` = 1 &&\n+\trm -f test-file rm-output &&\n+\tgit commit -m \"remove file from rm test\"\n+'\n+\n+test_expect_success '\"rm\" command suppressed with --quiet' '\n+\techo frotz > test-file &&\n+\tgit add test-file &&\n+\tgit commit -m \"add file for rm --quiet test\" &&\n+\tgit rm --quiet test-file > rm-output &&\n+\ttest `wc -l < rm-output` = 0 &&\n+\trm -f test-file rm-output &&\n+\tgit commit -m \"remove file from rm --quiet test\"\n+'\n+\n # Now, failure cases.\n test_expect_success 'Re-add foo and baz' '\n \tgit add foo baz &&\n@@ -154,4 +174,8 @@ test_expect_success 'Recursive with -r -f' '\n \t! test -d frotz\n '\n \n+test_expect_failure 'Remove nonexistent file returns nonzero exit status' '\n+\tgit rm nonexistent\n+'\n+\n test_done\n-- \n1.5.1.1.99.g0ea98\n"},{"id":"39487","messageId":"20070416075324.GA18961@midwinter.com","threadId":"7668","inReplyTo":"20070416074648.GA18719@midwinter.com","subject":"[PATCH 2/2] Add --ignore-notfound option to exit with zero status when no files are removed.","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2007-04-16T07:53:24Z","receivedAt":"2007-04-16T07:53:24Z","isPatch":true,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"Signed-off-by: Steven Grimm <koreth@midwinter.com>\n---\n\nThis allows \"git rm -r --ignore-notfound\" to be used as an index filter\nwith cg-admin-rewritehist. The documentation for that command recommends\nusing git-update-index --remove to filter files out of a tree's history,\nbut that doesn't support recursive deletion like git-rm does, making it\nless convenient to filter directories from history.\n\n Documentation/git-rm.txt |    3 +++\n builtin-rm.c             |   21 +++++++++++++++++----\n t/t3600-rm.sh            |    4 ++++\n 3 files changed, 24 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt\nindex b051ccb..9ffb515 100644\n--- a/Documentation/git-rm.txt\n+++ b/Documentation/git-rm.txt\n@@ -47,6 +47,9 @@ OPTIONS\n \tthe paths only from the index, leaving working tree\n \tfiles.\n \n+\\--ignore-notfound::\n+\tExit with a zero status even if no files matched.\n+\n \\--quiet::\n \tgit-rm normally outputs one line (in the form of an \"rm\" command)\n \tfor each file removed. This option suppresses that output.\ndiff --git a/builtin-rm.c b/builtin-rm.c\nindex 7eb9a42..71166fb 100644\n--- a/builtin-rm.c\n+++ b/builtin-rm.c\n@@ -10,7 +10,7 @@\n #include \"tree-walk.h\"\n \n static const char builtin_rm_usage[] =\n-\"git-rm [-f] [-n] [-r] [--cached] [--quiet] [--] <file>...\";\n+\"git-rm [-f] [-n] [-r] [--cached] [--ignore-notfound] [--quiet] [--] <file>...\";\n \n static struct {\n \tint nr, alloc;\n@@ -105,6 +105,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n {\n \tint i, newfd;\n \tint show_only = 0, force = 0, index_only = 0, recursive = 0, quiet = 0;\n+\tint ignore_notfound = 0;\n \tconst char **pathspec;\n \tchar *seen;\n \n@@ -134,6 +135,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \t\t\trecursive = 1;\n \t\telse if (!strcmp(arg, \"--quiet\"))\n \t\t\tquiet = 1;\n+\t\telse if (!strcmp(arg, \"--ignore-notfound\"))\n+\t\t\tignore_notfound = 1;\n \t\telse\n \t\t\tusage(builtin_rm_usage);\n \t}\n@@ -155,14 +158,24 @@ int cmd_rm(int argc, const char **argv, const char *prefix)\n \n \tif (pathspec) {\n \t\tconst char *match;\n+\t\tint seen_any = 0;\n \t\tfor (i = 0; (match = pathspec[i]) != NULL ; i++) {\n-\t\t\tif (!seen[i])\n-\t\t\t\tdie(\"pathspec '%s' did not match any files\",\n-\t\t\t\t    match);\n+\t\t\tif (!seen[i]) {\n+\t\t\t\tif (!ignore_notfound) {\n+\t\t\t\t\tdie(\"pathspec '%s' did not match any files\",\n+\t\t\t\t\t    match);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t\tseen_any = 1;\n+\t\t\t}\n \t\t\tif (!recursive && seen[i] == MATCHED_RECURSIVELY)\n \t\t\t\tdie(\"not removing '%s' recursively without -r\",\n \t\t\t\t    *match ? match : \".\");\n \t\t}\n+\n+\t\tif (! seen_any)\n+\t\t\texit(0);\n \t}\n \n \t/*\ndiff --git a/t/t3600-rm.sh b/t/t3600-rm.sh\nindex da9da92..665b8b0 100755\n--- a/t/t3600-rm.sh\n+++ b/t/t3600-rm.sh\n@@ -84,6 +84,10 @@ test_expect_success \\\n     'When the rm in \"git-rm -f\" fails, it should not remove the file from the index' \\\n     'git-ls-files --error-unmatch baz'\n \n+test_expect_success 'Remove nonexistent file with --ignore-notfound' '\n+\tgit rm --ignore-notfound nonexistent\n+'\n+\n test_expect_success '\"rm\" command printed' '\n \techo frotz > test-file &&\n \tgit add test-file &&\n-- \n1.5.1.1.99.g0ea98\n"},{"id":"39489","messageId":"81b0412b0704160054gd31f5aak961de15dbcba3956@mail.gmail.com","threadId":"7668","inReplyTo":"7vps65yvc1.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Add -q option to \"git rm\" to suppress output when there aren't errors.","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-04-16T07:54:43Z","receivedAt":"2007-04-16T07:54:43Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 4/16/07, Junio C Hamano <junkio@cox.net> wrote:\n> What does it have to do with anything?\n>\n> Saying \"git rm --quiet foo\" from the command line, wishing to\n> supress the output, is very understandable.\n>\n> Saying \"git rm --ignore-unmatch foo bar baz\", wishing to remove\n> bar (which exists) even when foo does not exist, is also very\n> understandable.\n\nHow about doing what rm(1) does? Something like \"rm -f\"?\nIt returns 0 even if nothing given in command-line, but any\nerror (like permissions) is reported and the status is not 0.\n\nIt is often that it is not the commands output which is\nannoying, but the _unwanted_ output. No one wants\nto see \"rm 'file'\". No one besides people debugging\ngit-rm (you can't even use it for copy and paste of the filenames:\nit has \"rm\"'s in the text).\n"},{"id":"39491","messageId":"7vps64vjfc.fsf@assigned-by-dhcp.cox.net","threadId":"7668","inReplyTo":"20070416075324.GA18961@midwinter.com","subject":"Re: [PATCH 2/2] Add --ignore-notfound option to exit with zero status when no files are removed.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-16T07:59:35Z","receivedAt":"2007-04-16T07:59:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Steven Grimm <koreth@midwinter.com> writes:\n\n>  Documentation/git-rm.txt |    3 +++\n>  builtin-rm.c             |   21 +++++++++++++++++----\n>  t/t3600-rm.sh            |    4 ++++\n>  3 files changed, 24 insertions(+), 4 deletions(-)\n\nI find it easier to see what is going on with two independent\nfeatures separated out, especially with tests.  Much nicer.\n\n> @@ -47,6 +47,9 @@ OPTIONS\n>  \tthe paths only from the index, leaving working tree\n>  \tfiles.\n>  \n> +\\--ignore-notfound::\n> +\tExit with a zero status even if no files matched.\n> +\n\nls-files has --error-unmatch so we may want to make the name\nconsistent by saying --ignore-unmatch?  I particularly do not\ncare about the minute naming issues _right_ _now_, but we might\nregret it in the long run.\n\nNo need to resend unless you have an actual fix; I'll queue your\npatch as is in 'pu', wait for a few days for comments on the\nnaming, and amend it as needed.\n\nThanks.\n"},{"id":"39497","messageId":"46232FEE.9010907@midwinter.com","threadId":"7668","inReplyTo":"20070416075324.GA18961@midwinter.com","subject":"Re: [PATCH 2/2] Add --ignore-notfound option to exit with zero status when no files are removed.","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2007-04-16T08:12:30Z","receivedAt":"2007-04-16T08:12:30Z","isPatch":true,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"Steven Grimm wrote:\n> This allows \"git rm -r --ignore-notfound\" to be used as an index filter\n> with cg-admin-rewritehist. The documentation for that command recommends\n> using git-update-index --remove to filter files out of a tree's history,\n> but that doesn't support recursive deletion like git-rm does, making it\n> less convenient to filter directories from history.\n>   \n\nHaving said that, in some sense the problem here is arguably with \ncg-admin-rewritehist bailing out when a filter command exits with a \nnonzero status; given that git-rm is likely to be a common filter people \nwill want to use, ideally cg-admin-rewritehist should do the right thing \nwith git-rm's normal exit codes. But it appears Cogito is not being \nactively maintained any more (correct me if I'm wrong; the latest stable \nrelease is half a year old at this point, while git has changed \nsubstantially since then) so it didn't seem too worthwhile to try to \npatch things from that side.\n\nI think it makes sense to be able to optionally treat a lack of matches \nas a non-error condition like \"rm -f\" does, so I'm comfortable \nsubmitting this patch regardless.\n\nOn a related note, last time I asked a question that caused someone to \npoint me to cg-admin-rewritehist, Linus said he'd like to see its \nfunctionality folded into git proper. I have to agree with that idea; \nthere are some obvious enhancements that program could use, and it'll be \neasier to do that if it's part of an actively maintained code base.\n\n-Steve\n"},{"id":"39498","messageId":"46233039.2040208@midwinter.com","threadId":"7668","inReplyTo":"7vps64vjfc.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 2/2] Add --ignore-notfound option to exit with zero status when no files are removed.","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2007-04-16T08:13:45Z","receivedAt":"2007-04-16T08:13:45Z","isPatch":true,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> ls-files has --error-unmatch so we may want to make the name\n> consistent by saying --ignore-unmatch?  I particularly do not\n> care about the minute naming issues _right_ _now_, but we might\n> regret it in the long run.\n>   \n\nSure, UI consistency is a good thing. Feel free to amend.\n\n-Steve\n"},{"id":"39506","messageId":"20070416085011.GA2387@coredump.intra.peff.net","threadId":"7668","inReplyTo":"7vps64vjfc.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 2/2] Add --ignore-notfound option to exit with zero status when no files are removed.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-04-16T08:50:11Z","receivedAt":"2007-04-16T08:50:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 16, 2007 at 12:59:35AM -0700, Junio C Hamano wrote:\n\n> > +\\--ignore-notfound::\n> > +\tExit with a zero status even if no files matched.\n> > +\n> ls-files has --error-unmatch so we may want to make the name\n> consistent by saying --ignore-unmatch?  I particularly do not\n> care about the minute naming issues _right_ _now_, but we might\n> regret it in the long run.\n\nIsn't this quite similar to the '-k' option to git-mv?\n\n-Peff\n"},{"id":"39509","messageId":"7v7iscvgx1.fsf@assigned-by-dhcp.cox.net","threadId":"7668","inReplyTo":"20070416085011.GA2387@coredump.intra.peff.net","subject":"Re: [PATCH 2/2] Add --ignore-notfound option to exit with zero status when no files are removed.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-16T08:53:46Z","receivedAt":"2007-04-16T08:53:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Apr 16, 2007 at 12:59:35AM -0700, Junio C Hamano wrote:\n>\n>> > +\\--ignore-notfound::\n>> > +\tExit with a zero status even if no files matched.\n>> > +\n>> ls-files has --error-unmatch so we may want to make the name\n>> consistent by saying --ignore-unmatch?  I particularly do not\n>> care about the minute naming issues _right_ _now_, but we might\n>> regret it in the long run.\n>\n> Isn't this quite similar to the '-k' option to git-mv?\n\nHeh, I never use 'git-mv' and 'git-rm' myself, so I did not know\nabout that option, but from the Documentation/git-mv.txt, it\nsounds similar.  What does it stand for, I wonder?\n"},{"id":"39513","messageId":"20070416090426.GA2549@coredump.intra.peff.net","threadId":"7668","inReplyTo":"7v7iscvgx1.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 2/2] Add --ignore-notfound option to exit with zero status when no files are removed.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-04-16T09:04:26Z","receivedAt":"2007-04-16T09:04:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 16, 2007 at 01:53:46AM -0700, Junio C Hamano wrote:\n\n> >> > +\\--ignore-notfound::\n> >> > +\tExit with a zero status even if no files matched.\n> >> > +\n> >> ls-files has --error-unmatch so we may want to make the name\n> >> consistent by saying --ignore-unmatch?  I particularly do not\n> >> care about the minute naming issues _right_ _now_, but we might\n> >> regret it in the long run.\n> >\n> > Isn't this quite similar to the '-k' option to git-mv?\n> \n> Heh, I never use 'git-mv' and 'git-rm' myself, so I did not know\n> about that option, but from the Documentation/git-mv.txt, it\n> sounds similar.  What does it stand for, I wonder?\n\nAs you are so fond of telling everyone else, use git-blame to find out. :)\n\nLooks like '-k' got added in the move from git-rename to git-mv. Josef,\ncan you shed any light on the choice of '-k'?\n\n-Peff\n"},{"id":"39563","messageId":"200704162029.41427.Josef.Weidendorfer@gmx.de","threadId":"7668","inReplyTo":"20070416090426.GA2549@coredump.intra.peff.net","subject":"Re: [PATCH 2/2] Add --ignore-notfound option to exit with zero status when no files are removed.","fromName":"Josef Weidendorfer","fromEmail":"josef.weidendorfer@gmx.de","sentAt":"2007-04-16T18:29:41Z","receivedAt":"2007-04-16T18:29:41Z","isPatch":true,"sender":{"key":"josef.weidendorfer@gmx.de","avatar":null},"body":"On Monday 16 April 2007, you wrote:\n> On Mon, Apr 16, 2007 at 01:53:46AM -0700, Junio C Hamano wrote:\n> \n> > >> > +\\--ignore-notfound::\n> > >> > +\tExit with a zero status even if no files matched.\n> > >> > +\n> > >> ls-files has --error-unmatch so we may want to make the name\n> > >> consistent by saying --ignore-unmatch?  I particularly do not\n> > >> care about the minute naming issues _right_ _now_, but we might\n> > >> regret it in the long run.\n> > >\n> > > Isn't this quite similar to the '-k' option to git-mv?\n> > \n> > Heh, I never use 'git-mv' and 'git-rm' myself, so I did not know\n> > about that option, but from the Documentation/git-mv.txt, it\n> > sounds similar.  What does it stand for, I wonder?\n> \n> As you are so fond of telling everyone else, use git-blame to find out. :)\n> \n> Looks like '-k' got added in the move from git-rename to git-mv. Josef,\n> can you shed any light on the choice of '-k'?\n\nThat is similiar to \"-k\" option to \"make\", synonym for \"--keep-going\". \nI thought this was quite natural; at least I am used to this option for \"make\".\n\n\nJosef\n"}]}