status: add --[no-]ahead-behind to status and commit for V2 format.

Teach "git status" and "git commit" to accept "--no-ahead-behind"
and "--ahead-behind" arguments to request quick or full ahead/behind
reporting.

When "--no-ahead-behind" is given, the existing porcelain V2 line
"branch.ab +x -y" is replaced with a new "branch.ab +? -?" line.
This indicates that the branch and its upstream are or are not equal
without the expense of computing the full ahead/behind values.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff Hostetler
2018-01-09 18:50:16 +00:00
committed by Junio C Hamano
parent d7d1b496ae
commit fd9b544a29
7 changed files with 102 additions and 11 deletions

View File

@@ -5,6 +5,7 @@
#include "string-list.h"
#include "color.h"
#include "pathspec.h"
#include "remote.h"
struct worktree;
@@ -86,6 +87,7 @@ struct wt_status {
int show_branch;
int show_stash;
int hints;
enum ahead_behind_flags ahead_behind_flags;
enum wt_status_format status_format;
unsigned char sha1_commit[GIT_MAX_RAWSZ]; /* when not Initial */