Skip to content

Commit befc0f0

Browse files
author
Johan Martinsson
committed
fixed sed regex that calculated module by deleting trunk instead of grabbing the part before trunk
1 parent 018f649 commit befc0f0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

git-svn-clone-externals

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ function call()
1717
function do_clone()
1818
{
1919
test -d .git_externals || return 1
20-
module=`echo $remote_url|sed 's,\(.*\)\(/trunk\|/branch.*\|/tag.*\),\1,'`
21-
branch=`echo $remote_url|sed 's,\(.*\)\(/trunk\|/branch.*\|/tag.*\),\2,'|sed 's,^/,,'`
20+
module=`echo $remote_url|sed 's,\(.*\)\(/trunk.*\|/branch.*\|/tag.*\),\1,'`
21+
branch=`echo $remote_url|sed 's,\(.*\)\(/trunk.*\|/branch.*\|/tag.*\),\2,'|sed 's,^/,,'`
22+
suffix=`echo $branch|sed 's,^\(trunk\|branches\|tags\)\(.*\),\2,'`
2223
if [[ $branch = $remote_url ]]; then
2324
branch=""
2425
fi
@@ -41,15 +42,15 @@ function do_clone()
4142
# additional options for git-svn
4243
call git svn clone "$revision" "$module" "$local_directory"
4344
else
44-
call git svn clone "$revision" "$module" -T trunk -b $brch -t $tags "$local_directory"
45+
call git svn clone "$revision" "$module" -T trunk$suffix -b $brch$suffix -t $tags$suffix "$local_directory"
4546
fi
4647

4748
fi
4849
(
4950
branch="$(echo ${branch}|sed 's,/$,,')"
5051
if [ -n "$branch" ]; then
5152
cd "$local_directory"
52-
call git reset --hard $branch
53+
call git reset --hard `echo $branch | sed "s,$suffix,,"`
5354
fi
5455
)
5556
)

0 commit comments

Comments
 (0)