summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-09-04 05:24:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-09-04 05:24:29 (GMT)
commit306d7e5556f45c7405190b8b170e7ceefc88b9fa (patch)
treeaf0a806df0d64ff5197e32273d7374f9ca534943 /sha1_name.c
parentc208e05bd9880028c980fafbc5dda3d17a603ac1 (diff)
parentba9eab7bfdcb83ad67f4714507599f378a91b17a (diff)
downloadgit-306d7e5556f45c7405190b8b170e7ceefc88b9fa.zip
git-306d7e5556f45c7405190b8b170e7ceefc88b9fa.tar.gz
git-306d7e5556f45c7405190b8b170e7ceefc88b9fa.tar.bz2
Merge branch 'js/maint-reflog-beyond-horizon'
* js/maint-reflog-beyond-horizon: t1503: fix broken test_must_fail calls rev-parse: tests git rev-parse --verify master@{n}, for various n sha1_name.c: use warning in preference to fprintf(stderr rev-parse: exit with non-zero status if ref@{n} is not valid.
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 4af94fa..7b7e617 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -342,7 +342,7 @@ static int get_sha1_1(const char *name, int len, unsigned char *sha1);
static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
{
- static const char *warning = "warning: refname '%.*s' is ambiguous.\n";
+ static const char *warn_msg = "refname '%.*s' is ambiguous.";
char *real_ref = NULL;
int refs_found = 0;
int at, reflog_len;
@@ -390,7 +390,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
return -1;
if (warn_ambiguous_refs && refs_found > 1)
- fprintf(stderr, warning, len, str);
+ warning(warn_msg, len, str);
if (reflog_len) {
int nth, i;
@@ -426,14 +426,14 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
&co_time, &co_tz, &co_cnt)) {
if (at_time)
- fprintf(stderr,
- "warning: Log for '%.*s' only goes "
- "back to %s.\n", len, str,
+ warning("Log for '%.*s' only goes "
+ "back to %s.", len, str,
show_date(co_time, co_tz, DATE_RFC2822));
- else
- fprintf(stderr,
- "warning: Log for '%.*s' only has "
- "%d entries.\n", len, str, co_cnt);
+ else {
+ free(real_ref);
+ die("Log for '%.*s' only has %d entries.",
+ len, str, co_cnt);
+ }
}
}