From 8a3e1da8991ef76ad10031243ac98f17c1e18b85 Mon Sep 17 00:00:00 2001 From: BlueWombat Date: Tue, 1 Apr 2014 11:53:38 +0200 Subject: [PATCH 1/2] fetch-svn-authors.sh: Rename unlink to rm Added touch for temp file git-svn-migrate.sh: Added a mkdir Put paths in quotes, as Windows paths even through MINGW/Git BASH aren't escaped --- fetch-svn-authors.sh | 3 ++- git-svn-migrate.sh | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/fetch-svn-authors.sh b/fetch-svn-authors.sh index 67c3765..4ceca3d 100755 --- a/fetch-svn-authors.sh +++ b/fetch-svn-authors.sh @@ -122,6 +122,7 @@ fi # Process each URL in the repository list. tmp_file="tmp-authors-transform.txt"; +touch $tmp_file; while read line do # Check for 2-field format: Name [tab] URL @@ -147,4 +148,4 @@ else # Output to the specified destination file. cat $tmp_file | sort -u > $destination; fi -unlink $tmp_file; +rm $tmp_file; diff --git a/git-svn-migrate.sh b/git-svn-migrate.sh index 1fd7a5f..e64a0aa 100755 --- a/git-svn-migrate.sh +++ b/git-svn-migrate.sh @@ -167,7 +167,7 @@ fi # Process each URL in the repository list. pwd=`pwd`; tmp_destination="$pwd/tmp-git-repo"; -mkdir -p $destination; +mkdir -p "$destination"; destination=`cd $destination; pwd`; #Absolute path. # Ensure temporary repository location is empty. @@ -175,6 +175,7 @@ if [[ -e $tmp_destination ]]; then echo "Temporary repository location \"$tmp_destination\" already exists. Exiting." >&2; exit 1; fi +mkdir -p "$tmp_destination"; while read line do # Check for 2-field format: Name [tab] URL @@ -191,38 +192,39 @@ do echo "Processing \"$name\" repository at $url..." >&2; # Init the final bare repository. - mkdir $destination/$name.git; - cd $destination/$name.git; + mkdir "$destination/$name.git"; + cd "$destination/$name.git"; git init --bare $gitinit_params; git symbolic-ref HEAD refs/heads/trunk; # Clone the original Subversion repository to a temp repository. cd $pwd; echo "- Cloning repository..." >&2; - git svn clone $url -A $authors_file --authors-prog=$dir/svn-lookup-author.sh --stdlayout --quiet $gitsvn_params $tmp_destination; + echo "$pwd/$authors_file"; + git svn clone $url -A "$pwd/$authors_file" --authors-prog="$dir/svn-lookup-author.sh" --stdlayout --quiet $gitsvn_params "$tmp_destination"; # Create .gitignore file. echo "- Converting svn:ignore properties into a .gitignore file..." >&2; if [[ $ignore_file != '' ]]; then - cp $ignore_file $tmp_destination/.gitignore; + cp "$ignore_file" "$tmp_destination/.gitignore"; fi - cd $tmp_destination; + cd "$tmp_destination"; git svn show-ignore --id trunk >> .gitignore; git add .gitignore; git commit --author="git-svn-migrate " -m 'Convert svn:ignore properties to .gitignore.'; # Push to final bare repository and remove temp repository. echo "- Pushing to new bare repository..." >&2; - git remote add bare $destination/$name.git; + git remote add bare "$destination/$name.git"; git config remote.bare.push 'refs/remotes/*:refs/heads/*'; git push bare; # Push the .gitignore commit that resides on master. git push bare master:trunk; cd $pwd; - rm -r $tmp_destination; + rm -r "$tmp_destination"; # Rename Subversion's "trunk" branch to Git's standard "master" branch. - cd $destination/$name.git; + cd "$destination/$name.git"; git branch -m trunk master; # Remove bogus branches of the form "name@REV". From 7f99420e0973a651ecdf12b48efd8af0d297b956 Mon Sep 17 00:00:00 2001 From: BlueWombat Date: Tue, 1 Apr 2014 11:58:46 +0200 Subject: [PATCH 2/2] Deleted CHANGELOG.txt since no real version pattern is employed. Updated README. --- CHANGELOG.txt | 11 ----------- README.txt | 5 +++++ 2 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 CHANGELOG.txt diff --git a/CHANGELOG.txt b/CHANGELOG.txt deleted file mode 100644 index ab56511..0000000 --- a/CHANGELOG.txt +++ /dev/null @@ -1,11 +0,0 @@ -Version 1.x ------------ -- Add option to make shared git repositories -- Don't use --no-metadata by default, but show it as an usage option -- Add ability to pass options to git-svn directly -- Allow git-svn-migrate to be called from any directory -- Make dependency on bash explicit - -Version 1.0 ------------ -- Initial release diff --git a/README.txt b/README.txt index c6122c8..15ef684 100644 --- a/README.txt +++ b/README.txt @@ -1,6 +1,11 @@ ABOUT git-svn-migrate --------------------- +This fork is basically th same as the original script by JOhn Albin. +The only real difference is tha tthe original broke when run in MINGW/Git BASH on WIndows. +This version includes some minor tweaks, that'll make it work flawlessly on Windows. +The arguments and procedure are all the same as the original script. + The git-svn-migrate project is a set of helper scripts to ease the migration of Subversion repositories to Git.