diff --git a/CHANGELOG.md b/CHANGELOG.md index f9120219..910fc4ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ # Change Log +## v2.3.0 (2024-09-01) + +[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.2.0..v2.3.0) + +Changes since v2.2.0: + +* f8bc987 Fix windows CI build error +* 471f5a8 Sanatize object ref sent to cat-file command +* 604a9a2 Make Git::Base#branch work when HEAD is detached + ## v2.2.0 (2024-08-26) [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.1.1..v2.2.0) diff --git a/lib/git/base.rb b/lib/git/base.rb index ae909dcc..0df9a5e3 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -650,10 +650,17 @@ def ls_tree(objectish, opts = {}) end def cat_file(objectish) - self.lib.object_contents(objectish) + self.lib.cat_file(objectish) end - # returns the name of the branch the working directory is currently on + # The name of the branch HEAD refers to or 'HEAD' if detached + # + # Returns one of the following: + # * The branch name that HEAD refers to (even if it is an unborn branch) + # * 'HEAD' if in a detached HEAD state + # + # @return [String] the name of the branch HEAD refers to or 'HEAD' if detached + # def current_branch self.lib.branch_current end diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 1742130e..f0cd2713 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -353,21 +353,105 @@ def name_rev(commit_ish) alias :namerev :name_rev - def object_type(sha) - command('cat-file', '-t', sha) + # Output the contents or other properties of one or more objects. + # + # @see https://git-scm.com/docs/git-cat-file git-cat-file + # + # @example Get the contents of a file without a block + # lib.cat_file_contents('README.md') # => "This is a README file\n" + # + # @example Get the contents of a file with a block + # lib.cat_file_contents('README.md') { |f| f.read } # => "This is a README file\n" + # + # @param object [String] the object whose contents to return + # + # @return [String] the object contents + # + # @raise [ArgumentError] if object is a string starting with a hyphen + # + def cat_file_contents(object, &block) + assert_args_are_not_options('object', object) + + if block_given? + Tempfile.create do |file| + # If a block is given, write the output from the process to a temporary + # file and then yield the file to the block + # + command('cat-file', "-p", object, out: file, err: file) + file.rewind + yield file + end + else + # If a block is not given, return the file contents as a string + command('cat-file', '-p', object) + end + end + + alias :object_contents :cat_file_contents + + # Get the type for the given object + # + # @see https://git-scm.com/docs/git-cat-file git-cat-file + # + # @param object [String] the object to get the type + # + # @return [String] the object type + # + # @raise [ArgumentError] if object is a string starting with a hyphen + # + def cat_file_type(object) + assert_args_are_not_options('object', object) + + command('cat-file', '-t', object) end - def object_size(sha) - command('cat-file', '-s', sha).to_i + alias :object_type :cat_file_type + + # Get the size for the given object + # + # @see https://git-scm.com/docs/git-cat-file git-cat-file + # + # @param object [String] the object to get the type + # + # @return [String] the object type + # + # @raise [ArgumentError] if object is a string starting with a hyphen + # + def cat_file_size(object) + assert_args_are_not_options('object', object) + + command('cat-file', '-s', object).to_i end - # returns useful array of raw commit object data - def commit_data(sha) - sha = sha.to_s - cdata = command_lines('cat-file', 'commit', sha) - process_commit_data(cdata, sha) + alias :object_size :cat_file_size + + # Return a hash of commit data + # + # @see https://git-scm.com/docs/git-cat-file git-cat-file + # + # @param object [String] the object to get the type + # + # @return [Hash] commit data + # + # The returned commit data has the following keys: + # * tree [String] + # * parent [Array] + # * author [String] the author name, email, and commit timestamp + # * committer [String] the committer name, email, and merge timestamp + # * message [String] the commit message + # * gpgsig [String] the public signing key of the commit (if signed) + # + # @raise [ArgumentError] if object is a string starting with a hyphen + # + def cat_file_commit(object) + assert_args_are_not_options('object', object) + + cdata = command_lines('cat-file', 'commit', object) + process_commit_data(cdata, object) end + alias :commit_data :cat_file_commit + def process_commit_data(data, sha) hsh = { 'sha' => sha, @@ -402,12 +486,50 @@ def each_cat_file_header(data) end end - def tag_data(name) - sha = sha.to_s - tdata = command_lines('cat-file', 'tag', name) - process_tag_data(tdata, name) + # Return a hash of annotated tag data + # + # Does not work with lightweight tags. List all annotated tags in your repository with the following command: + # + # ```sh + # git for-each-ref --format='%(refname:strip=2)' refs/tags | while read tag; do git cat-file tag $tag >/dev/null 2>&1 && echo $tag; done + # ``` + # + # @see https://git-scm.com/docs/git-cat-file git-cat-file + # + # @param object [String] the tag to retrieve + # + # @return [Hash] tag data + # + # Example tag data returned: + # ```ruby + # { + # "name" => "annotated_tag", + # "object" => "46abbf07e3c564c723c7c039a43ab3a39e5d02dd", + # "type" => "commit", + # "tag" => "annotated_tag", + # "tagger" => "Scott Chacon 1724799270 -0700", + # "message" => "Creating an annotated tag\n" + # } + # ``` + # + # The returned commit data has the following keys: + # * object [String] the sha of the tag object + # * type [String] + # * tag [String] tag name + # * tagger [String] the name and email of the user who created the tag and the timestamp of when the tag was created + # * message [String] the tag message + # + # @raise [ArgumentError] if object is a string starting with a hyphen + # + def cat_file_tag(object) + assert_args_are_not_options('object', object) + + tdata = command_lines('cat-file', 'tag', object) + process_tag_data(tdata, object) end + alias :tag_data :cat_file_tag + def process_tag_data(data, name) hsh = { 'name' => name } @@ -461,22 +583,6 @@ def process_commit_log_data(data) return hsh_array end - def object_contents(sha, &block) - if block_given? - Tempfile.create do |file| - # If a block is given, write the output from the process to a temporary - # file and then yield the file to the block - # - command('cat-file', "-p", sha, out: file, err: file) - file.rewind - yield file - end - else - # If a block is not given, return stdout - command('cat-file', '-p', sha) - end - end - def ls_tree(sha, opts = {}) data = { 'blob' => {}, 'tree' => {}, 'commit' => {} } @@ -591,8 +697,54 @@ def list_files(ref_dir) files end + # The state and name of branch pointed to by `HEAD` + # + # HEAD can be in the following states: + # + # **:active**: `HEAD` points to a branch reference which in turn points to a + # commit representing the tip of that branch. This is the typical state when + # working on a branch. + # + # **:unborn**: `HEAD` points to a branch reference that does not yet exist + # because no commits have been made on that branch. This state occurs in two + # scenarios: + # + # * When a repository is newly initialized, and no commits have been made on the + # initial branch. + # * When a new branch is created using `git checkout --orphan `, starting + # a new branch with no history. + # + # **:detached**: `HEAD` points directly to a specific commit (identified by its + # SHA) rather than a branch reference. This state occurs when you check out a + # commit, a tag, or any state that is not directly associated with a branch. The + # branch name in this case is `HEAD`. + # + HeadState = Struct.new(:state, :name) + + # The current branch state which is the state of `HEAD` + # + # @return [HeadState] the state and name of the current branch + # + def current_branch_state + branch_name = command('branch', '--show-current') + return HeadState.new(:detached, 'HEAD') if branch_name.empty? + + state = + begin + command('rev-parse', '--verify', '--quiet', branch_name) + :active + rescue Git::FailedError => e + raise unless e.result.status.exitstatus == 1 && e.result.stderr.empty? + + :unborn + end + + return HeadState.new(state, branch_name) + end + def branch_current - branches_all.select { |b| b[1] }.first[0] rescue nil + branch_name = command('branch', '--show-current') + branch_name.empty? ? 'HEAD' : branch_name end def branch_contains(commit, branch_name="") diff --git a/lib/git/object.rb b/lib/git/object.rb index 6c4aada9..5d399523 100644 --- a/lib/git/object.rb +++ b/lib/git/object.rb @@ -27,7 +27,7 @@ def sha end def size - @size ||= @base.lib.object_size(@objectish) + @size ||= @base.lib.cat_file_size(@objectish) end # Get the object's contents. @@ -38,9 +38,9 @@ def size # Use this for large files so that they are not held in memory. def contents(&block) if block_given? - @base.lib.object_contents(@objectish, &block) + @base.lib.cat_file_contents(@objectish, &block) else - @contents ||= @base.lib.object_contents(@objectish) + @contents ||= @base.lib.cat_file_contents(@objectish) end end @@ -237,7 +237,7 @@ def commit? def check_commit return if @tree - data = @base.lib.commit_data(@objectish) + data = @base.lib.cat_file_commit(@objectish) set_commit(data) end @@ -254,7 +254,7 @@ def initialize(base, sha, name) end def annotated? - @annotated ||= (@base.lib.object_type(self.name) == 'tag') + @annotated ||= (@base.lib.cat_file_type(self.name) == 'tag') end def message @@ -279,7 +279,7 @@ def check_tag if !self.annotated? @message = @tagger = nil else - tdata = @base.lib.tag_data(@name) + tdata = @base.lib.cat_file_tag(@name) @message = tdata['message'].chomp @tagger = Git::Author.new(tdata['tagger']) end @@ -300,7 +300,7 @@ def self.new(base, objectish, type = nil, is_tag = false) return Git::Object::Tag.new(base, sha, objectish) end - type ||= base.lib.object_type(objectish) + type ||= base.lib.cat_file_type(objectish) klass = case type when /blob/ then Blob diff --git a/lib/git/version.rb b/lib/git/version.rb index 15f996be..33cf0b9b 100644 --- a/lib/git/version.rb +++ b/lib/git/version.rb @@ -1,5 +1,5 @@ module Git # The current gem version # @return [String] the current gem version. - VERSION='2.2.0' + VERSION='2.3.0' end diff --git a/tests/units/test_branch.rb b/tests/units/test_branch.rb index 2256f4cb..aaea661f 100644 --- a/tests/units/test_branch.rb +++ b/tests/units/test_branch.rb @@ -50,6 +50,116 @@ def setup end end + # Git::Lib#current_branch_state + + test 'Git::Lib#current_branch_state -- empty repository' do + in_temp_dir do + `git init --initial-branch=my_initial_branch` + git = Git.open('.') + expected_state = Git::Lib::HeadState.new(:unborn, 'my_initial_branch') + assert_equal(expected_state, git.lib.current_branch_state) + end + end + + test 'Git::Lib#current_branch_state -- new orphan branch' do + in_temp_dir do + `git init --initial-branch=main` + `echo "hello world" > file1.txt` + `git add file1.txt` + `git commit -m "First commit"` + `git checkout --orphan orphan_branch 2> #{File::NULL}` + git = Git.open('.') + expected_state = Git::Lib::HeadState.new(:unborn, 'orphan_branch') + assert_equal(expected_state, git.lib.current_branch_state) + end + end + + test 'Git::Lib#current_branch_state -- active branch' do + in_temp_dir do + `git init --initial-branch=my_branch` + `echo "hello world" > file1.txt` + `git add file1.txt` + `git commit -m "First commit"` + git = Git.open('.') + expected_state = Git::Lib::HeadState.new(:active, 'my_branch') + assert_equal(expected_state, git.lib.current_branch_state) + end + end + + test 'Git::Lib#current_branch_state -- detached HEAD' do + in_temp_dir do + `git init --initial-branch=main` + `echo "hello world" > file1.txt` + `git add file1.txt` + `git commit -m "First commit"` + `echo "update" > file1.txt` + `git add file1.txt` + `git commit -m "Second commit"` + `git checkout HEAD~1 2> #{File::NULL}` + git = Git.open('.') + expected_state = Git::Lib::HeadState.new(:detached, 'HEAD') + assert_equal(expected_state, git.lib.current_branch_state) + end + end + + # Git::Lib#branch_current + + test 'Git::Lib#branch_current -- active branch' do + in_temp_dir do + `git init --initial-branch=main` + `echo "hello world" > file1.txt` + `git add file1.txt` + `git commit -m "First commit"` + git = Git.open('.') + assert_equal('main', git.lib.branch_current) + end + end + + test 'Git::Lib#branch_current -- unborn branch' do + in_temp_dir do + `git init --initial-branch=new_branch` + git = Git.open('.') + assert_equal('new_branch', git.lib.branch_current) + end + end + + test 'Git::Lib#branch_current -- detached HEAD' do + in_temp_dir do + `git init --initial-branch=main` + `echo "hello world" > file1.txt` + `git add file1.txt` + `git commit -m "First commit"` + `echo "update" > file1.txt` + `git add file1.txt` + `git commit -m "Second commit"` + `git checkout HEAD~1 2> #{File::NULL}` + git = Git.open('.') + assert_equal('HEAD', git.lib.branch_current) + end + end + + # Git::Base#branch + + test 'Git::Base#branch with detached head' do + in_temp_dir do + `git init` + `echo "hello world" > file1.txt` + `git add file1.txt` + `git commit -m "Initial commit"` + `echo "hello to another world" > file2.txt` + `git add file2.txt` + `git commit -m "Add another world"` + `git checkout HEAD~1 2> #{File::NULL}` + + git = Git.open('.') + branch = git.branch + + assert_equal('HEAD', branch.name) + end + end + + # Git::Base#branchs + test 'Git::Base#branchs with detached head' do in_temp_dir do git = Git.init('.', initial_branch: 'master') diff --git a/tests/units/test_lib.rb b/tests/units/test_lib.rb index 38694980..74be8dcd 100644 --- a/tests/units/test_lib.rb +++ b/tests/units/test_lib.rb @@ -24,14 +24,20 @@ def test_fetch_unshallow end end - def test_commit_data - data = @lib.commit_data('1cc8667014381') + def test_cat_file_commit + data = @lib.cat_file_commit('1cc8667014381') assert_equal('scott Chacon 1194561188 -0800', data['author']) assert_equal('94c827875e2cadb8bc8d4cdd900f19aa9e8634c7', data['tree']) assert_equal("test\n", data['message']) assert_equal(["546bec6f8872efa41d5d97a369f669165ecda0de"], data['parent']) end + def test_cat_file_commit_with_bad_object + assert_raise(ArgumentError) do + @lib.cat_file_commit('--all') + end + end + def test_commit_with_date create_file("#{@wdir}/test_file_1", 'content tets_file_1') @lib.add('test_file_1') @@ -40,7 +46,7 @@ def test_commit_with_date @lib.commit('commit with date', date: author_date.strftime('%Y-%m-%dT%H:%M:%S %z')) - data = @lib.commit_data('HEAD') + data = @lib.cat_file_commit('HEAD') assert_equal("Scott Chacon #{author_date.strftime("%s %z")}", data['author']) end @@ -77,7 +83,7 @@ def test_commit_with_no_verify move_file(pre_commit_path_bak, pre_commit_path) # Verify the commit was created - data = @lib.commit_data('HEAD') + data = @lib.cat_file_commit('HEAD') assert_equal("commit with no verify and pre-commit file\n", data['message']) end @@ -208,45 +214,56 @@ def test_name_rev_with_invalid_commit_ish end end - def test_object_type - assert_equal('commit', @lib.object_type('1cc8667014381')) # commit - assert_equal('tree', @lib.object_type('1cc8667014381^{tree}')) #tree - assert_equal('blob', @lib.object_type('v2.5:example.txt')) #blob - assert_equal('commit', @lib.object_type('v2.5')) + def test_cat_file_type + assert_equal('commit', @lib.cat_file_type('1cc8667014381')) # commit + assert_equal('tree', @lib.cat_file_type('1cc8667014381^{tree}')) #tree + assert_equal('blob', @lib.cat_file_type('v2.5:example.txt')) #blob + assert_equal('commit', @lib.cat_file_type('v2.5')) + end + + def test_cat_file_type_with_bad_object + assert_raise(ArgumentError) do + @lib.cat_file_type('--batch') + end + end + + def test_cat_file_size + assert_equal(265, @lib.cat_file_size('1cc8667014381')) # commit + assert_equal(72, @lib.cat_file_size('1cc8667014381^{tree}')) #tree + assert_equal(128, @lib.cat_file_size('v2.5:example.txt')) #blob + assert_equal(265, @lib.cat_file_size('v2.5')) end - def test_object_size - assert_equal(265, @lib.object_size('1cc8667014381')) # commit - assert_equal(72, @lib.object_size('1cc8667014381^{tree}')) #tree - assert_equal(128, @lib.object_size('v2.5:example.txt')) #blob - assert_equal(265, @lib.object_size('v2.5')) + def test_cat_file_size_with_bad_object + assert_raise(ArgumentError) do + @lib.cat_file_size('--batch') + end end - def test_object_contents + def test_cat_file_contents commit = "tree 94c827875e2cadb8bc8d4cdd900f19aa9e8634c7\n" commit << "parent 546bec6f8872efa41d5d97a369f669165ecda0de\n" commit << "author scott Chacon 1194561188 -0800\n" commit << "committer scott Chacon 1194561188 -0800\n" commit << "\ntest" - assert_equal(commit, @lib.object_contents('1cc8667014381')) # commit + assert_equal(commit, @lib.cat_file_contents('1cc8667014381')) # commit tree = "040000 tree 6b790ddc5eab30f18cabdd0513e8f8dac0d2d3ed\tex_dir\n" tree << "100644 blob 3aac4b445017a8fc07502670ec2dbf744213dd48\texample.txt" - assert_equal(tree, @lib.object_contents('1cc8667014381^{tree}')) #tree + assert_equal(tree, @lib.cat_file_contents('1cc8667014381^{tree}')) #tree blob = "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n2" - assert_equal(blob, @lib.object_contents('v2.5:example.txt')) #blob - + assert_equal(blob, @lib.cat_file_contents('v2.5:example.txt')) #blob end - def test_object_contents_with_block + def test_cat_file_contents_with_block commit = "tree 94c827875e2cadb8bc8d4cdd900f19aa9e8634c7\n" commit << "parent 546bec6f8872efa41d5d97a369f669165ecda0de\n" commit << "author scott Chacon 1194561188 -0800\n" commit << "committer scott Chacon 1194561188 -0800\n" commit << "\ntest" - @lib.object_contents('1cc8667014381') do |f| + @lib.cat_file_contents('1cc8667014381') do |f| assert_equal(commit, f.read.chomp) end @@ -255,17 +272,23 @@ def test_object_contents_with_block tree = "040000 tree 6b790ddc5eab30f18cabdd0513e8f8dac0d2d3ed\tex_dir\n" tree << "100644 blob 3aac4b445017a8fc07502670ec2dbf744213dd48\texample.txt" - @lib.object_contents('1cc8667014381^{tree}') do |f| + @lib.cat_file_contents('1cc8667014381^{tree}') do |f| assert_equal(tree, f.read.chomp) #tree end blob = "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n2" - @lib.object_contents('v2.5:example.txt') do |f| + @lib.cat_file_contents('v2.5:example.txt') do |f| assert_equal(blob, f.read.chomp) #blob end end + def test_cat_file_contents_with_bad_object + assert_raise(ArgumentError) do + @lib.cat_file_contents('--all') + end + end + # returns Git::Branch object array def test_branches_all branches = @lib.branches_all @@ -395,4 +418,30 @@ def test_empty_when_empty assert_true(git.lib.empty?) end end + + def test_cat_file_tag + expected_cat_file_tag_keys = %w[name object type tag tagger message].sort + + in_temp_repo('working') do + # Creeate an annotated tag: + `git tag -a annotated_tag -m "Creating an annotated tag"` + + git = Git.open('.') + cat_file_tag = git.lib.cat_file_tag('annotated_tag') + + assert_equal(expected_cat_file_tag_keys, cat_file_tag.keys.sort) + assert_equal('annotated_tag', cat_file_tag['name']) + assert_equal('46abbf07e3c564c723c7c039a43ab3a39e5d02dd', cat_file_tag['object']) + assert_equal('commit', cat_file_tag['type']) + assert_equal('annotated_tag', cat_file_tag['tag']) + assert_match(/^Scott Chacon \d+ [+-]\d+$/, cat_file_tag['tagger']) + assert_equal("Creating an annotated tag\n", cat_file_tag['message']) + end + end + + def test_cat_file_tag_with_bad_object + assert_raise(ArgumentError) do + @lib.cat_file_tag('--all') + end + end end diff --git a/tests/units/test_logger.rb b/tests/units/test_logger.rb index 470a2ed8..ced39292 100644 --- a/tests/units/test_logger.rb +++ b/tests/units/test_logger.rb @@ -17,39 +17,40 @@ def unexpected_log_entry end def test_logger - log = Tempfile.new('logfile') - log.close + in_temp_dir do |path| + log_path = 'logfile.log' - logger = Logger.new(log.path) - logger.level = Logger::DEBUG + logger = Logger.new(log_path, level: Logger::DEBUG) - @git = Git.open(@wdir, :log => logger) - @git.branches.size + @git = Git.open(@wdir, :log => logger) + @git.branches.size - logc = File.read(log.path) + logc = File.read(log_path) - expected_log_entry = /INFO -- : \["git", "(?.*?)", "branch", "-a"/ - assert_match(expected_log_entry, logc, missing_log_entry) + expected_log_entry = /INFO -- : \["git", "(?.*?)", "branch", "-a"/ + assert_match(expected_log_entry, logc, missing_log_entry) - expected_log_entry = /DEBUG -- : stdout:\n" cherry/ - assert_match(expected_log_entry, logc, missing_log_entry) + expected_log_entry = /DEBUG -- : stdout:\n" cherry/ + assert_match(expected_log_entry, logc, missing_log_entry) + end end def test_logging_at_info_level_should_not_show_debug_messages - log = Tempfile.new('logfile') - log.close - logger = Logger.new(log.path) - logger.level = Logger::INFO + in_temp_dir do |path| + log_path = 'logfile.log' - @git = Git.open(@wdir, :log => logger) - @git.branches.size + logger = Logger.new(log_path, level: Logger::INFO) - logc = File.read(log.path) + @git = Git.open(@wdir, :log => logger) + @git.branches.size - expected_log_entry = /INFO -- : \["git", "(?.*?)", "branch", "-a"/ - assert_match(expected_log_entry, logc, missing_log_entry) + logc = File.read(log_path) - expected_log_entry = /DEBUG -- : stdout:\n" cherry/ - assert_not_match(expected_log_entry, logc, unexpected_log_entry) + expected_log_entry = /INFO -- : \["git", "(?.*?)", "branch", "-a"/ + assert_match(expected_log_entry, logc, missing_log_entry) + + expected_log_entry = /DEBUG -- : stdout:\n" cherry/ + assert_not_match(expected_log_entry, logc, unexpected_log_entry) + end end end diff --git a/tests/units/test_object.rb b/tests/units/test_object.rb index 3f31b390..03f8d24d 100644 --- a/tests/units/test_object.rb +++ b/tests/units/test_object.rb @@ -62,7 +62,7 @@ def test_object_to_s assert_equal('ba492c62b6227d7f3507b4dcc6e6d5f13790eabf', @blob.sha) end - def test_object_size + def test_cat_file_size assert_equal(265, @commit.size) assert_equal(72, @tree.size) assert_equal(128, @blob.size) diff --git a/tests/units/test_signed_commits.rb b/tests/units/test_signed_commits.rb index 871b92a5..c50fa62f 100644 --- a/tests/units/test_signed_commits.rb +++ b/tests/units/test_signed_commits.rb @@ -24,7 +24,7 @@ def in_repo_with_signing_config(&block) end end - def test_commit_data + def test_cat_file_commit # Signed commits should work on windows, but this test is omitted until the setup # on windows can be figured out omit('Omit testing of signed commits on Windows') if windows_platform? @@ -34,7 +34,7 @@ def test_commit_data `git add README.md` `git commit -S -m "Signed, sealed, delivered"` - data = Git.open('.').lib.commit_data('HEAD') + data = Git.open('.').lib.cat_file_commit('HEAD') assert_match(SSH_SIGNATURE_REGEXP, data['gpgsig']) assert_equal("Signed, sealed, delivered\n", data['message'])