mirror of
https://github.com/git/git.git
synced 2024-10-30 13:57:54 +01:00
fe191fcaa5
git-svn by default puts its Subversion-tracking refs directly in refs/remotes/*. This runs counter to Git's convention of using refs/remotes/$remote/* for storing remote-tracking branches. Furthermore, combining git-svn with regular git remotes run the risk of clobbering refs under refs/remotes (e.g. if you have a git remote called "tags" with a "v1" branch, it will overlap with the git-svn's tracking branch for the "v1" tag from Subversion. Even though the git-svn refs stored in refs/remotes/* are not "proper" remote-tracking branches (since they are not covered by a proper git remote's refspec), they clearly represent a similar concept, and would benefit from following the same convention. For example, if git-svn tracks Subversion branch "foo" at refs/remotes/foo, and you create a local branch refs/heads/foo to add some commits to be pushed back to Subversion (using "git svn dcommit), then it is clearly unhelpful of Git to throw warning: refname 'foo' is ambiguous. every time you checkout, rebase, or otherwise interact with the branch. The existing workaround for this is to supply the --prefix=quux/ to git svn init/clone, so that git-svn's tracking branches end up in refs/remotes/quux/* instead of refs/remotes/*. However, encouraging users to specify --prefix to work around a design flaw in git-svn is suboptimal, and not a long term solution to the problem. Instead, git-svn should default to use a non-empty prefix that saves unsuspecting users from the inconveniences described above. This patch will only affect newly created git-svn setups, as the --prefix option only applies to git svn init (and git svn clone). Existing git-svn setups will continue with their existing (lack of) prefix. Also, if anyone somehow prefers git-svn's old layout, they can recreate that by explicitly passing an empty prefix (--prefix "") on the git svn init/clone command line. The patch changes the default value for --prefix from "" to "origin/", updates the git-svn manual page, and fixes the fallout in the git-svn testcases. (Note that this patch might be easier to review using the --word-diff and --word-diff-regex=. diff options.) [ew: squashed description of <= 1.9 behavior into manpage] Suggested-by: Thomas Ferris Nicolaisen <tfnico@gmail.com> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Eric Wong <normalperson@yhbt.net>
103 lines
2.6 KiB
Bash
Executable file
103 lines
2.6 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Portions copyright (c) 2007, 2009 Sam Vilain
|
|
# Portions copyright (c) 2011 Bryan Jacobs
|
|
#
|
|
|
|
test_description='git-svn svn mergeinfo propagation'
|
|
|
|
. ./lib-git-svn.sh
|
|
|
|
test_expect_success 'load svn dump' "
|
|
svnadmin load -q '$rawsvnrepo' \
|
|
< '$TEST_DIRECTORY/t9161/branches.dump' &&
|
|
git svn init --minimize-url -R svnmerge \
|
|
-T trunk -b branches '$svnrepo' &&
|
|
git svn fetch --all
|
|
"
|
|
|
|
test_expect_success 'propagate merge information' '
|
|
git config svn.pushmergeinfo yes &&
|
|
git checkout origin/svnb1 &&
|
|
git merge --no-ff origin/svnb2 &&
|
|
git svn dcommit
|
|
'
|
|
|
|
test_expect_success 'check svn:mergeinfo' '
|
|
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
|
|
test "$mergeinfo" = "/branches/svnb2:3,8"
|
|
'
|
|
|
|
test_expect_success 'merge another branch' '
|
|
git merge --no-ff origin/svnb3 &&
|
|
git svn dcommit
|
|
'
|
|
|
|
test_expect_success 'check primary parent mergeinfo respected' '
|
|
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
|
|
test "$mergeinfo" = "/branches/svnb2:3,8
|
|
/branches/svnb3:4,9"
|
|
'
|
|
|
|
test_expect_success 'merge existing merge' '
|
|
git merge --no-ff origin/svnb4 &&
|
|
git svn dcommit
|
|
'
|
|
|
|
test_expect_success "check both parents' mergeinfo respected" '
|
|
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
|
|
test "$mergeinfo" = "/branches/svnb2:3,8
|
|
/branches/svnb3:4,9
|
|
/branches/svnb4:5-6,10-12
|
|
/branches/svnb5:6,11"
|
|
'
|
|
|
|
test_expect_success 'make further commits to branch' '
|
|
git checkout origin/svnb2 &&
|
|
touch newb2file &&
|
|
git add newb2file &&
|
|
git commit -m "later b2 commit" &&
|
|
touch newb2file-2 &&
|
|
git add newb2file-2 &&
|
|
git commit -m "later b2 commit 2" &&
|
|
git svn dcommit
|
|
'
|
|
|
|
test_expect_success 'second forward merge' '
|
|
git checkout origin/svnb1 &&
|
|
git merge --no-ff origin/svnb2 &&
|
|
git svn dcommit
|
|
'
|
|
|
|
test_expect_success 'check new mergeinfo added' '
|
|
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1)
|
|
test "$mergeinfo" = "/branches/svnb2:3,8,16-17
|
|
/branches/svnb3:4,9
|
|
/branches/svnb4:5-6,10-12
|
|
/branches/svnb5:6,11"
|
|
'
|
|
|
|
test_expect_success 'reintegration merge' '
|
|
git checkout origin/svnb4 &&
|
|
git merge --no-ff origin/svnb1 &&
|
|
git svn dcommit
|
|
'
|
|
|
|
test_expect_success 'check reintegration mergeinfo' '
|
|
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4)
|
|
test "$mergeinfo" = "/branches/svnb1:2-4,7-9,13-18
|
|
/branches/svnb2:3,8,16-17
|
|
/branches/svnb3:4,9
|
|
/branches/svnb5:6,11"
|
|
'
|
|
|
|
test_expect_success 'dcommit a merge at the top of a stack' '
|
|
git checkout origin/svnb1 &&
|
|
touch anotherfile &&
|
|
git add anotherfile &&
|
|
git commit -m "a commit" &&
|
|
git merge origin/svnb4 &&
|
|
git svn dcommit
|
|
'
|
|
|
|
test_done
|