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
This commit is contained in:
Junio C Hamano
2014-06-16 12:18:15 -07:00
8 changed files with 141 additions and 14 deletions

View File

@ -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 &&

View File

@ -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

View File

@ -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