From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: "SZEDER Gábor" <szeder@ira.uka.de>,
"Ronnie Sahlberg" <sahlberg@google.com>,
"Michael Haggerty" <mhagger@alum.mit.edu>
Subject: [PATCH 1/5] git-prompt: do not look for refs/stash in $GIT_DIR
Date: Sat, 23 Aug 2014 01:26:51 -0400 [thread overview]
Message-ID: <20140823052650.GA18075@peff.net> (raw)
In-Reply-To: <20140823052334.GA17813@peff.net>
Since dd0b72c (bash prompt: use bash builtins to check stash
state, 2011-04-01), git-prompt checks whether we have a
stash by looking for $GIT_DIR/refs/stash. Generally external
programs should never do this, because they would miss
packed-refs.
That commit claims that packed-refs does not pack
refs/stash, but that is not quite true. It does pack the
ref, but due to a bug, fails to prune the ref. When we fix
that bug, we would want to be doing the right thing here.
Signed-off-by: Jeff King <peff@peff.net>
---
I know we are pretty sensitive to forks in the prompt code (after all,
that was the point of dd0b72c). This patch is essentially a reversion of
this hunk of dd0b72c, and is definitely safe.
I think we could probably get by with:
[ -r "$g/logs/ref/stash" ]
since reflogs are always in the filesystem. However, that seems somewhat
short-sighted, as the work Ronnie is doing is moving in the direction of
more abstraction here. I hope a day will come soon when reflogs do not
have to be stored in $GIT_DIR/logs, and then we would end up updating
this code again.
contrib/completion/git-prompt.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 9d684b1..c5473dc 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -468,7 +468,8 @@ __git_ps1 ()
fi
fi
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
- [ -r "$g/refs/stash" ]; then
+ git rev-parse --verify --quiet refs/stash >/dev/null
+ then
s="$"
fi
--
2.1.0.346.ga0367b9
next prev parent reply other threads:[~2014-08-23 5:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-23 5:23 [PATCH 0/5] fix pack-refs pruning of refs/foo Jeff King
2014-08-23 5:26 ` Jeff King [this message]
2014-08-23 5:27 ` [PATCH 2/5] pack-refs: prune top-level refs like "refs/foo" Jeff King
2014-08-23 5:27 ` [PATCH 3/5] fast-import: clean up pack_data pointer in end_packfile Jeff King
2014-08-25 17:16 ` Ronnie Sahlberg
2014-08-25 18:55 ` Jeff King
2014-08-23 5:32 ` [PATCH 4/5] fast-import: fix buffer overflow in dump_tags Jeff King
2014-08-25 17:11 ` Ronnie Sahlberg
2014-08-23 5:33 ` [PATCH 5/5] fast-import: stop using lock_ref_sha1 Jeff King
2014-08-25 17:22 ` Ronnie Sahlberg
2014-08-23 7:29 ` [PATCH 0/5] fix pack-refs pruning of refs/foo Michael Haggerty
2014-08-23 7:46 ` Jeff King
2014-08-25 17:38 ` Ronnie Sahlberg
2014-08-25 18:56 ` Jeff King
-- strict thread matches above, loose matches on Subject: below --
2014-08-24 13:22 [PATCH 1/5] git-prompt: do not look for refs/stash in $GIT_DIR Gábor Szeder
2014-08-25 12:46 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140823052650.GA18075@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
--cc=sahlberg@google.com \
--cc=szeder@ira.uka.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.