{"thread":{"id":"30216","subject":"[PATCH] stash: don't leak underlying error messages","startedAt":"2012-04-11T18:36:19Z","lastAt":"2012-04-13T03:59:54Z","messageCount":3,"participants":["Ross Lagerwall","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"189013","messageId":"1334169379-20827-1-git-send-email-rosslagerwall@gmail.com","threadId":"30216","inReplyTo":null,"subject":"[PATCH] stash: don't leak underlying error messages","fromName":"Ross Lagerwall","fromEmail":"rosslagerwall@gmail.com","sentAt":"2012-04-11T18:36:19Z","receivedAt":"2012-04-11T18:36:19Z","isPatch":true,"sender":{"key":"rosslagerwall@gmail.com","avatar":"https://avatars.githubusercontent.com/u/878055?v=4"},"body":"When running git-stash on an empty repository, don't let the underlying\nerror messages leak through to the surface; instead, redirect them to\n/dev/null.\n---\n git-stash.sh |    6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex fe4ab28..5c72d1b 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -34,8 +34,8 @@ else\n fi\n \n no_changes () {\n-\tgit diff-index --quiet --cached HEAD --ignore-submodules -- &&\n-\tgit diff-files --quiet --ignore-submodules &&\n+\tgit diff-index --quiet --cached HEAD --ignore-submodules -- 2>/dev/null &&\n+\tgit diff-files --quiet --ignore-submodules 2>/dev/null &&\n \t(test -z \"$untracked\" || test -z \"$(untracked_files)\")\n }\n \n@@ -67,7 +67,7 @@ create_stash () {\n \tfi\n \n \t# state of the base commit\n-\tif b_commit=$(git rev-parse --verify HEAD)\n+\tif b_commit=$(git rev-parse --verify HEAD 2>/dev/null)\n \tthen\n \t\thead=$(git rev-list --oneline -n 1 HEAD --)\n \telse\n-- \n1.7.10\n"},{"id":"189131","messageId":"7vaa2g694j.fsf@alter.siamese.dyndns.org","threadId":"30216","inReplyTo":"1334169379-20827-1-git-send-email-rosslagerwall@gmail.com","subject":"Re: [PATCH] stash: don't leak underlying error messages","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-12T19:30:20Z","receivedAt":"2012-04-12T19:30:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ross Lagerwall <rosslagerwall@gmail.com> writes:\n\n> When running git-stash on an empty repository, don't let the underlying\n> error messages leak through to the surface; instead, redirect them to\n> /dev/null.\n> ---\n\nSign-off?\n\nIs create_stash (hence save_stash) the only operation that do not make\nsense when HEAD is not born yet?  I am wondering if it makes more sense to\neither:\n\n (1) catch the case where HEAD is not born yet a lot earlier and do not\n     let the control even reach these functions (i.e. die inside the\n     case/esac statement at the end of the script); or\n\n (2) pretend as if HEAD is a commit that records an empty tree, and not\n     error out to begin with.\n\nIf either one of the above turns out to make sense, then the issue this\npatch addresses becomes irrelevant, so...\n\n>  git-stash.sh |    6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n>\n> diff --git a/git-stash.sh b/git-stash.sh\n> index fe4ab28..5c72d1b 100755\n> --- a/git-stash.sh\n> +++ b/git-stash.sh\n> @@ -34,8 +34,8 @@ else\n>  fi\n>  \n>  no_changes () {\n> -\tgit diff-index --quiet --cached HEAD --ignore-submodules -- &&\n> -\tgit diff-files --quiet --ignore-submodules &&\n> +\tgit diff-index --quiet --cached HEAD --ignore-submodules -- 2>/dev/null &&\n> +\tgit diff-files --quiet --ignore-submodules 2>/dev/null &&\n>  \t(test -z \"$untracked\" || test -z \"$(untracked_files)\")\n>  }\n>  \n> @@ -67,7 +67,7 @@ create_stash () {\n>  \tfi\n>  \n>  \t# state of the base commit\n> -\tif b_commit=$(git rev-parse --verify HEAD)\n> +\tif b_commit=$(git rev-parse --verify HEAD 2>/dev/null)\n>  \tthen\n>  \t\thead=$(git rev-list --oneline -n 1 HEAD --)\n>  \telse\n"},{"id":"189171","messageId":"4F87A4BA.50009@gmail.com","threadId":"30216","inReplyTo":"7vaa2g694j.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] stash: don't leak underlying error messages","fromName":"Ross Lagerwall","fromEmail":"rosslagerwall@gmail.com","sentAt":"2012-04-13T03:59:54Z","receivedAt":"2012-04-13T03:59:54Z","isPatch":true,"sender":{"key":"rosslagerwall@gmail.com","avatar":"https://avatars.githubusercontent.com/u/878055?v=4"},"body":"On 04/12/2012 09:30 PM, Junio C Hamano wrote:\n> Sign-off?\n\nOops, I'm not really used to the whole sign-off thing.\n\n> Is create_stash (hence save_stash) the only operation that do not make\n> sense when HEAD is not born yet?  I am wondering if it makes more sense to\n> either:\n> \n>  (1) catch the case where HEAD is not born yet a lot earlier and do not\n>      let the control even reach these functions (i.e. die inside the\n>      case/esac statement at the end of the script); or\n> \n>  (2) pretend as if HEAD is a commit that records an empty tree, and not\n>      error out to begin with.\n> \n> If either one of the above turns out to make sense, then the issue this\n> patch addresses becomes irrelevant, so...\n\nI think it would be more consistent if stash worked without any commits\nhaving taken place so I'll look at (2).\n-- \nRoss Lagerwall\n\n"}]}