Re: t5505-remote.29 not working correctly
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:26
Subsystem:
the rest · Maintainer:
Linus Torvalds
Possibly related (same subject, not in this thread)
- 2016-06-15 · t5505-remote.29 not working correctly · Brandon Casey <hidden>
- 2016-06-15 · Re: t5505-remote.29 not working correctly · Junio C Hamano <hidden>
Brandon Casey [off-list ref] 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 <redacted> --- 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