author | Junio C Hamano <gitster@pobox.com> | |
Wed, 2 Jul 2008 07:51:18 +0000 (00:51 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 3 Jul 2008 06:32:25 +0000 (23:32 -0700) | ||
commit | 6d21bf96b59cbcc818fdc83b654d7fc83dd2c9cd | |
tree | 28a4e2a7c6150902be8f3d432ebc48b5686c6e68 | tree | snapshot |
parent | 6cbf8b00fb27f5f55f1a5645ba60c451cb090fc1 | commit | diff |
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 <gitster@pobox.com>
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 <gitster@pobox.com>
builtin-checkout.c | diff | blob | history | |
remote.c | diff | blob | history | |
remote.h | diff | blob | history |