Merge branch 'pw/message-cleanup'

Many error/warning messages had extra trailing newlines that are
unnecessary.

By Pete Wyckoff
* pw/message-cleanup:
  remove blank filename in error message
  remove superfluous newlines in error messages
This commit is contained in:
Junio C Hamano 2012-05-02 13:53:35 -07:00
Родитель 29c2a3dbad 5eaeda70de
Коммит 2fa4fff4b9
15 изменённых файлов: 24 добавлений и 24 удалений

Просмотреть файл

@ -663,7 +663,7 @@ static int edit_branch_description(const char *branch_name)
fp = fopen(git_path(edit_description), "w"); fp = fopen(git_path(edit_description), "w");
if ((fwrite(buf.buf, 1, buf.len, fp) < buf.len) || fclose(fp)) { if ((fwrite(buf.buf, 1, buf.len, fp) < buf.len) || fclose(fp)) {
strbuf_release(&buf); strbuf_release(&buf);
return error(_("could not write branch description template: %s\n"), return error(_("could not write branch description template: %s"),
strerror(errno)); strerror(errno));
} }
strbuf_reset(&buf); strbuf_reset(&buf);

Просмотреть файл

@ -63,7 +63,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
if (quiet) { if (quiet) {
if (!freopen("/dev/null", "w", stderr)) if (!freopen("/dev/null", "w", stderr))
return error("failed to redirect stderr to /dev/null: " return error("failed to redirect stderr to /dev/null: "
"%s\n", strerror(errno)); "%s", strerror(errno));
} }
if (prefix) if (prefix)
@ -76,7 +76,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
if (read_mmfile(mmfs + i, fname)) if (read_mmfile(mmfs + i, fname))
return -1; return -1;
if (buffer_is_binary(mmfs[i].ptr, mmfs[i].size)) if (buffer_is_binary(mmfs[i].ptr, mmfs[i].size))
return error("Cannot merge binary files: %s\n", return error("Cannot merge binary files: %s",
argv[i]); argv[i]);
} }

Просмотреть файл

@ -107,7 +107,7 @@ static void *get_data(unsigned long size)
if (stream.total_out == size && ret == Z_STREAM_END) if (stream.total_out == size && ret == Z_STREAM_END)
break; break;
if (ret != Z_OK) { if (ret != Z_OK) {
error("inflate returned %d\n", ret); error("inflate returned %d", ret);
free(buf); free(buf);
buf = NULL; buf = NULL;
if (!recover) if (!recover)

Просмотреть файл

@ -30,7 +30,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
temp = MapViewOfFileEx(hmap, FILE_MAP_COPY, h, l, length, start); temp = MapViewOfFileEx(hmap, FILE_MAP_COPY, h, l, length, start);
if (!CloseHandle(hmap)) if (!CloseHandle(hmap))
warning("unable to close file mapping handle\n"); warning("unable to close file mapping handle");
return temp ? temp : MAP_FAILED; return temp ? temp : MAP_FAILED;
} }

Просмотреть файл

@ -518,7 +518,7 @@ int cmd_fetch__tool(int argc, const char **argv, const char *prefix)
filename = git_path("FETCH_HEAD"); filename = git_path("FETCH_HEAD");
fp = fopen(filename, "a"); fp = fopen(filename, "a");
if (!fp) if (!fp)
return error("cannot open %s: %s\n", filename, strerror(errno)); return error("cannot open %s: %s", filename, strerror(errno));
result = append_fetch_head(fp, argv[2], argv[3], result = append_fetch_head(fp, argv[2], argv[3],
argv[4], argv[5], argv[4], argv[5],
argv[6], !!argv[7][0], argv[6], !!argv[7][0],
@ -536,7 +536,7 @@ int cmd_fetch__tool(int argc, const char **argv, const char *prefix)
filename = git_path("FETCH_HEAD"); filename = git_path("FETCH_HEAD");
fp = fopen(filename, "a"); fp = fopen(filename, "a");
if (!fp) if (!fp)
return error("cannot open %s: %s\n", filename, strerror(errno)); return error("cannot open %s: %s", filename, strerror(errno));
result = fetch_native_store(fp, argv[2], argv[3], argv[4], result = fetch_native_store(fp, argv[2], argv[3], argv[4],
verbose, force); verbose, force);
fclose(fp); fclose(fp);

2
fsck.c
Просмотреть файл

@ -27,7 +27,7 @@ static int fsck_walk_tree(struct tree *tree, fsck_walk_func walk, void *data)
else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode)) else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode))
result = walk(&lookup_blob(entry.sha1)->object, OBJ_BLOB, data); result = walk(&lookup_blob(entry.sha1)->object, OBJ_BLOB, data);
else { else {
result = error("in tree %s: entry %s has bad mode %.6o\n", result = error("in tree %s: entry %s has bad mode %.6o",
sha1_to_hex(tree->object.sha1), entry.path, entry.mode); sha1_to_hex(tree->object.sha1), entry.path, entry.mode);
} }
if (result < 0) if (result < 0)

Просмотреть файл

@ -1108,7 +1108,7 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
if (repo->path) if (repo->path)
url = repo->path; url = repo->path;
if (strncmp(path, url, repo->path_len)) if (strncmp(path, url, repo->path_len))
error("Parsed path '%s' does not match url: '%s'\n", error("Parsed path '%s' does not match url: '%s'",
path, url); path, url);
else { else {
path += repo->path_len; path += repo->path_len;
@ -1702,7 +1702,7 @@ static int delete_remote_branch(const char *pattern, int force)
run_active_slot(slot); run_active_slot(slot);
free(url); free(url);
if (results.curl_result != CURLE_OK) if (results.curl_result != CURLE_OK)
return error("DELETE request failed (%d/%ld)\n", return error("DELETE request failed (%d/%ld)",
results.curl_result, results.http_code); results.curl_result, results.http_code);
} else { } else {
free(url); free(url);

2
http.c
Просмотреть файл

@ -917,7 +917,7 @@ static char *fetch_pack_index(unsigned char *sha1, const char *base_url)
tmp = strbuf_detach(&buf, NULL); tmp = strbuf_detach(&buf, NULL);
if (http_get_file(url, tmp, 0) != HTTP_OK) { if (http_get_file(url, tmp, 0) != HTTP_OK) {
error("Unable to get pack index %s\n", url); error("Unable to get pack index %s", url);
free(tmp); free(tmp);
tmp = NULL; tmp = NULL;
} }

Просмотреть файл

@ -1022,7 +1022,7 @@ static int auth_cram_md5(struct imap_store *ctx, struct imap_cmd *cmd, const cha
ret = socket_write(&ctx->imap->buf.sock, response, strlen(response)); ret = socket_write(&ctx->imap->buf.sock, response, strlen(response));
if (ret != strlen(response)) if (ret != strlen(response))
return error("IMAP error: sending response failed\n"); return error("IMAP error: sending response failed");
free(response); free(response);

Просмотреть файл

@ -73,7 +73,7 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
if (buffer_is_binary(orig->ptr, orig->size) || if (buffer_is_binary(orig->ptr, orig->size) ||
buffer_is_binary(src1->ptr, src1->size) || buffer_is_binary(src1->ptr, src1->size) ||
buffer_is_binary(src2->ptr, src2->size)) { buffer_is_binary(src2->ptr, src2->size)) {
warning("Cannot merge binary files: %s (%s vs. %s)\n", warning("Cannot merge binary files: %s (%s vs. %s)",
path, name1, name2); path, name1, name2);
return ll_binary_merge(drv_unused, result, return ll_binary_merge(drv_unused, result,
path, path,

Просмотреть файл

@ -176,7 +176,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
obj = &tag->object; obj = &tag->object;
} }
} else { } else {
warning("object %s has unknown type id %d\n", sha1_to_hex(sha1), type); warning("object %s has unknown type id %d", sha1_to_hex(sha1), type);
obj = NULL; obj = NULL;
} }
if (obj && obj->type == OBJ_NONE) if (obj && obj->type == OBJ_NONE)
@ -202,7 +202,7 @@ struct object *parse_object(const unsigned char *sha1)
(!obj && has_sha1_file(sha1) && (!obj && has_sha1_file(sha1) &&
sha1_object_info(sha1, NULL) == OBJ_BLOB)) { sha1_object_info(sha1, NULL) == OBJ_BLOB)) {
if (check_sha1_signature(repl, NULL, 0, NULL) < 0) { if (check_sha1_signature(repl, NULL, 0, NULL) < 0) {
error("sha1 mismatch %s\n", sha1_to_hex(repl)); error("sha1 mismatch %s", sha1_to_hex(repl));
return NULL; return NULL;
} }
parse_blob_buffer(lookup_blob(sha1), NULL, 0); parse_blob_buffer(lookup_blob(sha1), NULL, 0);
@ -213,7 +213,7 @@ struct object *parse_object(const unsigned char *sha1)
if (buffer) { if (buffer) {
if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) { if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
free(buffer); free(buffer);
error("sha1 mismatch %s\n", sha1_to_hex(repl)); error("sha1 mismatch %s", sha1_to_hex(repl));
return NULL; return NULL;
} }

Просмотреть файл

@ -2417,7 +2417,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
unlink_or_warn(tmpfile); unlink_or_warn(tmpfile);
if (ret) { if (ret) {
if (ret != EEXIST) { if (ret != EEXIST) {
return error("unable to write sha1 filename %s: %s\n", filename, strerror(ret)); return error("unable to write sha1 filename %s: %s", filename, strerror(ret));
} }
/* FIXME!!! Collision check here ? */ /* FIXME!!! Collision check here ? */
} }
@ -2509,9 +2509,9 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
fd = create_tmpfile(tmp_file, sizeof(tmp_file), filename); fd = create_tmpfile(tmp_file, sizeof(tmp_file), filename);
if (fd < 0) { if (fd < 0) {
if (errno == EACCES) if (errno == EACCES)
return error("insufficient permission for adding an object to repository database %s\n", get_object_directory()); return error("insufficient permission for adding an object to repository database %s", get_object_directory());
else else
return error("unable to create temporary sha1 filename %s: %s\n", tmp_file, strerror(errno)); return error("unable to create temporary file: %s", strerror(errno));
} }
/* Set it up */ /* Set it up */

Просмотреть файл

@ -199,7 +199,7 @@ static struct child_process *get_helper(struct transport *transport)
data->import_marks = strbuf_detach(&arg, NULL); data->import_marks = strbuf_detach(&arg, NULL);
} else if (mandatory) { } else if (mandatory) {
die("Unknown mandatory capability %s. This remote " die("Unknown mandatory capability %s. This remote "
"helper probably needs newer version of Git.\n", "helper probably needs newer version of Git.",
capname); capname);
} }
} }
@ -599,7 +599,7 @@ static void push_update_ref_status(struct strbuf *buf,
status = REF_STATUS_REMOTE_REJECT; status = REF_STATUS_REMOTE_REJECT;
refname = buf->buf + 6; refname = buf->buf + 6;
} else } else
die("expected ok/error, helper said '%s'\n", buf->buf); die("expected ok/error, helper said '%s'", buf->buf);
msg = strchr(refname, ' '); msg = strchr(refname, ' ');
if (msg) { if (msg) {

Просмотреть файл

@ -1793,7 +1793,7 @@ int bind_merge(struct cache_entry **src,
struct cache_entry *a = src[1]; struct cache_entry *a = src[1];
if (o->merge_size != 1) if (o->merge_size != 1)
return error("Cannot do a bind merge of %d trees\n", return error("Cannot do a bind merge of %d trees",
o->merge_size); o->merge_size);
if (a && old) if (a && old)
return o->gently ? -1 : return o->gently ? -1 :

Просмотреть файл

@ -175,7 +175,7 @@ static void read_props(void)
int ch; int ch;
if (!type || t[1] != ' ') if (!type || t[1] != ' ')
die("invalid property line: %s\n", t); die("invalid property line: %s", t);
len = atoi(&t[2]); len = atoi(&t[2]);
strbuf_reset(&val); strbuf_reset(&val);
buffer_read_binary(&input, &val, len); buffer_read_binary(&input, &val, len);
@ -201,7 +201,7 @@ static void read_props(void)
strbuf_reset(&key); strbuf_reset(&key);
continue; continue;
default: default:
die("invalid property line: %s\n", t); die("invalid property line: %s", t);
} }
} }
} }