Skip to content

Commit

Permalink
Git now uses own clean instead of rm -rf
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen Byrne committed Nov 16, 2011
1 parent 98fa322 commit 90b850c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/source_control/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def checkout(revision = nil, stdout = $stdout, checkout_path = path)
git("reset", ['--hard', revision.number]) if revision
end

# TODO implement clean_checkout as "git clean -d" - much faster
def clean_checkout(revision = nil, stdout = $stdout)
super(revision, stdout)
# We're forcing (-f) the clean incase git clean.requireForce is set to true
git('clean', ['-d', '-f'])
end

def latest_revision
Expand Down
8 changes: 8 additions & 0 deletions test/unit/source_control/git_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ def test_checkout_should_blow_up_when_repository_was_not_given_to_the_ctor
assert_raise(RuntimeError) { git.checkout }
end
end

def test_clean_checkout_should_perform_git_clean
in_sandbox do
git = new_git(:repository => "git:/my_repo")
git.expects(:git).with("clean", ['-d', '-f'])
git.clean_checkout
end
end

def test_latest_revision_should_call_git_log_and_send_it_to_parser
in_sandbox do
Expand Down

0 comments on commit 90b850c

Please sign in to comment.