Browse files

Detect and abort when a directory was expected to be a Git working co…

…py but it isn't. One cause for this is when a directory is moved somewhere else and the old location is redefined as an svn:externals.
  • Loading branch information...
Marc Liyanage
Marc Liyanage committed May 6, 2010
1 parent a04948c commit 699124e6ad0887ee09d329f26c7c1c23dd082fca
Showing with 6 additions and 0 deletions.
  1. +6 −0 git-svn-clone-externals.rb
@@ -169,6 +169,7 @@ def update_current_dir
shell('git svn fetch')
# regular update, rebase to SVN head
+ check_working_copy_git
@@ -179,6 +180,11 @@ def update_current_dir
+ def check_working_copy_git
+ raise "Error: Expected '#{Dir.getwd}' to be a Git working copy, but it isn't. Maybe a directory was replaced with an SVN externals definition. Please remove this directory and run this script again." unless File.exist?('.git')
+ end
def check_working_copy_branch
shell('git status')[0] =~ /On branch (\S+)/
raise "Error: Unable to determine Git branch in '#{Dir.getwd}' using 'git status'" unless $~

0 comments on commit 699124e

Please sign in to comment.