Respect user details of git repo.

Branch with compiled pages respects repo's user details settings.
This commit is contained in:
Gee-Bee 2014-07-16 10:56:58 +02:00
parent 84b3cb0121
commit 4f9d4879d7
2 changed files with 9 additions and 1 deletions

View file

@ -20,12 +20,18 @@ module Middleman
unless File.exists?('.git')
`git init`
`git remote add origin #{url}`
`git config user.name "#{self.user_name}"`
`git config user.name "#{self.user_email}"`
else
# check if the remote repo has changed
unless url == `git config --get remote.origin.url`.chop
`git remote rm origin`
`git remote add origin #{url}`
end
# check if the user name has changed
`git config user.name "#{self.user_name}"` unless self.user_name == `git config --get user.name`
# check if the remote repo has changed
`git config user.email "#{self.user_email}"` unless self.user_email == `git config --get user.email`
end
end