{"thread":{"id":"34125","subject":"[PATCH] prompt: squelch error output from cat","startedAt":"2013-06-13T13:46:49Z","lastAt":"2013-06-15T15:33:00Z","messageCount":5,"participants":["Ramkumar Ramachandra","SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"220729","messageId":"1371131209-32479-1-git-send-email-artagnon@gmail.com","threadId":"34125","inReplyTo":null,"subject":"[PATCH] prompt: squelch error output from cat","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-13T13:46:49Z","receivedAt":"2013-06-13T13:46:49Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"The files $g/rebase-{merge,apply}/{head-name,msgnum,end} are not\nguaranteed to exist.  When attempting to cat them, squelch the error\noutput to get rid of messages like these:\n\n  cat: .git/rebase-merge/msgnum: No such file or directory\n  cat: .git/rebase-merge/end: No such file or directory\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n contrib/completion/git-prompt.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 86a4f3f..07a6218 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -347,9 +347,9 @@ __git_ps1 ()\n \t\tlocal step=\"\"\n \t\tlocal total=\"\"\n \t\tif [ -d \"$g/rebase-merge\" ]; then\n-\t\t\tb=\"$(cat \"$g/rebase-merge/head-name\")\"\n-\t\t\tstep=$(cat \"$g/rebase-merge/msgnum\")\n-\t\t\ttotal=$(cat \"$g/rebase-merge/end\")\n+\t\t\tb=\"$(cat \"$g/rebase-merge/head-name\" 2>/dev/null)\"\n+\t\t\tstep=$(cat \"$g/rebase-merge/msgnum\" 2>/dev/null)\n+\t\t\ttotal=$(cat \"$g/rebase-merge/end\" 2>/dev/null)\n \t\t\tif [ -f \"$g/rebase-merge/interactive\" ]; then\n \t\t\t\tr=\"|REBASE-i\"\n \t\t\telse\n@@ -357,10 +357,10 @@ __git_ps1 ()\n \t\t\tfi\n \t\telse\n \t\t\tif [ -d \"$g/rebase-apply\" ]; then\n-\t\t\t\tstep=$(cat \"$g/rebase-apply/next\")\n-\t\t\t\ttotal=$(cat \"$g/rebase-apply/last\")\n+\t\t\t\tstep=$(cat \"$g/rebase-apply/next\" 2>/dev/null)\n+\t\t\t\ttotal=$(cat \"$g/rebase-apply/last\" 2>/dev/null)\n \t\t\t\tif [ -f \"$g/rebase-apply/rebasing\" ]; then\n-\t\t\t\t\tb=\"$(cat \"$g/rebase-apply/head-name\")\"\n+\t\t\t\t\tb=\"$(cat \"$g/rebase-apply/head-name\" 2>/dev/null)\"\n \t\t\t\t\tr=\"|REBASE\"\n \t\t\t\telif [ -f \"$g/rebase-apply/applying\" ]; then\n \t\t\t\t\tr=\"|AM\"\n-- \n1.8.3.1.384.g7cec0b4\n"},{"id":"220733","messageId":"20130613143942.GK2091@goldbirke","threadId":"34125","inReplyTo":"1371131209-32479-1-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH] prompt: squelch error output from cat","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2013-06-13T14:39:42Z","receivedAt":"2013-06-13T14:39:42Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\nOn Thu, Jun 13, 2013 at 07:16:49PM +0530, Ramkumar Ramachandra wrote:\n> The files $g/rebase-{merge,apply}/{head-name,msgnum,end} are not\n> guaranteed to exist.  When attempting to cat them, squelch the error\n> output to get rid of messages like these:\n> \n>   cat: .git/rebase-merge/msgnum: No such file or directory\n>   cat: .git/rebase-merge/end: No such file or directory\n> \n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n\nMakes sense.\n\nJust curious: when do those files don't exist?  When using an older\nversion of git with a newer prompt, obviously, but are there other\ncases?\n\nThanks,\nGábor\n"},{"id":"220734","messageId":"CALkWK0kwVahUF_kwk4jRr7Qr5_H-FY_aXWLkQcaZV-YrV_mgjw@mail.gmail.com","threadId":"34125","inReplyTo":"20130613143942.GK2091@goldbirke","subject":"Re: [PATCH] prompt: squelch error output from cat","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-13T14:45:59Z","receivedAt":"2013-06-13T14:45:59Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"SZEDER Gábor wrote:\n> Just curious: when do those files don't exist?  When using an older\n> version of git with a newer prompt, obviously, but are there other\n> cases?\n\n  # On terminal one\n  $ git rebase --interactive master\n  # Ignore editor, and open terminal two\n  cat: .git/rebase-merge/msgnum: No such file or directory\n  cat: .git/rebase-merge/end: No such file or directory\n  $\n"},{"id":"220864","messageId":"20130614135816.GL2091@goldbirke","threadId":"34125","inReplyTo":"CALkWK0kwVahUF_kwk4jRr7Qr5_H-FY_aXWLkQcaZV-YrV_mgjw@mail.gmail.com","subject":"Re: [PATCH] prompt: squelch error output from cat","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2013-06-14T13:58:16Z","receivedAt":"2013-06-14T13:58:16Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Thu, Jun 13, 2013 at 08:15:59PM +0530, Ramkumar Ramachandra wrote:\n> SZEDER Gábor wrote:\n> > Just curious: when do those files don't exist?  When using an older\n> > version of git with a newer prompt, obviously, but are there other\n> > cases?\n> \n>   # On terminal one\n>   $ git rebase --interactive master\n>   # Ignore editor, and open terminal two\n>   cat: .git/rebase-merge/msgnum: No such file or directory\n>   cat: .git/rebase-merge/end: No such file or directory\n>   $\n\nInteresting, I wouldn't have thought of that.\n\nI was wondering whether there are cases and code paths in git rebase,\nwhere it knows what to write into those files but it does not write\nthem, which might be worth fixing additionally.  In case of this\nhalfway-started rebase I don't see any point in displaying 0/42, so I\ndon't think any additional fix would be necessary.\n\n\nThanks,\nGábor\n"},{"id":"220949","messageId":"20130615153300.GO2091@goldbirke","threadId":"34125","inReplyTo":"1371131209-32479-1-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH] prompt: squelch error output from cat","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2013-06-15T15:33:00Z","receivedAt":"2013-06-15T15:33:00Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi Junio,\n\nI see you picked up this patch in branch\n'rr/prompt-autostash-breakage-fix'.  This patch has actually nothing\nto do with autostash, it is a fix for b71dc3e1 (bash-prompt.sh: show\nwhere rebase is at when stopped, 2013-04-25).\n\n\nGábor\n\nOn Thu, Jun 13, 2013 at 07:16:49PM +0530, Ramkumar Ramachandra wrote:\n> The files $g/rebase-{merge,apply}/{head-name,msgnum,end} are not\n> guaranteed to exist.  When attempting to cat them, squelch the error\n> output to get rid of messages like these:\n> \n>   cat: .git/rebase-merge/msgnum: No such file or directory\n>   cat: .git/rebase-merge/end: No such file or directory\n> \n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> ---\n>  contrib/completion/git-prompt.sh | 12 ++++++------\n>  1 file changed, 6 insertions(+), 6 deletions(-)\n> \n> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\n> index 86a4f3f..07a6218 100644\n> --- a/contrib/completion/git-prompt.sh\n> +++ b/contrib/completion/git-prompt.sh\n> @@ -347,9 +347,9 @@ __git_ps1 ()\n>  \t\tlocal step=\"\"\n>  \t\tlocal total=\"\"\n>  \t\tif [ -d \"$g/rebase-merge\" ]; then\n> -\t\t\tb=\"$(cat \"$g/rebase-merge/head-name\")\"\n> -\t\t\tstep=$(cat \"$g/rebase-merge/msgnum\")\n> -\t\t\ttotal=$(cat \"$g/rebase-merge/end\")\n> +\t\t\tb=\"$(cat \"$g/rebase-merge/head-name\" 2>/dev/null)\"\n> +\t\t\tstep=$(cat \"$g/rebase-merge/msgnum\" 2>/dev/null)\n> +\t\t\ttotal=$(cat \"$g/rebase-merge/end\" 2>/dev/null)\n>  \t\t\tif [ -f \"$g/rebase-merge/interactive\" ]; then\n>  \t\t\t\tr=\"|REBASE-i\"\n>  \t\t\telse\n> @@ -357,10 +357,10 @@ __git_ps1 ()\n>  \t\t\tfi\n>  \t\telse\n>  \t\t\tif [ -d \"$g/rebase-apply\" ]; then\n> -\t\t\t\tstep=$(cat \"$g/rebase-apply/next\")\n> -\t\t\t\ttotal=$(cat \"$g/rebase-apply/last\")\n> +\t\t\t\tstep=$(cat \"$g/rebase-apply/next\" 2>/dev/null)\n> +\t\t\t\ttotal=$(cat \"$g/rebase-apply/last\" 2>/dev/null)\n>  \t\t\t\tif [ -f \"$g/rebase-apply/rebasing\" ]; then\n> -\t\t\t\t\tb=\"$(cat \"$g/rebase-apply/head-name\")\"\n> +\t\t\t\t\tb=\"$(cat \"$g/rebase-apply/head-name\" 2>/dev/null)\"\n>  \t\t\t\t\tr=\"|REBASE\"\n>  \t\t\t\telif [ -f \"$g/rebase-apply/applying\" ]; then\n>  \t\t\t\t\tr=\"|AM\"\n> -- \n> 1.8.3.1.384.g7cec0b4\n> \n> \n"}]}