diff options
author | Jeff King <peff@peff.net> | 2013-05-11 18:16:52 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-12 15:23:48 -0700 |
commit | f269048754f3b835f4f7287c5a132714a059efce (patch) | |
tree | 12b7debaf9d79eae12a9aedb44762a7484508b33 /t/t5510-fetch.sh | |
parent | refactor "ref->merge" flag (diff) | |
download | tgif-f269048754f3b835f4f7287c5a132714a059efce.tar.xz |
fetch: opportunistically update tracking refs
When we run a regular "git fetch" without arguments, we
update the tracking refs according to the configured
refspec. However, when we run "git fetch origin master" (or
"git pull origin master"), we do not look at the configured
refspecs at all, and just update FETCH_HEAD.
We miss an opportunity to update "refs/remotes/origin/master"
(or whatever the user has configured). Some users find this
confusing, because they would want to do further comparisons
against the old state of the remote master, like:
$ git pull origin master
$ git log HEAD...origin/master
In the currnet code, they are comparing against whatever
commit happened to be in origin/master from the last time
they did a complete "git fetch". This patch will update a
ref from the RHS of a configured refspec whenever we happen
to be fetching its LHS. That makes the case above work.
The downside is that any users who really care about whether
and when their tracking branches are updated may be
surprised.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5510-fetch.sh')
-rwxr-xr-x | t/t5510-fetch.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 789c22827d..ff43e08755 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -377,7 +377,7 @@ test_expect_success 'mark initial state of origin/master' ' ) ' -test_expect_success 'explicit fetch should not update tracking' ' +test_expect_success 'explicit fetch should update tracking' ' cd "$D" && git branch -f side && @@ -387,12 +387,12 @@ test_expect_success 'explicit fetch should not update tracking' ' o=$(git rev-parse --verify refs/remotes/origin/master) && git fetch origin master && n=$(git rev-parse --verify refs/remotes/origin/master) && - test "$o" = "$n" && + test "$o" != "$n" && test_must_fail git rev-parse --verify refs/remotes/origin/side ) ' -test_expect_success 'explicit pull should not update tracking' ' +test_expect_success 'explicit pull should update tracking' ' cd "$D" && git branch -f side && @@ -402,7 +402,7 @@ test_expect_success 'explicit pull should not update tracking' ' o=$(git rev-parse --verify refs/remotes/origin/master) && git pull origin master && n=$(git rev-parse --verify refs/remotes/origin/master) && - test "$o" = "$n" && + test "$o" != "$n" && test_must_fail git rev-parse --verify refs/remotes/origin/side ) ' |