@matheusbsbs / matheus-bagliano / commits / 9ef4272bea
Fork 0

git-fetch: be even quieter.

Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pierre Habouzit committed Nov 4, 2007 at 15:05 UTC 9ef4272bea94b022aa84372c06e211bccd5f8a54
1 file changed +19 -14
builtin-fetch.c
+19 -14
@@ -152,6 +152,7 @@ static int s_update_ref(const char *action,
152 }
153
154 #define SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3)
155 +#define REFCOL_WIDTH 10
156
157 static int update_local_ref(struct ref *ref,
158 const char *remote,
@@ -181,8 +182,9 @@ static int update_local_ref(struct ref *ref,
182
183 if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
184 if (verbose)
184 - sprintf(display, "= %-*s %s -> %s", SUMMARY_WIDTH,
185 - "[up to date]", remote, pretty_ref);
185 + sprintf(display, "= %-*s %-*s -> %s", SUMMARY_WIDTH,
186 + "[up to date]", REFCOL_WIDTH, remote,
187 + pretty_ref);
188 return 0;
189 }
190
@@ -194,15 +196,17 @@ static int update_local_ref(struct ref *ref,
196 * If this is the head, and it's not okay to update
197 * the head, and the old value of the head isn't empty...
198 */
197 - sprintf(display, "! %-*s %s -> %s (can't fetch in current branch)",
198 - SUMMARY_WIDTH, "[rejected]", remote, pretty_ref);
199 + sprintf(display, "! %-*s %-*s -> %s (can't fetch in current branch)",
200 + SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
201 + pretty_ref);
202 return 1;
203 }
204
205 if (!is_null_sha1(ref->old_sha1) &&
206 !prefixcmp(ref->name, "refs/tags/")) {
204 - sprintf(display, "- %-*s %s -> %s",
205 - SUMMARY_WIDTH, "[tag update]", remote, pretty_ref);
207 + sprintf(display, "- %-*s %-*s -> %s",
208 + SUMMARY_WIDTH, "[tag update]", REFCOL_WIDTH, remote,
209 + pretty_ref);
210 return s_update_ref("updating tag", ref, 0);
211 }
212
@@ -220,8 +224,8 @@ static int update_local_ref(struct ref *ref,
224 what = "[new branch]";
225 }
226
223 - sprintf(display, "* %-*s %s -> %s",
224 - SUMMARY_WIDTH, what, remote, pretty_ref);
227 + sprintf(display, "* %-*s %-*s -> %s", SUMMARY_WIDTH, what,
228 + REFCOL_WIDTH, remote, pretty_ref);
229 return s_update_ref(msg, ref, 0);
230 }
231
@@ -230,20 +234,21 @@ static int update_local_ref(struct ref *ref,
234 strcpy(quickref, find_unique_abbrev(current->object.sha1, DEFAULT_ABBREV));
235 strcat(quickref, "..");
236 strcat(quickref, find_unique_abbrev(ref->new_sha1, DEFAULT_ABBREV));
233 - sprintf(display, " %-*s %s -> %s (fast forward)",
234 - SUMMARY_WIDTH, quickref, remote, pretty_ref);
237 + sprintf(display, " %-*s %-*s -> %s", SUMMARY_WIDTH, quickref,
238 + REFCOL_WIDTH, remote, pretty_ref);
239 return s_update_ref("fast forward", ref, 1);
240 } else if (force || ref->force) {
241 char quickref[84];
242 strcpy(quickref, find_unique_abbrev(current->object.sha1, DEFAULT_ABBREV));
243 strcat(quickref, "...");
244 strcat(quickref, find_unique_abbrev(ref->new_sha1, DEFAULT_ABBREV));
241 - sprintf(display, "+ %-*s %s -> %s (forced update)",
242 - SUMMARY_WIDTH, quickref, remote, pretty_ref);
245 + sprintf(display, "+ %-*s %-*s -> %s (forced update)",
246 + SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote, pretty_ref);
247 return s_update_ref("forced-update", ref, 1);
248 } else {
245 - sprintf(display, "! %-*s %s -> %s (non fast forward)",
246 - SUMMARY_WIDTH, "[rejected]", remote, pretty_ref);
249 + sprintf(display, "! %-*s %-*s -> %s (non fast forward)",
250 + SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
251 + pretty_ref);
252 return 1;
253 }
254 }