Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

0 comments on commit 82247e9

Please sign in to comment.
Something went wrong with that request. Please try again.