summaryrefslogtreecommitdiff
path: root/t/t5400-send-pack.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2007-10-19 05:04:00 -0400
committerShawn O. Pearce <spearce@spearce.org>2007-10-19 22:59:10 -0400
commit5eb73581679abb41dcdf9ad7fa63fa156e078790 (patch)
tree4b93fe6adafeb10894845f6d77794d0bc4650f4a /t/t5400-send-pack.sh
parente7187e4e0fece6c2947fbceff251f3ce69ae0aa8 (diff)
downloadgit-5eb73581679abb41dcdf9ad7fa63fa156e078790.tar.gz
send-pack: respect '+' on wildcard refspecs
When matching source and destination refs, we were failing to pull the 'force' parameter from wildcard refspecs (but not explicit ones) and attach it to the ref struct. This adds a test for explicit and wildcard refspecs; the latter fails without this patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 't/t5400-send-pack.sh')
-rwxr-xr-xt/t5400-send-pack.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 57c6397be1..2d0c07fd6a 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -123,4 +123,52 @@ test_expect_success \
git-branch -a >branches && ! grep -q origin/master branches
'
+rewound_push_setup() {
+ rm -rf parent child &&
+ mkdir parent && cd parent &&
+ git-init && echo one >file && git-add file && git-commit -m one &&
+ echo two >file && git-commit -a -m two &&
+ cd .. &&
+ git-clone parent child && cd child && git-reset --hard HEAD^
+}
+
+rewound_push_succeeded() {
+ cmp ../parent/.git/refs/heads/master .git/refs/heads/master
+}
+
+rewound_push_failed() {
+ if rewound_push_succeeded
+ then
+ false
+ else
+ true
+ fi
+}
+
+test_expect_success \
+ 'pushing explicit refspecs respects forcing' '
+ rewound_push_setup &&
+ if git-send-pack ../parent/.git refs/heads/master:refs/heads/master
+ then
+ false
+ else
+ true
+ fi && rewound_push_failed &&
+ git-send-pack ../parent/.git +refs/heads/master:refs/heads/master &&
+ rewound_push_succeeded
+'
+
+test_expect_success \
+ 'pushing wildcard refspecs respects forcing' '
+ rewound_push_setup &&
+ if git-send-pack ../parent/.git refs/heads/*:refs/heads/*
+ then
+ false
+ else
+ true
+ fi && rewound_push_failed &&
+ git-send-pack ../parent/.git +refs/heads/*:refs/heads/* &&
+ rewound_push_succeeded
+'
+
test_done