summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2009-11-10 00:03:32 -0500
committerJunio C Hamano <gitster@pobox.com>2009-11-10 01:01:47 -0800
commit3cf6134ad016712ecb78186d9079b9cff7b25416 (patch)
tree8fb37c04b2dd7a17b1907bbb8b53e0836e07b9b0 /refs.c
parentf2ef6075c9d248523bf658d82065b46d892b5601 (diff)
downloadgit-3cf6134ad016712ecb78186d9079b9cff7b25416.tar.gz
teach warn_dangling_symref to take a FILE argument
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>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/refs.c b/refs.c
index 808f56bb27..3e73a0a36d 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);
}