1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 00:37:55 +01:00
git/t/t9151-svn-mergeinfo.sh

58 lines
1.8 KiB
Bash
Raw Normal View History

#!/bin/sh
#
# Copyright (c) 2007, 2009 Sam Vilain
#
test_description='git-svn svn mergeinfo properties'
. ./lib-git-svn.sh
test_expect_success 'load svn dump' "
svnadmin load -q '$rawsvnrepo' \
< '$TEST_DIRECTORY/t9151/svn-mergeinfo.dump' &&
git svn init --minimize-url -R svnmerge \
--rewrite-root=http://svn.example.org \
-T trunk -b branches '$svnrepo' &&
git svn fetch --all
"
test_expect_success 'all svn merges became git merge commits' '
unmarked=$(git rev-list --parents --all --grep=Merge |
grep -v " .* " | cut -f1 -d" ") &&
[ -z "$unmarked" ]
'
git svn: handle SVN merges from revisions past the tip of the branch When recording the revisions that it has merged, SVN sets the top revision to be the latest revision in the repository, which is not necessarily a revision on the branch that is being merged from. When it is not on the branch, git-svn fails to add the extra parent to represent the merge because it relies on finding the commit on the branch that corresponds to the top of the SVN merge range. In order to correctly handle this case, we look for the maximum revision less than or equal to the top of the SVN merge range that is actually on the branch being merged from. [ew: This includes the following (squashed) commit to prevent errors during bisect:] Author: Toby Allsopp <toby.allsopp@navman.co.nz> Date: Fri Nov 13 09:48:39 2009 +1300 git-svn: add (failing) test for SVN 1.5+ merge with intervening commit This test exposes a bug in git-svn's handling of SVN 1.5+ mergeinfo properties. The problematic case is when there is some commit on an unrelated branch after the last commit on the merged-from branch. When SVN records the mergeinfo property, it records the latest revision in the whole repository, which, in the problematic case, is not on the branch it is merging from. To trigger the git-svn bug, we modify t9151 to include two SVN merges, the second of which has an intervening commit. The SVN dump was generated using SVN 1.6.6 (on Debian squeeze amd64). Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz> Acked-by: Eric Wong <normalperson@yhbt.net>
2009-11-14 22:26:47 +01:00
test_expect_success 'cherry picks did not become git merge commits' '
bad_cherries=$(git rev-list --parents --all --grep=Cherry |
grep " .* " | cut -f1 -d" ") &&
[ -z "$bad_cherries" ]
'
test_expect_success 'svn non-merge merge commits did not become git merge commits' '
bad_non_merges=$(git rev-list --parents --all --grep=non-merge |
grep " .* " | cut -f1 -d" ") &&
[ -z "$bad_non_merges" ]
'
test_expect_success 'commit made to merged branch is reachable from the merge' '
before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2") &&
merge_commit=$(git rev-list --all --grep="Merge trunk to b2") &&
not_reachable=$(git rev-list -1 $before_commit --not $merge_commit) &&
[ -z "$not_reachable" ]
'
test_expect_success 'merging two branches in one commit is detected correctly' '
f1_commit=$(git rev-list --all --grep="make f1 branch from trunk") &&
f2_commit=$(git rev-list --all --grep="make f2 branch from trunk") &&
merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk") &&
not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit) &&
[ -z "$not_reachable" ]
'
test_expect_failure 'everything got merged in the end' '
unmerged=$(git rev-list --all --not master) &&
[ -z "$unmerged" ]
'
test_done