From: Junio C Hamano <gitster@pobox.com>
To: Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: t5505-remote.29 not working correctly
Date: Mon, 15 Mar 2010 20:26:15 -0700 [thread overview]
Message-ID: <7vwrxdueug.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <OGVB8d37MB-s4H3VOECmd2htUvpq3B4NginojN-XskLyvHmnbfGA4Q@cipher.nrlssc.navy.mil> (Brandon Casey's message of "Mon\, 15 Mar 2010 20\:12\:36 -0500")
Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> writes:
> The test titled 'remote prune to cause a dangling symref' is
> not linked together with &&'s. When the &&'s are added, it
> does not complete successfully.
Hmm, it looks like f8948e2 (remote prune: warn dangling symrefs,
2009-02-08) is internally inconsistent. This is a fix directly on top of
that commit.
I haven't tried merging the result to a more recent codebase, though.
-- >8 --
Subject: [PATCH] warn_dangling_symref(): send the warning to standard error stream
Brandon Casey noticed tht t5505 had accidentally broken its && chain,
hiding inconsistency between the code that writes the warning to the
standard output and the test that expects to see the warning on the
standard error.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-remote.c | 2 +-
refs.c | 7 ++++---
refs.h | 2 +-
t/t5505-remote.sh | 2 +-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/builtin-remote.c b/builtin-remote.c
index ac69d37..e67221d 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -789,7 +789,7 @@ static int prune(int argc, const char **argv)
printf(" * [%s] %s\n", dry_run ? "would prune" : "pruned",
abbrev_ref(refname, "refs/remotes/"));
- warn_dangling_symref(dangling_msg, refname);
+ warn_dangling_symref(stderr, dangling_msg, refname);
}
/* NEEDSWORK: free remote */
diff --git a/refs.c b/refs.c
index 6eb5f53..a0e7da7 100644
--- a/refs.c
+++ b/refs.c
@@ -286,6 +286,7 @@ static struct ref_list *get_ref_dir(const char *base, struct ref_list *list)
}
struct warn_if_dangling_data {
+ FILE *fp;
const char *refname;
const char *msg_fmt;
};
@@ -304,13 +305,13 @@ static int warn_if_dangling_symref(const char *refname, const unsigned char *sha
if (!resolves_to || strcmp(resolves_to, d->refname))
return 0;
- printf(d->msg_fmt, refname);
+ fprintf(d->fp, d->msg_fmt, refname);
return 0;
}
-void warn_dangling_symref(const char *msg_fmt, const char *refname)
+void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
{
- struct warn_if_dangling_data data = { refname, msg_fmt };
+ struct warn_if_dangling_data data = { fp, refname, msg_fmt };
for_each_rawref(warn_if_dangling_symref, &data);
}
diff --git a/refs.h b/refs.h
index 29bdcec..64a8e62 100644
--- a/refs.h
+++ b/refs.h
@@ -27,7 +27,7 @@ extern int for_each_remote_ref(each_ref_fn, void *);
/* can be used to learn about broken ref and symref */
extern int for_each_rawref(each_ref_fn, void *);
-extern void warn_dangling_symref(const char *msg_fmt, const char *refname);
+extern void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname);
/*
* Extra refs will be listed by for_each_ref() before any actual refs
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 2067dc5..2cad416 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -415,7 +415,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
) 2>err &&
grep "has become dangling" err &&
- : And the dangling symref will not cause other annoying errors
+ : And the dangling symref will not cause other annoying errors &&
(
cd seven &&
git branch -a
--
1.7.0.2.445.g0ae494
next prev parent reply other threads:[~2010-03-16 3:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 1:12 t5505-remote.29 not working correctly Brandon Casey
2010-03-16 3:26 ` Junio C Hamano [this message]
2010-03-16 5:16 ` Junio C Hamano
2010-03-16 7:40 ` [PATCH] refs: ref entry with NULL sha1 is can be a dangling symref Junio C Hamano
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=7vwrxdueug.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=brandon.casey.ctr@nrlssc.navy.mil \
--cc=git@vger.kernel.org \
/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).