Skip to content

Commit f8bc987

Browse files
committedSep 1, 2024·
Fix windows CI build error
1 parent 471f5a8 commit f8bc987

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed
 

Diff for: ‎lib/git/lib.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,13 @@ def name_rev(commit_ish)
357357
#
358358
# @see https://git-scm.com/docs/git-cat-file git-cat-file
359359
#
360-
# @param object [String] the object whose contents to return
361-
# @param opts [Hash] the options for this command
362-
# @option opts [Boolean] :tag
363-
# @option opts [Boolean] :size
364-
# @option opts
360+
# @example Get the contents of a file without a block
361+
# lib.cat_file_contents('README.md') # => "This is a README file\n"
365362
#
363+
# @example Get the contents of a file with a block
364+
# lib.cat_file_contents('README.md') { |f| f.read } # => "This is a README file\n"
365+
#
366+
# @param object [String] the object whose contents to return
366367
#
367368
# @return [String] the object contents
368369
#

Diff for: ‎tests/units/test_lib.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def test_cat_file_tag
424424

425425
in_temp_repo('working') do
426426
# Creeate an annotated tag:
427-
`git tag -a annotated_tag -m 'Creating an annotated tag'`
427+
`git tag -a annotated_tag -m "Creating an annotated tag"`
428428

429429
git = Git.open('.')
430430
cat_file_tag = git.lib.cat_file_tag('annotated_tag')

Diff for: ‎tests/units/test_logger.rb

+23-22
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,40 @@ def unexpected_log_entry
1717
end
1818

1919
def test_logger
20-
log = Tempfile.new('logfile')
21-
log.close
20+
in_temp_dir do |path|
21+
log_path = 'logfile.log'
2222

23-
logger = Logger.new(log.path)
24-
logger.level = Logger::DEBUG
23+
logger = Logger.new(log_path, level: Logger::DEBUG)
2524

26-
@git = Git.open(@wdir, :log => logger)
27-
@git.branches.size
25+
@git = Git.open(@wdir, :log => logger)
26+
@git.branches.size
2827

29-
logc = File.read(log.path)
28+
logc = File.read(log_path)
3029

31-
expected_log_entry = /INFO -- : \["git", "(?<global_options>.*?)", "branch", "-a"/
32-
assert_match(expected_log_entry, logc, missing_log_entry)
30+
expected_log_entry = /INFO -- : \["git", "(?<global_options>.*?)", "branch", "-a"/
31+
assert_match(expected_log_entry, logc, missing_log_entry)
3332

34-
expected_log_entry = /DEBUG -- : stdout:\n" cherry/
35-
assert_match(expected_log_entry, logc, missing_log_entry)
33+
expected_log_entry = /DEBUG -- : stdout:\n" cherry/
34+
assert_match(expected_log_entry, logc, missing_log_entry)
35+
end
3636
end
3737

3838
def test_logging_at_info_level_should_not_show_debug_messages
39-
log = Tempfile.new('logfile')
40-
log.close
41-
logger = Logger.new(log.path)
42-
logger.level = Logger::INFO
39+
in_temp_dir do |path|
40+
log_path = 'logfile.log'
4341

44-
@git = Git.open(@wdir, :log => logger)
45-
@git.branches.size
42+
logger = Logger.new(log_path, level: Logger::INFO)
4643

47-
logc = File.read(log.path)
44+
@git = Git.open(@wdir, :log => logger)
45+
@git.branches.size
4846

49-
expected_log_entry = /INFO -- : \["git", "(?<global_options>.*?)", "branch", "-a"/
50-
assert_match(expected_log_entry, logc, missing_log_entry)
47+
logc = File.read(log_path)
5148

52-
expected_log_entry = /DEBUG -- : stdout:\n" cherry/
53-
assert_not_match(expected_log_entry, logc, unexpected_log_entry)
49+
expected_log_entry = /INFO -- : \["git", "(?<global_options>.*?)", "branch", "-a"/
50+
assert_match(expected_log_entry, logc, missing_log_entry)
51+
52+
expected_log_entry = /DEBUG -- : stdout:\n" cherry/
53+
assert_not_match(expected_log_entry, logc, unexpected_log_entry)
54+
end
5455
end
5556
end

0 commit comments

Comments
 (0)
Please sign in to comment.