Merge branch 'jc/report-tracking'
authorJunio C Hamano <gitster@pobox.com>
Sun, 13 Jul 2008 22:15:23 +0000 (15:15 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 13 Jul 2008 22:15:23 +0000 (15:15 -0700)
* jc/report-tracking:
branch -r -v: do not spit out garbage
stat_tracking_info(): clear object flags used during counting
git-branch -v: show the remote tracking statistics
git-status: show the remote tracking statistics
Refactor "tracking statistics" code used by "git checkout"

1  2 
revision.h
wt-status.c
diff --combined revision.h
index 83f364ace240ce22d577f65e7a3f60bf20ccdf2f,e8bac6d14161dfd7121967726c3ba30eded5b7eb..f57b6c5d9a832311711e989a63911c886dd1a418
@@@ -11,6 -11,7 +11,7 @@@
  #define ADDED         (1u<<7) /* Parents already parsed and added? */
  #define SYMMETRIC_LEFT        (1u<<8)
  #define TOPOSORT      (1u<<9) /* In the active toposort list.. */
+ #define ALL_REV_FLAGS ((1u<<10)-1)
  
  struct rev_info;
  struct log_info;
@@@ -111,8 -112,6 +112,8 @@@ struct rev_info 
  #define REV_TREE_DIFFERENT    2
  
  /* revision.c */
 +void read_revisions_from_stdin(struct rev_info *revs);
 +
  typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *);
  volatile show_early_output_fn_t show_early_output;
  
diff --combined wt-status.c
index e7d42d0491743d577f84dc262ead721eb82c4785,eeb106e13e88c3ee2f61df41017e47b221f10ae3..889e50f89fc24984f700d14f7033600fa9fdf642
@@@ -9,6 -9,7 +9,7 @@@
  #include "diffcore.h"
  #include "quote.h"
  #include "run-command.h"
+ #include "remote.h"
  
  int wt_status_relative_paths = 1;
  int wt_status_use_color = -1;
@@@ -315,6 -316,25 +316,25 @@@ static void wt_status_print_verbose(str
        run_diff_index(&rev, 1);
  }
  
+ static void wt_status_print_tracking(struct wt_status *s)
+ {
+       struct strbuf sb = STRBUF_INIT;
+       const char *cp, *ep;
+       struct branch *branch;
+       assert(s->branch && !s->is_initial);
+       if (prefixcmp(s->branch, "refs/heads/"))
+               return;
+       branch = branch_get(s->branch + 11);
+       if (!format_tracking_info(branch, &sb))
+               return;
+       for (cp = sb.buf; (ep = strchr(cp, '\n')) != NULL; cp = ep + 1)
+               color_fprintf_ln(s->fp, color(WT_STATUS_HEADER),
+                                "# %.*s", (int)(ep - cp), cp);
+       color_fprintf_ln(s->fp, color(WT_STATUS_HEADER), "#");
+ }
  void wt_status_print(struct wt_status *s)
  {
        unsigned char sha1[20];
                }
                color_fprintf(s->fp, color(WT_STATUS_HEADER), "# ");
                color_fprintf_ln(s->fp, branch_color, "%s%s", on_what, branch_name);
+               if (!s->is_initial)
+                       wt_status_print_tracking(s);
        }
  
        if (s->is_initial) {
@@@ -399,7 -421,7 +421,7 @@@ int git_status_config(const char *k, co
        }
        if (!strcmp(k, "status.showuntrackedfiles")) {
                if (!v)
 -                      return config_error_nonbool(v);
 +                      return config_error_nonbool(k);
                else if (!strcmp(v, "no"))
                        show_untracked_files = SHOW_NO_UNTRACKED_FILES;
                else if (!strcmp(v, "normal"))