]> git.ipfire.org Git - thirdparty/git.git/blobdiff - diff.c
Merge branch 'fix'
[thirdparty/git.git] / diff.c
diff --git a/diff.c b/diff.c
index 6762fcee5af881b93b97da2dff190137768c1a8e..5315270601eeb6ab54a12d97f69c5f29679c4cf7 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -296,7 +296,6 @@ static const char minuses[]= "--------------------------------------------------
 
 static void show_stats(struct diffstat_t* data)
 {
-       char *prefix = "";
        int i, len, add, del, total, adds = 0, dels = 0;
        int max, max_change = 0, max_len = 0;
        int total_files = data->nr;
@@ -318,6 +317,7 @@ static void show_stats(struct diffstat_t* data)
        }
 
        for (i = 0; i < data->nr; i++) {
+               char *prefix = "";
                char *name = data->files[i]->name;
                int added = data->files[i]->added;
                int deleted = data->files[i]->deleted;
@@ -1018,14 +1018,12 @@ static void run_diff(struct diff_filepair *p, struct diff_options *o)
        }
 
        if (memcmp(one->sha1, two->sha1, 20)) {
-               char one_sha1[41];
                int abbrev = o->full_index ? 40 : DEFAULT_ABBREV;
-               memcpy(one_sha1, sha1_to_hex(one->sha1), 41);
 
                len += snprintf(msg + len, sizeof(msg) - len,
                                "index %.*s..%.*s",
-                               abbrev, one_sha1, abbrev,
-                               sha1_to_hex(two->sha1));
+                               abbrev, sha1_to_hex(one->sha1),
+                               abbrev, sha1_to_hex(two->sha1));
                if (one->mode == two->mode)
                        len += snprintf(msg + len, sizeof(msg) - len,
                                        " %06o", one->mode);