Module: TempGit

Defined in:
lib/bloc/temp_git.rb

Instance Method Summary collapse

Instance Method Details

#in_tmp_gitObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bloc/temp_git.rb', line 2

def in_tmp_git
  begin
    `mv .git .git.backup`
    `git init`
    `git add .`
    `git commit -m "initial"`
    yield
  rescue Exception => e
    raise e
  ensure
    `git checkout .`
    `rm -rf .git`
    `mv .git.backup .git`
  end
end