summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-11-08 17:32:49 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-11-08 17:32:49 -0800
commit832e719d79296f1942a2aca5fb067bc610986fc4 (patch)
tree8dfdf706b10fa4891ebaceb5ec7543078a73cc44 /t
parentMerge branch 'cj/maint-gitpm-fix-maybe-self' into maint (diff)
parentpush: fix local refs update if already up-to-date (diff)
downloadtgif-832e719d79296f1942a2aca5fb067bc610986fc4.tar.xz
Merge branch 'cb/maint-update-ref-fix' into maint
* cb/maint-update-ref-fix: push: fix local refs update if already up-to-date do not force write of packed refs
Diffstat (limited to 't')
-rwxr-xr-xt/t3210-pack-refs.sh7
-rwxr-xr-xt/t5516-fetch-push.sh31
2 files changed, 38 insertions, 0 deletions
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index 087ef75061..413019acaf 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -96,6 +96,13 @@ test_expect_success \
git branch -d n/o/p &&
git branch n'
+test_expect_success \
+ 'see if up-to-date packed refs are preserved' \
+ 'git branch q &&
+ git pack-refs --all --prune &&
+ git update-ref refs/heads/q refs/heads/q &&
+ ! test -f .git/refs/heads/q'
+
test_expect_success 'pack, prune and repack' '
git tag foo &&
git pack-refs --all --prune &&
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index f0030ad00e..598664ce7f 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -437,6 +437,37 @@ test_expect_success 'push updates local refs' '
'
+test_expect_success 'push updates up-to-date local refs' '
+
+ rm -rf parent child &&
+ mkdir parent &&
+ (cd parent && git init &&
+ echo one >foo && git add foo && git commit -m one) &&
+ git clone parent child1 &&
+ git clone parent child2 &&
+ (cd child1 &&
+ echo two >foo && git commit -a -m two &&
+ git push) &&
+ (cd child2 &&
+ git pull ../child1 master &&
+ git push &&
+ test $(git rev-parse master) = $(git rev-parse remotes/origin/master))
+
+'
+
+test_expect_success 'push preserves up-to-date packed refs' '
+
+ rm -rf parent child &&
+ mkdir parent &&
+ (cd parent && git init &&
+ echo one >foo && git add foo && git commit -m one) &&
+ git clone parent child &&
+ (cd child &&
+ git push &&
+ ! test -f .git/refs/remotes/origin/master)
+
+'
+
test_expect_success 'push does not update local refs on failure' '
rm -rf parent child &&