From a7b98f2185ef12b4144964f38683a9784a1b51d2 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 28 Jun 2024 16:51:42 +0200 Subject: [PATCH 1/2] CI: set git user environment variables --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64de1e8..4000cd6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,11 @@ jobs: run: bundle exec rake spec - name: Run behavior tests run: bundle exec cucumber + env: + GIT_COMMITTER_NAME: 'Aruba' + GIT_COMMITTER_EMAIL: 'aruba@example.com' + GIT_AUTHOR_NAME: 'Aruba' + GIT_AUTHOR_EMAIL: 'aruba@example.com' - name: Build gem run: gem build --strict --verbose *.gemspec tests: From b6060ffb100fb9e876681db51778f504d34adef7 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 5 Aug 2024 14:27:44 +0200 Subject: [PATCH 2/2] Update git requirement from ~> 1.7 to >= 1.7, < 3.0 Updates the requirements on [git](https://github.com/ruby-git/ruby-git) to permit the latest version. - [Release notes](https://github.com/ruby-git/ruby-git/releases) - [Changelog](https://github.com/ruby-git/ruby-git/blob/master/CHANGELOG.md) - [Commits](https://github.com/ruby-git/ruby-git/compare/v1.7.0...v2.0.0) --- updated-dependencies: - dependency-name: git dependency-type: direct:production ... --- lib/modulesync.rb | 2 +- lib/modulesync/repository.rb | 2 +- lib/monkey_patches.rb | 4 ++-- modulesync.gemspec | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/modulesync.rb b/lib/modulesync.rb index 16e3baf..b61ac78 100644 --- a/lib/modulesync.rb +++ b/lib/modulesync.rb @@ -178,7 +178,7 @@ def self.update(cli_options) # managed_modules is either an array or a hash managed_modules.each do |puppet_module| manage_module(puppet_module, module_files, defaults) - rescue ModuleSync::Error, Git::GitExecuteError => e + rescue ModuleSync::Error, Git::Error => e message = e.message || 'Error during `update`' warn "#{puppet_module.given_name}: #{message}" exit 1 unless options[:skip_broken] diff --git a/lib/modulesync/repository.rb b/lib/modulesync/repository.rb index 3f55625..0a2596f 100644 --- a/lib/modulesync/repository.rb +++ b/lib/modulesync/repository.rb @@ -158,7 +158,7 @@ def submit_changes(files, options) repo.push('origin', branch, opts_push) puts "Changes have been pushed to: '#{branch}'" end - rescue Git::GitExecuteError => e + rescue Git::Error => e raise unless e.message.match?(/working (directory|tree) clean/) puts "There were no changes in '#{@directory}'. Not committing." diff --git a/lib/monkey_patches.rb b/lib/monkey_patches.rb index 232118c..d16833f 100644 --- a/lib/monkey_patches.rb +++ b/lib/monkey_patches.rb @@ -2,9 +2,9 @@ module Git module LibMonkeyPatch - # Monkey patch set_custom_git_env_variables due to our ::Git::GitExecuteError handling. + # Monkey patch set_custom_git_env_variables due to our ::Git::Error handling. # - # We rescue on the GitExecuteError and proceed differently based on the output of git. + # We rescue on the Git::Error and proceed differently based on the output of git. # This way makes code language-dependent, so here we ensure that Git gem throw git commands with the "C" language def set_custom_git_env_variables super diff --git a/modulesync.gemspec b/modulesync.gemspec index 3921e6e..95e4b8d 100644 --- a/modulesync.gemspec +++ b/modulesync.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'simplecov', '~> 0.22.0' spec.add_development_dependency 'voxpupuli-rubocop', '~> 2.8.0' - spec.add_runtime_dependency 'git', '~>1.7' + spec.add_runtime_dependency 'git', '>=1.7', '<3.0' spec.add_runtime_dependency 'gitlab', '>=4', '<6' spec.add_runtime_dependency 'octokit', '>=4', '<9' spec.add_runtime_dependency 'puppet-blacksmith', '>= 3.0', '< 8'