{"thread":{"id":"4106","subject":"[PATCH/RFC] Teach git-clean optional <paths>... parameters.","startedAt":"2006-05-08T19:02:44Z","lastAt":"2006-05-08T22:42:14Z","messageCount":2,"participants":["Junio C Hamano","Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"19720","messageId":"7v1wv4gx0r.fsf@assigned-by-dhcp.cox.net","threadId":"4106","inReplyTo":null,"subject":"[PATCH/RFC] Teach git-clean optional <paths>... parameters.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-08T19:02:44Z","receivedAt":"2006-05-08T19:02:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When optional paths arguments are given, git-clean passes them\nto underlying git-ls-files; with this, you can say:\n\n\tgit clean 'temp-*'\n\nto clean only the garbage files whose names begin with 'temp-'.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n * I usually do not use clean myself, so I am not sure if this\n   is the kind of thing people who do use 'clean' regularly\n   would generally want, hence this RFC.\n\n Documentation/git-clean.txt |    5 ++++-\n git-clean.sh                |   13 +++++++++----\n 2 files changed, 13 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt\nindex 36890c5..b95545f 100644\n--- a/Documentation/git-clean.txt\n+++ b/Documentation/git-clean.txt\n@@ -8,7 +8,7 @@ git-clean - Remove untracked files from \n SYNOPSIS\n --------\n [verse]\n-'git-clean' [-d] [-n] [-q] [-x | -X]\n+'git-clean' [-d] [-n] [-q] [-x | -X] <paths>...\n \n DESCRIPTION\n -----------\n@@ -16,6 +16,9 @@ Removes files unknown to git.  This allo\n from files that are not under version control.  If the '-x' option is\n specified, ignored files are also removed, allowing to remove all\n build products.\n+When optional `<paths>...` arguments are given, the paths\n+affected are further limited to those that match them.\n+\n \n OPTIONS\n -------\ndiff --git a/git-clean.sh b/git-clean.sh\nindex b200868..6c818f4 100755\n--- a/git-clean.sh\n+++ b/git-clean.sh\n@@ -3,13 +3,15 @@ #\n # Copyright (c) 2005-2006 Pavel Roskin\n #\n \n-USAGE=\"[-d] [-n] [-q] [-x | -X]\"\n+USAGE=\"[-d] [-n] [-q] [-x | -X] <paths>...\"\n LONG_USAGE='Clean untracked files from the working directory\n \t-d\tremove directories as well\n \t-n \tdon'\\''t remove anything, just show what would be done\n \t-q\tbe quiet, only report errors\n \t-x\tremove ignored files as well\n-\t-X\tremove only ignored files as well'\n+\t-X\tremove only ignored files as well\n+When optional <paths>... arguments are given, the paths\n+affected are further limited to those that match them.'\n SUBDIRECTORY_OK=Yes\n . git-sh-setup\n \n@@ -44,8 +46,11 @@ do\n \t-X)\n \t\tignoredonly=1\n \t\t;;\n-\t*)\n+\t-*)\n \t\tusage\n+\t\t;;\n+\t*)\n+\t\tbreak\n \tesac\n \tshift\n done\n@@ -64,7 +69,7 @@ if [ -z \"$ignored\" ]; then\n \tfi\n fi\n \n-git-ls-files --others --directory $excl ${excl_info:+\"$excl_info\"} |\n+git-ls-files --others --directory $excl ${excl_info:+\"$excl_info\"} \"$@\" |\n while read -r file; do\n \tif [ -d \"$file\" -a ! -L \"$file\" ]; then\n \t\tif [ -z \"$cleandir\" ]; then\n-- \n1.3.2.gb012\n"},{"id":"19725","messageId":"1147128134.3353.13.camel@dv","threadId":"4106","inReplyTo":"7v1wv4gx0r.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH/RFC] Teach git-clean optional <paths>... parameters.","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2006-05-08T22:42:14Z","receivedAt":"2006-05-08T22:42:14Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"On Mon, 2006-05-08 at 12:02 -0700, Junio C Hamano wrote:\n> When optional paths arguments are given, git-clean passes them\n> to underlying git-ls-files; with this, you can say:\n> \n> \tgit clean 'temp-*'\n> \n> to clean only the garbage files whose names begin with 'temp-'.\n> \n> Signed-off-by: Junio C Hamano <junkio@cox.net>\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\n>  * I usually do not use clean myself, so I am not sure if this\n>    is the kind of thing people who do use 'clean' regularly\n>    would generally want, hence this RFC.\n\nI'm not likely to use this feature, but I think it's OK to have it.\n\nIt would be nice to have \"--\" support (see e.g. git-commit).\n\n> +\t-X\tremove only ignored files as well\n\nThat's my stupid error, \"as well\" should be removed.\n\n-- \nRegards,\nPavel Roskin\n"}]}