Skip to content

Commit 8345fec

Browse files
authored
Fix issues with a HEREDOC entry in git.status (#385)
* requiring Ruby 2.3 or better * fixing status#pretty using <<~ because we only maintain on Ruby 2.3+ now * fixing a rake warning about branch not using a decomposed argument Signed-off-by: Vern Burton <me@vernburton.com>
1 parent 0593e4f commit 8345fec

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

git.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
1111
s.version = Git::VERSION
1212

1313
s.require_paths = ['lib']
14-
s.required_ruby_version = '>= 1.9'
14+
s.required_ruby_version = '>= 2.3'
1515
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to?(:required_rubygems_version=)
1616
s.requirements = ['git 1.6.0.0, or greater']
1717

lib/git/status.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def pretty
104104
end
105105

106106
def pretty_file(file)
107-
<<-FILE.strip_heredoc
107+
<<~FILE
108108
#{file.path}
109109
\tsha(r) #{file.sha_repo} #{file.mode_repo}
110110
\tsha(i) #{file.sha_index} #{file.mode_index}

tests/units/test_status.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ def setup
99
set_file_paths
1010
end
1111

12+
def test_status_pretty
13+
in_temp_dir do |path|
14+
git = Git.clone(@wdir, 'test_dot_files_status')
15+
string = "ex_dir/ex.txt\n\tsha(r) \n\tsha(i) e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 " \
16+
"100644\n\ttype \n\tstage 0\n\tuntrac \nexample.txt\n\tsha(r) \n\tsha(i) " \
17+
"8dc79ae7616abf1e2d4d5d97d566f2b2f6cee043 100644\n\ttype \n\tstage 0\n\tuntrac " \
18+
"\nscott/newfile\n\tsha(r) \n\tsha(i) 5d4606820736043f9eed2a6336661d6892c820a5 " \
19+
"100644\n\ttype \n\tstage 0\n\tuntrac \nscott/text.txt\n\tsha(r) \n\tsha(i) " \
20+
"3cc71b13d906e445da52785ddeff40dad1163d49 100644\n\ttype \n\tstage 0\n\tuntrac \n\n"
21+
22+
assert_equal(git.status.pretty, string)
23+
end
24+
end
25+
1226
def test_dot_files_status
1327
in_temp_dir do |path|
1428
git = Git.clone(@wdir, 'test_dot_files_status')

0 commit comments

Comments
 (0)