Skip to content

Commit 8ed8ba4

Browse files
Preventing tests teardown warnings
Improving `Git::Status#pretty`
1 parent 5d5d7d4 commit 8ed8ba4

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

lib/git/status.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,22 @@ def untracked
2727
def pretty
2828
out = ''
2929
self.each do |file|
30-
out << file.path
31-
out << "\n\tsha(r) " + file.sha_repo.to_s + ' ' + file.mode_repo.to_s
32-
out << "\n\tsha(i) " + file.sha_index.to_s + ' ' + file.mode_index.to_s
33-
out << "\n\ttype " + file.type.to_s
34-
out << "\n\tstage " + file.stage.to_s
35-
out << "\n\tuntrac " + file.untracked.to_s
36-
out << "\n"
30+
out << pretty_file(file)
3731
end
3832
out << "\n"
3933
out
4034
end
35+
36+
def pretty_file(file)
37+
<<FILE
38+
#{file.path}
39+
\tsha(r) #{file.sha_repo.to_s} #{file.mode_repo.to_s}
40+
\tsha(i) #{file.sha_index.to_s} #{file.mode_index.to_s}
41+
\ttype #{file.type.to_s}
42+
\tstage #{file.stage.to_s}
43+
\tuntrac #{file.untracked.to_s}
44+
FILE
45+
end
4146

4247
# enumerable method
4348

tests/test_helper.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def set_file_paths
2424
@wdir = create_temp_repo(@wdir_dot)
2525
end
2626

27-
def teardown
27+
teardown
28+
def git_teardown
2829
if @tmp_path
2930
FileUtils.rm_r(@tmp_path)
3031
end

0 commit comments

Comments
 (0)