summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-16 19:18:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-16 19:18:15 (GMT)
commitc9fc3a6ac5011ce03e8132973687d1242807dc6c (patch)
tree9d8a40b578307a5be129f5385ad28fea3d8e8bad /t
parent1a81f6ceea7795e2b78cebd356d276afe79e7626 (diff)
parente143ef4f6b08e0f948180f28ad3ba77c9a2e0a61 (diff)
downloadgit-c9fc3a6ac5011ce03e8132973687d1242807dc6c.zip
git-c9fc3a6ac5011ce03e8132973687d1242807dc6c.tar.gz
git-c9fc3a6ac5011ce03e8132973687d1242807dc6c.tar.bz2
Merge branch 'fc/remote-helper-refmap'
Allow remote-helper/fast-import based transport to rename the refs while transferring the history. * fc/remote-helper-refmap: transport-helper: remove unnecessary strbuf resets transport-helper: add support to delete branches fast-export: add support to delete refs fast-import: add support to delete refs transport-helper: add support to push symbolic refs transport-helper: add support for old:new refspec fast-export: add new --refspec option fast-export: improve argument parsing
Diffstat (limited to 't')
-rwxr-xr-xt/t5801-remote-helpers.sh18
-rwxr-xr-xt/t9300-fast-import.sh18
-rwxr-xr-xt/t9350-fast-export.sh18
3 files changed, 53 insertions, 1 deletions
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index a00a660..2419407 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -87,13 +87,29 @@ test_expect_success 'push new branch by name' '
compare_refs local HEAD server refs/heads/new-name
'
-test_expect_failure 'push new branch with old:new refspec' '
+test_expect_success 'push new branch with old:new refspec' '
(cd local &&
git push origin new-name:new-refspec
) &&
compare_refs local HEAD server refs/heads/new-refspec
'
+test_expect_success 'push new branch with HEAD:new refspec' '
+ (cd local &&
+ git checkout new-name
+ git push origin HEAD:new-refspec-2
+ ) &&
+ compare_refs local HEAD server refs/heads/new-refspec-2
+'
+
+test_expect_success 'push delete branch' '
+ (cd local &&
+ git push origin :new-name
+ ) &&
+ test_must_fail git --git-dir="server/.git" \
+ rev-parse --verify refs/heads/new-name
+'
+
test_expect_success 'forced push' '
(cd local &&
git checkout -b force-test &&
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 27263df..5fc9ef2 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -2999,4 +2999,22 @@ test_expect_success 'T: ls root tree' '
test_cmp expect actual
'
+test_expect_success 'T: delete branch' '
+ git branch to-delete &&
+ git fast-import <<-EOF &&
+ reset refs/heads/to-delete
+ from 0000000000000000000000000000000000000000
+ EOF
+ test_must_fail git rev-parse --verify refs/heads/to-delete
+'
+
+test_expect_success 'T: empty reset doesnt delete branch' '
+ git branch not-to-delete &&
+ git fast-import <<-EOF &&
+ reset refs/heads/not-to-delete
+ EOF
+ git show-ref &&
+ git rev-parse --verify refs/heads/not-to-delete
+'
+
test_done
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index 2312dec..66c8b0a 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -504,4 +504,22 @@ test_expect_success 'refs are updated even if no commits need to be exported' '
test_cmp expected actual
'
+test_expect_success 'use refspec' '
+ git fast-export --refspec refs/heads/master:refs/heads/foobar master | \
+ grep "^commit " | sort | uniq > actual &&
+ echo "commit refs/heads/foobar" > expected &&
+ test_cmp expected actual
+'
+
+test_expect_success 'delete refspec' '
+ git branch to-delete &&
+ git fast-export --refspec :refs/heads/to-delete to-delete ^to-delete > actual &&
+ cat > expected <<-EOF &&
+ reset refs/heads/to-delete
+ from 0000000000000000000000000000000000000000
+
+ EOF
+ test_cmp expected actual
+'
+
test_done