Skip to content

Commit

Permalink
Fix bug that prevented creating a repo on a relative path.
Browse files Browse the repository at this point in the history
gitrb would chdir to the path, then set GIT_DIR to the path.
git would try to cd to GIT_DIR and die.  Fixed by not chdiring first.
  • Loading branch information
bronson authored and minad committed Aug 25, 2010
1 parent 840b285 commit 7db859c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/gitrb/repository.rb
Expand Up @@ -334,11 +334,7 @@ def open_repository(create)
if create && !File.exists?("#{@path}/objects")
FileUtils.mkpath(@path) if !File.exists?(@path)
raise ArgumentError, "Not a valid Git repository: '#{@path}'" if !File.directory?(@path)
if @bare
Dir.chdir(@path) { git_init '--bare' }
else
Dir.chdir(@path[0..-6]) { git_init }
end
git_init(@bare ? '--bare' : nil)
else
raise ArgumentError, "Not a valid Git repository: '#{@path}'" if !File.directory?("#{@path}/objects")
end
Expand Down

0 comments on commit 7db859c

Please sign in to comment.