Git 2.0: git svn: Set default --prefix='origin/' if --prefix is not given
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>
This commit is contained in:
@ -86,13 +86,11 @@ COMMANDS
|
||||
(refs/remotes/$remote/*). Setting a prefix is also useful
|
||||
if you wish to track multiple projects that share a common
|
||||
repository.
|
||||
By default, the prefix is set to 'origin/'.
|
||||
+
|
||||
NOTE: In Git v2.0, the default prefix will CHANGE from "" (no prefix)
|
||||
to "origin/". This is done to put SVN-tracking refs at
|
||||
"refs/remotes/origin/*" instead of "refs/remotes/*", and make them
|
||||
more compatible with how Git's own remote-tracking refs are organized
|
||||
(i.e. refs/remotes/$remote/*). You can enjoy the same benefits today,
|
||||
by using the --prefix option.
|
||||
NOTE: Before Git v2.0, the default prefix was "" (no prefix). This
|
||||
meant that SVN-tracking refs were put at "refs/remotes/*", which is
|
||||
incompatible with how Git's own remote-tracking refs are organized.
|
||||
|
||||
--ignore-paths=<regex>;;
|
||||
When passed to 'init' or 'clone' this regular expression will
|
||||
@ -994,16 +992,6 @@ without giving any repository layout options. If the full history with
|
||||
branches and tags is required, the options '--trunk' / '--branches' /
|
||||
'--tags' must be used.
|
||||
|
||||
When using the options for describing the repository layout (--trunk,
|
||||
--tags, --branches, --stdlayout), please also specify the --prefix
|
||||
option (e.g. '--prefix=origin/') to cause your SVN-tracking refs to be
|
||||
placed at refs/remotes/origin/* rather than the default refs/remotes/*.
|
||||
The former is more compatible with the layout of Git's "regular"
|
||||
remote-tracking refs (refs/remotes/$remote/*), and may potentially
|
||||
prevent similarly named SVN branches and Git remotes from clobbering
|
||||
each other. In Git v2.0 the default prefix used (i.e. when no --prefix
|
||||
is given) will change from "" (no prefix) to "origin/".
|
||||
|
||||
When using multiple --branches or --tags, 'git svn' does not automatically
|
||||
handle name collisions (for example, if two branches from different paths have
|
||||
the same name, or if a branch and a tag have the same name). In these cases,
|
||||
|
Reference in New Issue
Block a user