remove superfluous newlines in error messages

The error handling routines add a newline. Remove the duplicate ones in error messages. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pete Wyckoff committed Apr 29, 2012 at 20:28 UTC 82247e9bd5f7c90c4eac9674fb7518845cd3e432
15 files changed +24 -24
builtin/branch.c
+1 -1
@@ -657,7 +657,7 @@ static int edit_branch_description(const char *branch_name)
657 fp = fopen(git_path(edit_description), "w");
658 if ((fwrite(buf.buf, 1, buf.len, fp) < buf.len) || fclose(fp)) {
659 strbuf_release(&buf);
660 - return error(_("could not write branch description template: %s\n"),
660 + return error(_("could not write branch description template: %s"),
661 strerror(errno));
662 }
663 strbuf_reset(&buf);
builtin/merge-file.c
+2 -2
@@ -63,7 +63,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
63 if (quiet) {
64 if (!freopen("/dev/null", "w", stderr))
65 return error("failed to redirect stderr to /dev/null: "
66 - "%s\n", strerror(errno));
66 + "%s", strerror(errno));
67 }
68
69 if (prefix)
@@ -76,7 +76,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
76 if (read_mmfile(mmfs + i, fname))
77 return -1;
78 if (buffer_is_binary(mmfs[i].ptr, mmfs[i].size))
79 - return error("Cannot merge binary files: %s\n",
79 + return error("Cannot merge binary files: %s",
80 argv[i]);
81 }
82
builtin/unpack-objects.c
+1 -1
@@ -107,7 +107,7 @@ static void *get_data(unsigned long size)
107 if (stream.total_out == size && ret == Z_STREAM_END)
108 break;
109 if (ret != Z_OK) {
110 - error("inflate returned %d\n", ret);
110 + error("inflate returned %d", ret);
111 free(buf);
112 buf = NULL;
113 if (!recover)
compat/win32mmap.c
+1 -1
@@ -30,7 +30,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
30 temp = MapViewOfFileEx(hmap, FILE_MAP_COPY, h, l, length, start);
31
32 if (!CloseHandle(hmap))
33 - warning("unable to close file mapping handle\n");
33 + warning("unable to close file mapping handle");
34
35 return temp ? temp : MAP_FAILED;
36 }
contrib/examples/builtin-fetch--tool.c
+2 -2
@@ -518,7 +518,7 @@ int cmd_fetch__tool(int argc, const char **argv, const char *prefix)
518 filename = git_path("FETCH_HEAD");
519 fp = fopen(filename, "a");
520 if (!fp)
521 - return error("cannot open %s: %s\n", filename, strerror(errno));
521 + return error("cannot open %s: %s", filename, strerror(errno));
522 result = append_fetch_head(fp, argv[2], argv[3],
523 argv[4], argv[5],
524 argv[6], !!argv[7][0],
@@ -536,7 +536,7 @@ int cmd_fetch__tool(int argc, const char **argv, const char *prefix)
536 filename = git_path("FETCH_HEAD");
537 fp = fopen(filename, "a");
538 if (!fp)
539 - return error("cannot open %s: %s\n", filename, strerror(errno));
539 + return error("cannot open %s: %s", filename, strerror(errno));
540 result = fetch_native_store(fp, argv[2], argv[3], argv[4],
541 verbose, force);
542 fclose(fp);
fsck.c
+1 -1
@@ -27,7 +27,7 @@ static int fsck_walk_tree(struct tree *tree, fsck_walk_func walk, void *data)
27 else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode))
28 result = walk(&lookup_blob(entry.sha1)->object, OBJ_BLOB, data);
29 else {
30 - result = error("in tree %s: entry %s has bad mode %.6o\n",
30 + result = error("in tree %s: entry %s has bad mode %.6o",
31 sha1_to_hex(tree->object.sha1), entry.path, entry.mode);
32 }
33 if (result < 0)
http-push.c
+2 -2
@@ -1108,7 +1108,7 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
1108 if (repo->path)
1109 url = repo->path;
1110 if (strncmp(path, url, repo->path_len))
1111 - error("Parsed path '%s' does not match url: '%s'\n",
1111 + error("Parsed path '%s' does not match url: '%s'",
1112 path, url);
1113 else {
1114 path += repo->path_len;
@@ -1702,7 +1702,7 @@ static int delete_remote_branch(const char *pattern, int force)
1702 run_active_slot(slot);
1703 free(url);
1704 if (results.curl_result != CURLE_OK)
1705 - return error("DELETE request failed (%d/%ld)\n",
1705 + return error("DELETE request failed (%d/%ld)",
1706 results.curl_result, results.http_code);
1707 } else {
1708 free(url);
http.c
+1 -1
@@ -917,7 +917,7 @@ static char *fetch_pack_index(unsigned char *sha1, const char *base_url)
917 tmp = strbuf_detach(&buf, NULL);
918
919 if (http_get_file(url, tmp, 0) != HTTP_OK) {
920 - error("Unable to get pack index %s\n", url);
920 + error("Unable to get pack index %s", url);
921 free(tmp);
922 tmp = NULL;
923 }
imap-send.c
+1 -1
@@ -1022,7 +1022,7 @@ static int auth_cram_md5(struct imap_store *ctx, struct imap_cmd *cmd, const cha
1022
1023 ret = socket_write(&ctx->imap->buf.sock, response, strlen(response));
1024 if (ret != strlen(response))
1025 - return error("IMAP error: sending response failed\n");
1025 + return error("IMAP error: sending response failed");
1026
1027 free(response);
1028
ll-merge.c
+1 -1
@@ -73,7 +73,7 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
73 if (buffer_is_binary(orig->ptr, orig->size) ||
74 buffer_is_binary(src1->ptr, src1->size) ||
75 buffer_is_binary(src2->ptr, src2->size)) {
76 - warning("Cannot merge binary files: %s (%s vs. %s)\n",
76 + warning("Cannot merge binary files: %s (%s vs. %s)",
77 path, name1, name2);
78 return ll_binary_merge(drv_unused, result,
79 path,
object.c
+3 -3
@@ -176,7 +176,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
176 obj = &tag->object;
177 }
178 } else {
179 - warning("object %s has unknown type id %d\n", sha1_to_hex(sha1), type);
179 + warning("object %s has unknown type id %d", sha1_to_hex(sha1), type);
180 obj = NULL;
181 }
182 if (obj && obj->type == OBJ_NONE)
@@ -202,7 +202,7 @@ struct object *parse_object(const unsigned char *sha1)
202 (!obj && has_sha1_file(sha1) &&
203 sha1_object_info(sha1, NULL) == OBJ_BLOB)) {
204 if (check_sha1_signature(repl, NULL, 0, NULL) < 0) {
205 - error("sha1 mismatch %s\n", sha1_to_hex(repl));
205 + error("sha1 mismatch %s", sha1_to_hex(repl));
206 return NULL;
207 }
208 parse_blob_buffer(lookup_blob(sha1), NULL, 0);
@@ -213,7 +213,7 @@ struct object *parse_object(const unsigned char *sha1)
213 if (buffer) {
214 if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
215 free(buffer);
216 - error("sha1 mismatch %s\n", sha1_to_hex(repl));
216 + error("sha1 mismatch %s", sha1_to_hex(repl));
217 return NULL;
218 }
219
sha1_file.c
+3 -3
@@ -2417,7 +2417,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
2417 unlink_or_warn(tmpfile);
2418 if (ret) {
2419 if (ret != EEXIST) {
2420 - return error("unable to write sha1 filename %s: %s\n", filename, strerror(ret));
2420 + return error("unable to write sha1 filename %s: %s", filename, strerror(ret));
2421 }
2422 /* FIXME!!! Collision check here ? */
2423 }
@@ -2509,9 +2509,9 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
2509 fd = create_tmpfile(tmp_file, sizeof(tmp_file), filename);
2510 if (fd < 0) {
2511 if (errno == EACCES)
2512 - return error("insufficient permission for adding an object to repository database %s\n", get_object_directory());
2512 + return error("insufficient permission for adding an object to repository database %s", get_object_directory());
2513 else
2514 - return error("unable to create temporary sha1 filename %s: %s\n", tmp_file, strerror(errno));
2514 + return error("unable to create temporary sha1 filename %s: %s", tmp_file, strerror(errno));
2515 }
2516
2517 /* Set it up */
transport-helper.c
+2 -2
@@ -199,7 +199,7 @@ static struct child_process *get_helper(struct transport *transport)
199 data->import_marks = strbuf_detach(&arg, NULL);
200 } else if (mandatory) {
201 die("Unknown mandatory capability %s. This remote "
202 - "helper probably needs newer version of Git.\n",
202 + "helper probably needs newer version of Git.",
203 capname);
204 }
205 }
@@ -599,7 +599,7 @@ static void push_update_ref_status(struct strbuf *buf,
599 status = REF_STATUS_REMOTE_REJECT;
600 refname = buf->buf + 6;
601 } else
602 - die("expected ok/error, helper said '%s'\n", buf->buf);
602 + die("expected ok/error, helper said '%s'", buf->buf);
603
604 msg = strchr(refname, ' ');
605 if (msg) {
unpack-trees.c
+1 -1
@@ -1792,7 +1792,7 @@ int bind_merge(struct cache_entry **src,
1792 struct cache_entry *a = src[1];
1793
1794 if (o->merge_size != 1)
1795 - return error("Cannot do a bind merge of %d trees\n",
1795 + return error("Cannot do a bind merge of %d trees",
1796 o->merge_size);
1797 if (a && old)
1798 return o->gently ? -1 :
vcs-svn/svndump.c
+2 -2
@@ -175,7 +175,7 @@ static void read_props(void)
175 int ch;
176
177 if (!type || t[1] != ' ')
178 - die("invalid property line: %s\n", t);
178 + die("invalid property line: %s", t);
179 len = atoi(&t[2]);
180 strbuf_reset(&val);
181 buffer_read_binary(&input, &val, len);
@@ -201,7 +201,7 @@ static void read_props(void)
201 strbuf_reset(&key);
202 continue;
203 default:
204 - die("invalid property line: %s\n", t);
204 + die("invalid property line: %s", t);
205 }
206 }
207 }