From 6d21bf96b59cbcc818fdc83b654d7fc83dd2c9cd Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 2 Jul 2008 00:51:18 -0700 Subject: Refactor "tracking statistics" code used by "git checkout" People seem to like "Your branch is ahead by N commit" report made by "git checkout", but the interface into the statistics function was a bit clunky. This splits the function into three parts: * The core "commit counting" function that takes "struct branch" and returns number of commits to show if we are ahead, behind or forked; * Convenience "stat formating" function that takes "struct branch" and formats the report into a given strbuf, using the above function; * "checkout" specific function that takes "branch_info" (type that is internal to checkout implementation), calls the above function and print the formatted result. in the hope that the former two can be more easily reusable. Signed-off-by: Junio C Hamano --- remote.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'remote.h') diff --git a/remote.h b/remote.h index 8eed87ba5a..091b1d041f 100644 --- a/remote.h +++ b/remote.h @@ -129,4 +129,8 @@ enum match_refs_flags { MATCH_REFS_MIRROR = (1 << 1), }; +/* Reporting of tracking info */ +int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs); +int format_tracking_info(struct branch *branch, struct strbuf *sb); + #endif -- cgit v1.3