1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-09 02:33:11 +01:00
git/t/t9105-git-svn-commit-diff.sh
Eric Wong 4a1bb4c3f8 git-svn: don't attempt to minimize URLs by default
For tracking branches and tags, git-svn prefers to connect
to the root of the repository or at least the level that
houses branches and tags as well as trunk.  However, users
that are accustomed to tracking a single directory have
no use for this feature.

As pointed out by Junio, users may not have permissions to
connect to connect to a higher-level path in the repository.

While the current minimize_url() function detects lack of
permissions to certain paths _after_ successful logins, it
cannot effectively determine if it is trying to access a
login-only portion of a repo when the user expects to
connect to a part where anonymous access is allowed.

For people used to the git-svnimport switches of
--trunk, --tags, --branches, they'll already pass the
repository root (or root+subdirectory), so minimize URL
isn't of too much use to them, either.

For people *not* used to git-svnimport, git-svn also
supports:

 git svn init --minimize-url \
  --trunk http://repository-root/foo/trunk \
  --branches http://repository-root/foo/branches \
  --tags http://repository-root/foo/tags

And this is where the new --minimize-url command-line switch
comes in to allow for this behavior to continue working.
2007-05-13 12:10:43 -07:00

43 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
#
# Copyright (c) 2006 Eric Wong
test_description='git-svn commit-diff'
. ./lib-git-svn.sh
test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
echo hello > readme &&
svn import -m 'initial' . $svnrepo &&
cd .. &&
echo hello > readme &&
git update-index --add readme &&
git commit -a -m 'initial' &&
echo world >> readme &&
git commit -a -m 'another'
"
head=`git rev-parse --verify HEAD^0`
prev=`git rev-parse --verify HEAD^1`
# the internals of the commit-diff command are the same as the regular
# commit, so only a basic test of functionality is needed since we've
# already tested commit extensively elsewhere
test_expect_success 'test the commit-diff command' "
test -n '$prev' && test -n '$head' &&
git-svn commit-diff -r1 '$prev' '$head' '$svnrepo' &&
svn co $svnrepo wc &&
cmp readme wc/readme
"
test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
svn import -m 'sub-directory' import $svnrepo/subdir &&
git-svn init --minimize-url $svnrepo/subdir &&
git-svn fetch &&
git-svn commit-diff -r3 '$prev' '$head' &&
svn cat $svnrepo/subdir/readme > readme.2 &&
cmp readme readme.2
"
test_done