summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f2ef607)
raw | patch | inline | side by side (parent: f2ef607)
author | Jay Soffian <jaysoffian@gmail.com> | |
Tue, 10 Nov 2009 05:03:32 +0000 (00:03 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 Nov 2009 09:01:47 +0000 (01:01 -0800) |
Different callers of warn_dangling_symref() may want to control whether its
output goes to stdout or stderr so let it take a FILE argument.
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
output goes to stdout or stderr so let it take a FILE argument.
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-remote.c | patch | blob | history | |
refs.c | patch | blob | history | |
refs.h | patch | blob | history |
diff --git a/builtin-remote.c b/builtin-remote.c
index b48267bc7bd712595f7a47082fa4adce4f75b9cf..56cd5af93359276b0117629ba451164e3826305a 100644 (file)
--- a/builtin-remote.c
+++ b/builtin-remote.c
printf(" * [%s] %s\n", dry_run ? "would prune" : "pruned",
abbrev_ref(refname, "refs/remotes/"));
- warn_dangling_symref(dangling_msg, refname);
+ warn_dangling_symref(stdout, dangling_msg, refname);
}
free_remote_ref_states(&states);
index 808f56bb27b6ece616f400154fe98c9cef12f8ba..3e73a0a36dbea4046e5b7b0550b2f4bb67539439 100644 (file)
--- a/refs.c
+++ b/refs.c
}
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);
}
index 777b5b7ca6c08ef63f44abbf0236fc180cb9c6d1..e141991851be60334ea23cc6055b329c36cd272f 100644 (file)
--- a/refs.h
+++ b/refs.h
/* 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