summaryrefslogtreecommitdiff
path: root/remote.h
diff options
context:
space:
mode:
authorDamien Robert <damien.olivier.robert+git@gmail.com>2019-04-16 12:16:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-18 00:17:41 (GMT)
commitc646d0934ec2056d816ad1ecc23f6620aba2c6da (patch)
treef1ceb4ff5a2864487bfaa35e35a3173d0a267ca3 /remote.h
parentaeb582a98374c094361cba1bd756dc6307432c42 (diff)
downloadgit-c646d0934ec2056d816ad1ecc23f6620aba2c6da.zip
git-c646d0934ec2056d816ad1ecc23f6620aba2c6da.tar.gz
git-c646d0934ec2056d816ad1ecc23f6620aba2c6da.tar.bz2
ref-filter: use correct branch for %(push:track)
In ref-filter.c, when processing the atom %(push:track), the ahead/behind values are computed using `stat_tracking_info` which refers to the upstream branch. Fix that by introducing a new flag `for_push` in `stat_tracking_info` in remote.c, which does the same thing but for the push branch. Update the few callers of `stat_tracking_info` to handle this flag. This ensure that whenever we use this function in the future, we are careful to specify is this should apply to the upstream or the push branch. This bug was not detected in t/t6300-for-each-ref.sh because in the test for push:track, both the upstream and the push branches were behind by 1 from the local branch. Change the test so that the upstream branch is behind by 1 while the push branch is ahead by 1. This allows us to test that %(push:track) refers to the correct branch. This changes the expected value of some following tests (by introducing new references), so update them too. Signed-off-by: Damien Robert <damien.olivier.robert+git@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.h')
-rw-r--r--remote.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/remote.h b/remote.h
index da53ad5..0138b3f 100644
--- a/remote.h
+++ b/remote.h
@@ -253,7 +253,8 @@ enum ahead_behind_flags {
/* Reporting of tracking info */
int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs,
- const char **upstream_name, enum ahead_behind_flags abf);
+ const char **upstream_name, int for_push,
+ enum ahead_behind_flags abf);
int format_tracking_info(struct branch *branch, struct strbuf *sb,
enum ahead_behind_flags abf);