{"thread":{"id":"38355","subject":"[PATCH] stash clear: allow -v/--verbose to be passed","startedAt":"2015-01-13T17:54:37Z","lastAt":"2015-01-13T18:51:39Z","messageCount":2,"participants":["Alexander Kuleshov","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"254610","messageId":"1421171677-12215-1-git-send-email-kuleshovmail@gmail.com","threadId":"38355","inReplyTo":null,"subject":"[PATCH] stash clear: allow -v/--verbose to be passed","fromName":"Alexander Kuleshov","fromEmail":"kuleshovmail@gmail.com","sentAt":"2015-01-13T17:54:37Z","receivedAt":"2015-01-13T17:54:37Z","isPatch":true,"sender":{"key":"kuleshovmail@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2699235?v=4"},"body":"Added new option -v/--verbose to 'git stash clear' for verbose output.\n\nFor example:\n\n    $ git stash clear -v\n    Removed stash@{0}: WIP on stash-clear-verbose: 0ae1f56 Merge branch 'bp/diff-relative-config' into pu\n    Removed stash@{1}: WIP on stash-clear-verbose: 0ae1f56 Merge branch 'bp/diff-relative-config' into pu\n    Removed stash@{2}: WIP on stash-clear-verbose: 0ae1f56 Merge branch 'bp/diff-relative-config' into pu\n    Removed stash@{3}: WIP on master: addfb21 Git 2.3.0-rc0\n\nSigned-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>\n---\n Documentation/git-stash.txt |  4 ++--\n git-stash.sh                | 15 ++++++++++-----\n 2 files changed, 12 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex 375213f..f5b3dd8 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -15,7 +15,7 @@ SYNOPSIS\n 'git stash' branch <branchname> [<stash>]\n 'git stash' [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n \t     [-u|--include-untracked] [-a|--all] [<message>]]\n-'git stash' clear\n+'git stash' clear [-v|--verbose]\n 'git stash' create [<message>]\n 'git stash' store [-m|--message <message>] [-q|--quiet] <commit>\n \n@@ -136,7 +136,7 @@ the stash is applied on top of the commit that was HEAD at the time\n `git stash` was run, it restores the originally stashed state with\n no conflicts.\n \n-clear::\n+clear [-v|--verbose]::\n \tRemove all the stashed states. Note that those states will then\n \tbe subject to pruning, and may be impossible to recover (see\n \t'Examples' below for a possible strategy).\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 6846b18..9f16289 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -9,7 +9,7 @@ USAGE=\"list [<options>]\n    or: $dashless branch <branchname> [<stash>]\n    or: $dashless [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]\n \t\t       [-u|--include-untracked] [-a|--all] [<message>]]\n-   or: $dashless clear\"\n+   or: $dashless clear [-v|--verbose]\"\n \n SUBDIRECTORY_OK=Yes\n OPTIONS_SPEC=\n@@ -46,12 +46,17 @@ untracked_files () {\n }\n \n clear_stash () {\n-\tif test $# != 0\n-\tthen\n-\t\tdie \"$(gettext \"git stash clear with parameters is unimplemented\")\"\n-\tfi\n \tif current=$(git rev-parse --verify --quiet $ref_stash)\n \tthen\n+\t\tcase \"$1\" in\n+\t\t\t-v|--verbose)\n+\t\t\t    shift\n+\t\t\t    git log --format=\"%gd: %gs\" -g --first-parent -m \"$@\" $ref_stash -- | sed -e 's/^/Removed /g'\n+\t\t\t    ;;\n+\t\t\t*)\n+\t\t\t    break\n+\t\t\t    ;;\n+\t\tesac\n \t\tgit update-ref -d $ref_stash $current\n \tfi\n }\n-- \n2.3.0.rc0.239.g0ae1f56.dirty\n"},{"id":"254614","messageId":"xmqqy4p6cy4k.fsf@gitster.dls.corp.google.com","threadId":"38355","inReplyTo":"1421171677-12215-1-git-send-email-kuleshovmail@gmail.com","subject":"Re: [PATCH] stash clear: allow -v/--verbose to be passed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-01-13T18:51:39Z","receivedAt":"2015-01-13T18:51:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexander Kuleshov <kuleshovmail@gmail.com> writes:\n\n> Added new option -v/--verbose to 'git stash clear' for verbose output.\n\nWhy?\n\nI would sort-of understand if it were \"git stash clear --confirm\"\nthat internally runs \"git stash list\" and then asks \"Are you sure\n(Y/n)?\"  and then finally clears [*1*], but what value does it add\nto the system to be able to see what you lost and cannot recover\nanymore after the damage is done?\n\nNote that I am not advocating adding \"clear --confirm\" here (that is\nwhat I mean by \"sort-of understand\"); the users can do that \"Do I\nreally want to discard these?\" themselves.\n\n\n[Footnote]\n\n*1* Or perhaps copying the stash to boneyard/stash before removing\nthem so that they can \"undo\" once.\n"}]}