From: Brian Gernhardt <benji@silverinsanity.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] branch -v: Prevent garbage output on remote refs
Date: Sun, 6 Jul 2008 05:24:39 -0400 [thread overview]
Message-ID: <1215336279-99480-1-git-send-email-benji@silverinsanity.com> (raw)
The stat string was only initialized if the ref was local, but was
always used in a printf. This meant that whatever data was on the
stack got printed. In the case of "branch -av", this was probably the
tracking information of the last local branch. If the case of "branch
-rv", this was "@???" in my case.
Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
---
After looking through the second get of changes I pulled, I tried this:
$ git branch -av
* master 3195299 [ahead 1] Make rebase save ORIG_HEAD if changing current branch
origin/HEAD 08b51f5 [ahead 1] Merge branch 'qq/maint'
origin/gitk-for-paulus 7d8856d [ahead 1] gitk: Update German translation.
Huh. That doesn't look right... Let's try just showing the remotes:
$ git branch -rv
origin/HEAD 08b51f5 @???Merge branch 'qq/maint'
origin/gitk-for-paulus 7d8856d @???gitk: Update German translation.
That's definately not good.
I guess that other people either have a compiler that is more careful about
clearing stack variables, or don't use "branch -v".
builtin-branch.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index e9423d1..470c59f 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -327,7 +327,7 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
if (verbose) {
struct strbuf subject;
const char *sub = " **** invalid ref ****";
- char stat[128];
+ char stat[128] = "";
strbuf_init(&subject, 0);
--
1.5.6.2.336.g3195
next reply other threads:[~2008-07-06 9:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-06 9:24 Brian Gernhardt [this message]
2008-07-06 10:07 ` [PATCH] branch -v: Prevent garbage output on remote refs Junio C Hamano
2008-07-06 16:13 ` Brian Gernhardt
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=1215336279-99480-1-git-send-email-benji@silverinsanity.com \
--to=benji@silverinsanity.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).