]> git.ipfire.org Git - thirdparty/git.git/blobdiff - combine-diff.c
config.c: Escape backslashes in section names properly
[thirdparty/git.git] / combine-diff.c
index f1e7a4d5d98f8705b6a1a7a420dccc9ecad69d63..588c58bc55dfe78998d40a4dcce2a7b6ea6f7f5a 100644 (file)
@@ -701,7 +701,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
                else if (0 <= (fd = open(elem->path, O_RDONLY)) &&
                         !fstat(fd, &st)) {
                        size_t len = xsize_t(st.st_size);
-                       size_t sz = 0;
+                       ssize_t done;
                        int is_file, i;
 
                        elem->mode = canon_mode(st.st_mode);
@@ -716,14 +716,13 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 
                        result_size = len;
                        result = xmalloc(len + 1);
-                       while (sz < len) {
-                               ssize_t done = xread(fd, result+sz, len-sz);
-                               if (done == 0 && sz != len)
-                                       die("early EOF '%s'", elem->path);
-                               else if (done < 0)
-                                       die("read error '%s'", elem->path);
-                               sz += done;
-                       }
+
+                       done = read_in_full(fd, result, len);
+                       if (done < 0)
+                               die("read error '%s'", elem->path);
+                       else if (done < len)
+                               die("early EOF '%s'", elem->path);
+
                        result[len] = 0;
                }
                else {
@@ -798,7 +797,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
                int deleted = 0;
 
                if (rev->loginfo && !rev->no_commit_id)
-                       show_log(rev, opt->msg_sep);
+                       show_log(rev);
                dump_quoted_path(dense ? "diff --cc " : "diff --combined ",
                                 "", elem->path, c_meta, c_reset);
                printf("%sindex ", c_meta);
@@ -881,7 +880,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
                inter_name_termination = 0;
 
        if (rev->loginfo && !rev->no_commit_id)
-               show_log(rev, opt->msg_sep);
+               show_log(rev);
 
        if (opt->output_format & DIFF_FORMAT_RAW) {
                offset = strlen(COLONS) - num_parent;
@@ -962,7 +961,7 @@ void diff_tree_combined(const unsigned char *sha1,
                paths = intersect_paths(paths, i, num_parent);
 
                if (show_log_first && i == 0) {
-                       show_log(rev, opt->msg_sep);
+                       show_log(rev);
                        if (rev->verbose_header && opt->output_format)
                                putchar(opt->line_termination);
                }