Skip to content
Browse files

Allow user to pre-init git repository if desired.

  • Loading branch information...
1 parent 6483d1f commit 2edca09cb4fd4292e059e45f04fa4d9e98dc8f5e @purcell committed
Showing with 7 additions and 2 deletions.
  1. +7 −2 darcs-to-git
View
9 darcs-to-git
@@ -458,9 +458,15 @@ ENV['GIT_PAGER'] = ENV['PAGER'] = "cat" # so that pager of git-log doesn't halt
unless File.directory?("_darcs")
puts "Initialising the working area."
- unless Dir.entries(Dir.pwd).size == 2
+ if Dir.entries(Dir.pwd).delete_if { |e| e == ".git" }.size != 2
raise "Directory not empty. Aborting"
end
+ if File.directory?(".git")
+ puts "Detected pre-created git repository. If this is not an empty repo, you may encounter problems."
+ else
+ puts "Initializing git repo"
+ run("git", "init")
+ end
darcs_init = %w(darcs init)
if darcs2_repo?(SRCREPO)
@@ -471,7 +477,6 @@ unless File.directory?("_darcs")
end
run(*darcs_init)
- run("git", "init")
FileUtils.mkdir_p(".git/info")
File.open(".git/info/exclude", "a+") { |f| f.write("_darcs\n.DS_Store\n") }

0 comments on commit 2edca09

Please sign in to comment.
Something went wrong with that request. Please try again.