remove superfluous newlines in error messages
authorPete Wyckoff <pw@padd.com>
Mon, 30 Apr 2012 00:28:45 +0000 (20:28 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Apr 2012 22:45:51 +0000 (15:45 -0700)
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>
15 files changed:
builtin/branch.c
builtin/merge-file.c
builtin/unpack-objects.c
compat/win32mmap.c
contrib/examples/builtin-fetch--tool.c
fsck.c
http-push.c
http.c
imap-send.c
ll-merge.c
object.c
sha1_file.c
transport-helper.c
unpack-trees.c
vcs-svn/svndump.c

index 5f150b4e8ae87478bcc35408c333042615373cd2..dc353ffe6590a12096c3add5ac6facd2c95424a9 100644 (file)
@@ -657,7 +657,7 @@ static int edit_branch_description(const char *branch_name)
        fp = fopen(git_path(edit_description), "w");
        if ((fwrite(buf.buf, 1, buf.len, fp) < buf.len) || fclose(fp)) {
                strbuf_release(&buf);
-               return error(_("could not write branch description template: %s\n"),
+               return error(_("could not write branch description template: %s"),
                             strerror(errno));
        }
        strbuf_reset(&buf);
index 237abd3c0b27b601aca140bfb67a302666ff9cf2..6f0efef43c5b93c87fa8f586319cd03c8018bd55 100644 (file)
@@ -63,7 +63,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
        if (quiet) {
                if (!freopen("/dev/null", "w", stderr))
                        return error("failed to redirect stderr to /dev/null: "
-                                    "%s\n", strerror(errno));
+                                    "%s", strerror(errno));
        }
 
        if (prefix)
@@ -76,7 +76,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
                if (read_mmfile(mmfs + i, fname))
                        return -1;
                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]);
        }
 
index 14e04e6795bd514fb1fec506073d8a9a71668cfa..2217d7b3ae57235fc25ac3f5bf8429588aa034c4 100644 (file)
@@ -107,7 +107,7 @@ static void *get_data(unsigned long size)
                if (stream.total_out == size && ret == Z_STREAM_END)
                        break;
                if (ret != Z_OK) {
-                       error("inflate returned %d\n", ret);
+                       error("inflate returned %d", ret);
                        free(buf);
                        buf = NULL;
                        if (!recover)
index b58aa69fa0609dad7f591024f9da31dfa58496fb..61d2ef8e46084ef14ea22690a68c6c99e2644455 100644 (file)
@@ -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);
 
        if (!CloseHandle(hmap))
-               warning("unable to close file mapping handle\n");
+               warning("unable to close file mapping handle");
 
        return temp ? temp : MAP_FAILED;
 }
index 3140e405fa130a0fa20b2f6ee4171da70935de66..0d54aa7061e780dd0000b8c2a48e266ad5b8ce53 100644 (file)
@@ -518,7 +518,7 @@ int cmd_fetch__tool(int argc, const char **argv, const char *prefix)
                filename = git_path("FETCH_HEAD");
                fp = fopen(filename, "a");
                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],
                                           argv[4], argv[5],
                                           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");
                fp = fopen(filename, "a");
                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],
                                            verbose, force);
                fclose(fp);
diff --git a/fsck.c b/fsck.c
index 6c855f84f01c19678399d85181da1094bd61b371..4c63b2cc41eec4f568ee6f0d18a51c97304d5d96 100644 (file)
--- a/fsck.c
+++ b/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))
                        result = walk(&lookup_blob(entry.sha1)->object, OBJ_BLOB, data);
                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);
                }
                if (result < 0)
index f22f7e43caa3e804c5c8275ba0312d58611d7da3..1df7ab5670d0ba2823da14083934925b0f05c926 100644 (file)
@@ -1108,7 +1108,7 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
                                if (repo->path)
                                        url = repo->path;
                                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);
                                else {
                                        path += repo->path_len;
@@ -1702,7 +1702,7 @@ static int delete_remote_branch(const char *pattern, int force)
                run_active_slot(slot);
                free(url);
                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);
        } else {
                free(url);
diff --git a/http.c b/http.c
index 2ec37891f36693b278b095b51331531a23d96d36..5cb87f16f25fe3d32e2594c8c6325d562eddc9ca 100644 (file)
--- a/http.c
+++ b/http.c
@@ -917,7 +917,7 @@ static char *fetch_pack_index(unsigned char *sha1, const char *base_url)
        tmp = strbuf_detach(&buf, NULL);
 
        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);
                tmp = NULL;
        }
index 972ad62cd92ff2b09fb5caa21b24f471009ef19b..d42e4712972794f055aec6630ba86797d7e5343c 100644 (file)
@@ -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));
        if (ret != strlen(response))
-               return error("IMAP error: sending response failed\n");
+               return error("IMAP error: sending response failed");
 
        free(response);
 
index da59738c9b787ae082ad062a91345a60628e704a..f3f7692158666ffd2ab6f65f4040462e4a7d2d00 100644 (file)
@@ -73,7 +73,7 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
        if (buffer_is_binary(orig->ptr, orig->size) ||
            buffer_is_binary(src1->ptr, src1->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);
                return ll_binary_merge(drv_unused, result,
                                       path,
index 49a864ce54e6ca0f21ad86aab27a422570d1bcec..4af3451bf89471a0ab7a148aad4924a8ac8ae053 100644 (file)
--- a/object.c
+++ b/object.c
@@ -176,7 +176,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
                        obj = &tag->object;
                }
        } 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;
        }
        if (obj && obj->type == OBJ_NONE)
@@ -202,7 +202,7 @@ struct object *parse_object(const unsigned char *sha1)
            (!obj && has_sha1_file(sha1) &&
             sha1_object_info(sha1, NULL) == OBJ_BLOB)) {
                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;
                }
                parse_blob_buffer(lookup_blob(sha1), NULL, 0);
@@ -213,7 +213,7 @@ struct object *parse_object(const unsigned char *sha1)
        if (buffer) {
                if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {
                        free(buffer);
-                       error("sha1 mismatch %s\n", sha1_to_hex(repl));
+                       error("sha1 mismatch %s", sha1_to_hex(repl));
                        return NULL;
                }
 
index ad314f08b9abd9a16b410483f9a9629ce59345cf..c8d572d1384b45385c184656eff26eb00d420960 100644 (file)
@@ -2417,7 +2417,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
        unlink_or_warn(tmpfile);
        if (ret) {
                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 ? */
        }
@@ -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);
        if (fd < 0) {
                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
-                       return error("unable to create temporary sha1 filename %s: %s\n", tmp_file, strerror(errno));
+                       return error("unable to create temporary sha1 filename %s: %s", tmp_file, strerror(errno));
        }
 
        /* Set it up */
index f6b3b1fb79468ef85eb9581c7d44ff04c1bb61bc..61c928f6cd85aa9cf60942208423e615c9b99352 100644 (file)
@@ -199,7 +199,7 @@ static struct child_process *get_helper(struct transport *transport)
                        data->import_marks = strbuf_detach(&arg, NULL);
                } else if (mandatory) {
                        die("Unknown mandatory capability %s. This remote "
-                           "helper probably needs newer version of Git.\n",
+                           "helper probably needs newer version of Git.",
                            capname);
                }
        }
@@ -599,7 +599,7 @@ static void push_update_ref_status(struct strbuf *buf,
                status = REF_STATUS_REMOTE_REJECT;
                refname = buf->buf + 6;
        } else
-               die("expected ok/error, helper said '%s'\n", buf->buf);
+               die("expected ok/error, helper said '%s'", buf->buf);
 
        msg = strchr(refname, ' ');
        if (msg) {
index 36523da22aedba160c5a29f95bf339f05dfc6feb..7cfa026b1a554cf915ac6c73b10d3f7f3713930c 100644 (file)
@@ -1792,7 +1792,7 @@ int bind_merge(struct cache_entry **src,
        struct cache_entry *a = src[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);
        if (a && old)
                return o->gently ? -1 :
index 644fdc71ba8c665f5dfadd552c3da63f4d8498e9..0899790a3331d82b72ba3e58fd7ff6ff83b38466 100644 (file)
@@ -175,7 +175,7 @@ static void read_props(void)
                int ch;
 
                if (!type || t[1] != ' ')
-                       die("invalid property line: %s\n", t);
+                       die("invalid property line: %s", t);
                len = atoi(&t[2]);
                strbuf_reset(&val);
                buffer_read_binary(&input, &val, len);
@@ -201,7 +201,7 @@ static void read_props(void)
                        strbuf_reset(&key);
                        continue;
                default:
-                       die("invalid property line: %s\n", t);
+                       die("invalid property line: %s", t);
                }
        }
 }