Merge branch 'jk/maint-advise-vaddf' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 30 Jul 2012 20:05:25 +0000 (13:05 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Jul 2012 20:05:25 +0000 (13:05 -0700)
The advise() function did not use varargs correctly to format
its message.

* jk/maint-advise-vaddf:
advice: pass varargs to strbuf_vaddf, not strbuf_addf

1  2 
advice.c
diff --combined advice.c
index a492eea24f71ad2d2082efce9d1d925a5766b111,961a4f5e4156dbf675f039f93eb369bb6b0cfa7a..edfbd4a6fb01a6905671d6d842d22c4869fad729
+++ b/advice.c
@@@ -1,9 -1,6 +1,9 @@@
  #include "cache.h"
  
  int advice_push_nonfastforward = 1;
 +int advice_push_non_ff_current = 1;
 +int advice_push_non_ff_default = 1;
 +int advice_push_non_ff_matching = 1;
  int advice_status_hints = 1;
  int advice_commit_before_merge = 1;
  int advice_resolve_conflict = 1;
@@@ -15,9 -12,6 +15,9 @@@ static struct 
        int *preference;
  } advice_config[] = {
        { "pushnonfastforward", &advice_push_nonfastforward },
 +      { "pushnonffcurrent", &advice_push_non_ff_current },
 +      { "pushnonffdefault", &advice_push_non_ff_default },
 +      { "pushnonffmatching", &advice_push_non_ff_matching },
        { "statushints", &advice_status_hints },
        { "commitbeforemerge", &advice_commit_before_merge },
        { "resolveconflict", &advice_resolve_conflict },
@@@ -32,7 -26,7 +32,7 @@@ void advise(const char *advice, ...
        const char *cp, *np;
  
        va_start(params, advice);
-       strbuf_addf(&buf, advice, params);
+       strbuf_vaddf(&buf, advice, params);
        va_end(params);
  
        for (cp = buf.buf; *cp; cp = np) {
@@@ -79,17 -73,3 +79,17 @@@ void NORETURN die_resolve_conflict(cons
        error_resolve_conflict(me);
        die("Exiting because of an unresolved conflict.");
  }
 +
 +void detach_advice(const char *new_name)
 +{
 +      const char fmt[] =
 +      "Note: checking out '%s'.\n\n"
 +      "You are in 'detached HEAD' state. You can look around, make experimental\n"
 +      "changes and commit them, and you can discard any commits you make in this\n"
 +      "state without impacting any branches by performing another checkout.\n\n"
 +      "If you want to create a new branch to retain commits you create, you may\n"
 +      "do so (now or later) by using -b with the checkout command again. Example:\n\n"
 +      "  git checkout -b new_branch_name\n\n";
 +
 +      fprintf(stderr, fmt, new_name);
 +}