Fix typo in draft 1.5.4 release notes
[gitweb.git] / builtin-fetch.c
index c1930aaa0e00c1c68658370d05c8c2902b123161..31e138eab82a4a710916ff88386bd82bcf2f11d6 100644 (file)
@@ -31,7 +31,7 @@ static void unlock_pack_on_signal(int signo)
 }
 
 static void add_merge_config(struct ref **head,
-                          struct ref *remote_refs,
+                          const struct ref *remote_refs,
                           struct branch *branch,
                           struct ref ***tail)
 {
@@ -79,7 +79,7 @@ static struct ref *get_ref_map(struct transport *transport,
        struct ref *ref_map = NULL;
        struct ref **tail = &ref_map;
 
-       struct ref *remote_refs = transport_get_remote_refs(transport);
+       const struct ref *remote_refs = transport_get_remote_refs(transport);
 
        if (ref_count || tags) {
                for (i = 0; i < ref_count; i++) {
@@ -154,6 +154,7 @@ static int s_update_ref(const char *action,
 }
 
 #define SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3)
+#define REFCOL_WIDTH  10
 
 static int update_local_ref(struct ref *ref,
                            const char *remote,
@@ -183,8 +184,9 @@ static int update_local_ref(struct ref *ref,
 
        if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
                if (verbose)
-                       sprintf(display, "= %-*s %s -> %s", SUMMARY_WIDTH,
-                               "[up to date]", remote, pretty_ref);
+                       sprintf(display, "= %-*s %-*s -> %s", SUMMARY_WIDTH,
+                               "[up to date]", REFCOL_WIDTH, remote,
+                               pretty_ref);
                return 0;
        }
 
@@ -196,15 +198,17 @@ static int update_local_ref(struct ref *ref,
                 * If this is the head, and it's not okay to update
                 * the head, and the old value of the head isn't empty...
                 */
-               sprintf(display, "! %-*s %s -> %s  (can't  fetch in current branch)",
-                       SUMMARY_WIDTH, "[rejected]", remote, pretty_ref);
+               sprintf(display, "! %-*s %-*s -> %s  (can't fetch in current branch)",
+                       SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
+                       pretty_ref);
                return 1;
        }
 
        if (!is_null_sha1(ref->old_sha1) &&
            !prefixcmp(ref->name, "refs/tags/")) {
-               sprintf(display, "- %-*s %s -> %s",
-                       SUMMARY_WIDTH, "[tag update]", remote, pretty_ref);
+               sprintf(display, "- %-*s %-*s -> %s",
+                       SUMMARY_WIDTH, "[tag update]", REFCOL_WIDTH, remote,
+                       pretty_ref);
                return s_update_ref("updating tag", ref, 0);
        }
 
@@ -222,8 +226,8 @@ static int update_local_ref(struct ref *ref,
                        what = "[new branch]";
                }
 
-               sprintf(display, "* %-*s %s -> %s",
-                       SUMMARY_WIDTH, what, remote, pretty_ref);
+               sprintf(display, "* %-*s %-*s -> %s", SUMMARY_WIDTH, what,
+                       REFCOL_WIDTH, remote, pretty_ref);
                return s_update_ref(msg, ref, 0);
        }
 
@@ -232,20 +236,21 @@ static int update_local_ref(struct ref *ref,
                strcpy(quickref, find_unique_abbrev(current->object.sha1, DEFAULT_ABBREV));
                strcat(quickref, "..");
                strcat(quickref, find_unique_abbrev(ref->new_sha1, DEFAULT_ABBREV));
-               sprintf(display, "  %-*s %s -> %s  (fast forward)",
-                       SUMMARY_WIDTH, quickref, remote, pretty_ref);
+               sprintf(display, "  %-*s %-*s -> %s", SUMMARY_WIDTH, quickref,
+                       REFCOL_WIDTH, remote, pretty_ref);
                return s_update_ref("fast forward", ref, 1);
        } else if (force || ref->force) {
                char quickref[84];
                strcpy(quickref, find_unique_abbrev(current->object.sha1, DEFAULT_ABBREV));
                strcat(quickref, "...");
                strcat(quickref, find_unique_abbrev(ref->new_sha1, DEFAULT_ABBREV));
-               sprintf(display, "+ %-*s %s -> %s  (forced update)",
-                       SUMMARY_WIDTH, quickref, remote, pretty_ref);
+               sprintf(display, "+ %-*s %-*s -> %s  (forced update)",
+                       SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote, pretty_ref);
                return s_update_ref("forced-update", ref, 1);
        } else {
-               sprintf(display, "! %-*s %s -> %s  (non fast forward)",
-                       SUMMARY_WIDTH, "[rejected]", remote, pretty_ref);
+               sprintf(display, "! %-*s %-*s -> %s  (non fast forward)",
+                       SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
+                       pretty_ref);
                return 1;
        }
 }
@@ -419,12 +424,12 @@ static struct ref *find_non_local_tags(struct transport *transport,
        struct path_list new_refs = { NULL, 0, 0, 1 };
        char *ref_name;
        int ref_name_len;
-       unsigned char *ref_sha1;
-       struct ref *tag_ref;
+       const unsigned char *ref_sha1;
+       const struct ref *tag_ref;
        struct ref *rm = NULL;
        struct ref *ref_map = NULL;
        struct ref **tail = &ref_map;
-       struct ref *ref;
+       const struct ref *ref;
 
        for_each_ref(add_existing, &existing_refs);
        for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) {