Give no terminating LF to error() function.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-02-22 17:47:10 -08:00
parent 6dc78e696b
commit bd2afde8a3
6 changed files with 15 additions and 13 deletions

View File

@ -212,7 +212,8 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
if (memcmp(bufptr, "tree ", 5)) if (memcmp(bufptr, "tree ", 5))
return error("bogus commit object %s", sha1_to_hex(item->object.sha1)); return error("bogus commit object %s", sha1_to_hex(item->object.sha1));
if (get_sha1_hex(bufptr + 5, parent) < 0) if (get_sha1_hex(bufptr + 5, parent) < 0)
return error("bad tree pointer in commit %s\n", sha1_to_hex(item->object.sha1)); return error("bad tree pointer in commit %s",
sha1_to_hex(item->object.sha1));
item->tree = lookup_tree(parent); item->tree = lookup_tree(parent);
if (item->tree) if (item->tree)
n_refs++; n_refs++;

View File

@ -130,7 +130,7 @@ static void start_object_request(struct object_request *obj_req)
if (obj_req->local < 0) { if (obj_req->local < 0) {
obj_req->state = ABORTED; obj_req->state = ABORTED;
error("Couldn't create temporary file %s for %s: %s\n", error("Couldn't create temporary file %s for %s: %s",
obj_req->tmpfile, obj_req->filename, strerror(errno)); obj_req->tmpfile, obj_req->filename, strerror(errno));
return; return;
} }
@ -830,9 +830,9 @@ static int fetch_object(struct alt_base *repo, unsigned char *sha1)
obj_req->errorstr, obj_req->curl_result, obj_req->errorstr, obj_req->curl_result,
obj_req->http_code, hex); obj_req->http_code, hex);
} else if (obj_req->zret != Z_STREAM_END) { } else if (obj_req->zret != Z_STREAM_END) {
ret = error("File %s (%s) corrupt\n", hex, obj_req->url); ret = error("File %s (%s) corrupt", hex, obj_req->url);
} else if (memcmp(obj_req->sha1, obj_req->real_sha1, 20)) { } else if (memcmp(obj_req->sha1, obj_req->real_sha1, 20)) {
ret = error("File %s has bad hash\n", hex); ret = error("File %s has bad hash", hex);
} else if (obj_req->rename < 0) { } else if (obj_req->rename < 0) {
ret = error("unable to write sha1 filename %s", ret = error("unable to write sha1 filename %s",
obj_req->filename); obj_req->filename);
@ -854,7 +854,7 @@ int fetch(unsigned char *sha1)
fetch_alternates(alt->base); fetch_alternates(alt->base);
altbase = altbase->next; altbase = altbase->next;
} }
return error("Unable to find %s under %s\n", sha1_to_hex(sha1), return error("Unable to find %s under %s", sha1_to_hex(sha1),
alt->base); alt->base);
} }

View File

@ -564,7 +564,7 @@ static int twoway_merge(struct cache_entry **src)
struct cache_entry *oldtree = src[1], *newtree = src[2]; struct cache_entry *oldtree = src[1], *newtree = src[2];
if (merge_size != 2) if (merge_size != 2)
return error("Cannot do a twoway merge of %d trees\n", return error("Cannot do a twoway merge of %d trees",
merge_size); merge_size);
if (current) { if (current) {
@ -616,7 +616,7 @@ static int oneway_merge(struct cache_entry **src)
struct cache_entry *a = src[1]; struct cache_entry *a = src[1];
if (merge_size != 1) if (merge_size != 1)
return error("Cannot do a oneway merge of %d trees\n", return error("Cannot do a oneway merge of %d trees",
merge_size); merge_size);
if (!a) if (!a)

View File

@ -92,7 +92,7 @@ static int run_update_hook(const char *refname,
case -ERR_RUN_COMMAND_WAITPID_WRONG_PID: case -ERR_RUN_COMMAND_WAITPID_WRONG_PID:
return error("waitpid is confused"); return error("waitpid is confused");
case -ERR_RUN_COMMAND_WAITPID_SIGNAL: case -ERR_RUN_COMMAND_WAITPID_SIGNAL:
return error("%s died of signal\n", update_hook); return error("%s died of signal", update_hook);
case -ERR_RUN_COMMAND_WAITPID_NOEXIT: case -ERR_RUN_COMMAND_WAITPID_NOEXIT:
return error("%s died strangely", update_hook); return error("%s died strangely", update_hook);
default: default:
@ -158,7 +158,7 @@ static int update(struct command *cmd)
if (run_update_hook(name, old_hex, new_hex)) { if (run_update_hook(name, old_hex, new_hex)) {
unlink(lock_name); unlink(lock_name);
cmd->error_string = "hook declined"; cmd->error_string = "hook declined";
return error("hook declined to update %s\n", name); return error("hook declined to update %s", name);
} }
else if (rename(lock_name, name) < 0) { else if (rename(lock_name, name) < 0) {
unlink(lock_name); unlink(lock_name);

2
refs.c
View File

@ -268,7 +268,7 @@ static int write_ref_file(const char *filename,
char term = '\n'; char term = '\n';
if (write(fd, hex, 40) < 40 || if (write(fd, hex, 40) < 40 ||
write(fd, &term, 1) < 1) { write(fd, &term, 1) < 1) {
error("Couldn't write %s\n", filename); error("Couldn't write %s", filename);
close(fd); close(fd);
return -1; return -1;
} }

View File

@ -564,7 +564,7 @@ static void prepare_packed_git_one(char *objdir, int local)
dir = opendir(path); dir = opendir(path);
if (!dir) { if (!dir) {
if (errno != ENOENT) if (errno != ENOENT)
error("unable to open object pack directory: %s: %s\n", error("unable to open object pack directory: %s: %s",
path, strerror(errno)); path, strerror(errno));
return; return;
} }
@ -1513,7 +1513,8 @@ int write_sha1_from_fd(const unsigned char *sha1, int fd, char *buffer,
local = mkstemp(tmpfile); local = mkstemp(tmpfile);
if (local < 0) if (local < 0)
return error("Couldn't open %s for %s\n", tmpfile, sha1_to_hex(sha1)); return error("Couldn't open %s for %s",
tmpfile, sha1_to_hex(sha1));
memset(&stream, 0, sizeof(stream)); memset(&stream, 0, sizeof(stream));
@ -1561,7 +1562,7 @@ int write_sha1_from_fd(const unsigned char *sha1, int fd, char *buffer,
} }
if (memcmp(sha1, real_sha1, 20)) { if (memcmp(sha1, real_sha1, 20)) {
unlink(tmpfile); unlink(tmpfile);
return error("File %s has bad hash\n", sha1_to_hex(sha1)); return error("File %s has bad hash", sha1_to_hex(sha1));
} }
return move_temp_to_file(tmpfile, sha1_file_name(sha1)); return move_temp_to_file(tmpfile, sha1_file_name(sha1));