lib/kosmos/git_adapter.rb in kosmos-0.0.3 vs lib/kosmos/git_adapter.rb in kosmos-0.0.4

- old
+ new

@@ -4,10 +4,12 @@ module GitAdapter class << self def init_repo(path) Dir.chdir(path) do `git init` + `git config user.name Kosmos` + `git config user.email kosmos@kosmos.kosmos` File.open('.gitignore', 'w') do |file| file.write "!*\n" end end @@ -20,10 +22,17 @@ end end def revert_commit(repo_path, commit) Dir.chdir(repo_path) do - `git revert --no-commit #{commit.sha}` + # Favor "ours" (which is always HEAD for our purposes) when git-revert + # can handle that on its own. + `git revert --no-commit --strategy=merge --strategy-option=ours #{commit.sha}` + + # When files are being created or deleted, git will not do anything. + # In this case, keep all files alive; better to accidentally pollute + # than accidentally delete something important. + `git add *` end end def list_commits(repo_path) Dir.chdir(repo_path) do