2009-10-20 04:42:03 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2007, 2009 Sam Vilain
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='git-svn svn mergeinfo properties'
|
|
|
|
|
2020-11-19 00:44:42 +01:00
|
|
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
tests: mark tests relying on the current default for `init.defaultBranch`
In addition to the manual adjustment to let the `linux-gcc` CI job run
the test suite with `master` and then with `main`, this patch makes sure
that GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME is set in all test scripts
that currently rely on the initial branch name being `master by default.
To determine which test scripts to mark up, the first step was to
force-set the default branch name to `master` in
- all test scripts that contain the keyword `master`,
- t4211, which expects `t/t4211/history.export` with a hard-coded ref to
initialize the default branch,
- t5560 because it sources `t/t556x_common` which uses `master`,
- t8002 and t8012 because both source `t/annotate-tests.sh` which also
uses `master`)
This trick was performed by this command:
$ sed -i '/^ *\. \.\/\(test-lib\|lib-\(bash\|cvs\|git-svn\)\|gitweb-lib\)\.sh$/i\
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\
' $(git grep -l master t/t[0-9]*.sh) \
t/t4211*.sh t/t5560*.sh t/t8002*.sh t/t8012*.sh
After that, careful, manual inspection revealed that some of the test
scripts containing the needle `master` do not actually rely on a
specific default branch name: either they mention `master` only in a
comment, or they initialize that branch specificially, or they do not
actually refer to the current default branch. Therefore, the
aforementioned modification was undone in those test scripts thusly:
$ git checkout HEAD -- \
t/t0027-auto-crlf.sh t/t0060-path-utils.sh \
t/t1011-read-tree-sparse-checkout.sh \
t/t1305-config-include.sh t/t1309-early-config.sh \
t/t1402-check-ref-format.sh t/t1450-fsck.sh \
t/t2024-checkout-dwim.sh \
t/t2106-update-index-assume-unchanged.sh \
t/t3040-subprojects-basic.sh t/t3301-notes.sh \
t/t3308-notes-merge.sh t/t3423-rebase-reword.sh \
t/t3436-rebase-more-options.sh \
t/t4015-diff-whitespace.sh t/t4257-am-interactive.sh \
t/t5323-pack-redundant.sh t/t5401-update-hooks.sh \
t/t5511-refspec.sh t/t5526-fetch-submodules.sh \
t/t5529-push-errors.sh t/t5530-upload-pack-error.sh \
t/t5548-push-porcelain.sh \
t/t5552-skipping-fetch-negotiator.sh \
t/t5572-pull-submodule.sh t/t5608-clone-2gb.sh \
t/t5614-clone-submodules-shallow.sh \
t/t7508-status.sh t/t7606-merge-custom.sh \
t/t9302-fast-import-unpack-limit.sh
We excluded one set of test scripts in these commands, though: the range
of `git p4` tests. The reason? `git p4` stores the (foreign) remote
branch in the branch called `p4/master`, which is obviously not the
default branch. Manual analysis revealed that only five of these tests
actually require a specific default branch name to pass; They were
modified thusly:
$ sed -i '/^ *\. \.\/lib-git-p4\.sh$/i\
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\
' t/t980[0167]*.sh t/t9811*.sh
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-11-19 00:44:19 +01:00
|
|
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
|
|
|
|
2009-10-20 04:42:03 +02:00
|
|
|
. ./lib-git-svn.sh
|
|
|
|
|
|
|
|
test_expect_success 'load svn dump' "
|
2009-10-30 21:10:17 +01:00
|
|
|
svnadmin load -q '$rawsvnrepo' \
|
|
|
|
< '$TEST_DIRECTORY/t9151/svn-mergeinfo.dump' &&
|
2009-10-20 04:42:03 +02:00
|
|
|
git svn init --minimize-url -R svnmerge \
|
2010-02-24 19:09:02 +01:00
|
|
|
--rewrite-root=http://svn.example.org \
|
2009-10-20 04:42:03 +02:00
|
|
|
-T trunk -b branches '$svnrepo' &&
|
|
|
|
git svn fetch --all
|
|
|
|
"
|
|
|
|
|
2009-12-19 17:26:26 +01:00
|
|
|
test_expect_success 'all svn merges became git merge commits' '
|
2009-12-19 17:20:30 +01:00
|
|
|
unmarked=$(git rev-list --parents --all --grep=Merge |
|
2010-10-31 02:46:54 +01:00
|
|
|
grep -v " .* " | cut -f1 -d" ") &&
|
2009-12-19 17:20:30 +01:00
|
|
|
[ -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
|
|
|
|
2009-12-19 17:26:26 +01:00
|
|
|
test_expect_success 'cherry picks did not become git merge commits' '
|
2009-12-19 17:20:30 +01:00
|
|
|
bad_cherries=$(git rev-list --parents --all --grep=Cherry |
|
2010-10-31 02:46:54 +01:00
|
|
|
grep " .* " | cut -f1 -d" ") &&
|
2009-12-19 17:20:30 +01:00
|
|
|
[ -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 |
|
2010-10-31 02:46:54 +01:00
|
|
|
grep " .* " | cut -f1 -d" ") &&
|
2009-12-19 17:20:30 +01:00
|
|
|
[ -z "$bad_non_merges" ]
|
|
|
|
'
|
|
|
|
|
2010-02-22 19:12:53 +01:00
|
|
|
test_expect_success 'commit made to merged branch is reachable from the merge' '
|
2010-10-31 02:46:54 +01:00
|
|
|
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) &&
|
2010-02-22 08:57:21 +01:00
|
|
|
[ -z "$not_reachable" ]
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merging two branches in one commit is detected correctly' '
|
2010-10-31 02:46:54 +01:00
|
|
|
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) &&
|
2010-02-22 08:57:21 +01:00
|
|
|
[ -z "$not_reachable" ]
|
|
|
|
'
|
|
|
|
|
2010-01-21 22:55:48 +01:00
|
|
|
test_expect_failure 'everything got merged in the end' '
|
2020-11-19 00:44:42 +01:00
|
|
|
unmerged=$(git rev-list --all --not main) &&
|
2009-12-19 17:20:30 +01:00
|
|
|
[ -z "$unmerged" ]
|
|
|
|
'
|
2009-10-20 04:42:03 +02:00
|
|
|
|
|
|
|
test_done
|