Merge branch 'mg/status-v-v'
authorJunio C Hamano <gitster@pobox.com>
Tue, 17 Mar 2015 23:01:33 +0000 (16:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 Mar 2015 23:01:33 +0000 (16:01 -0700)
"git status" now allows the "-v" to be given twice to show the
differences that are left in the working tree not to be committed.

* mg/status-v-v:
commit/status: show the index-worktree diff with -v -v
t7508: test git status -v
t7508: .gitignore 'expect' and 'output' files

1  2 
wt-status.c
diff --combined wt-status.c
index 29666d0dbaa5af768aca86f3ca0b644ac9720648,60a58b093e3801e5e35e20ca6ff74aaab64c166c..422dc0e70cf465c21e99375d32cb76c6f0acafae
@@@ -849,6 -849,8 +849,8 @@@ static void wt_status_print_verbose(str
  {
        struct rev_info rev;
        struct setup_revision_opt opt;
+       int dirty_submodules;
+       const char *c = color(WT_STATUS_HEADER, s);
  
        init_revisions(&rev, NULL);
        DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
                rev.diffopt.use_color = 0;
                wt_status_add_cut_line(s->fp);
        }
+       if (s->verbose > 1 && s->commitable) {
+               /* print_updated() printed a header, so do we */
+               if (s->fp != stdout)
+                       wt_status_print_trailer(s);
+               status_printf_ln(s, c, _("Changes to be committed:"));
+               rev.diffopt.a_prefix = "c/";
+               rev.diffopt.b_prefix = "i/";
+       } /* else use prefix as per user config */
        run_diff_index(&rev, 1);
+       if (s->verbose > 1 &&
+           wt_status_check_worktree_changes(s, &dirty_submodules)) {
+               status_printf_ln(s, c,
+                       "--------------------------------------------------");
+               status_printf_ln(s, c, _("Changes not staged for commit:"));
+               setup_work_tree();
+               rev.diffopt.a_prefix = "i/";
+               rev.diffopt.b_prefix = "w/";
+               run_diff_files(&rev, 0);
+       }
  }
  
  static void wt_status_print_tracking(struct wt_status *s)
@@@ -1140,7 -1160,7 +1160,7 @@@ static char *read_and_strip_branch(cons
        if (strbuf_read_file(&sb, git_path("%s", path), 0) <= 0)
                goto got_nothing;
  
 -      while (&sb.len && sb.buf[sb.len - 1] == '\n')
 +      while (sb.len && sb.buf[sb.len - 1] == '\n')
                strbuf_setlen(&sb, sb.len - 1);
        if (!sb.len)
                goto got_nothing;