Skip to content

Exception ScmCommandAborted is not thrown if the cache is disabled and the Git command return a non-zero exit code #722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xel1045 opened this issue Oct 16, 2018 · 1 comment

Comments

@xel1045
Copy link

xel1045 commented Oct 16, 2018

The behaviour change between ShellRedirector.execute and AbstractAdapter.shellout:

if !git_cache_id.nil? && git_cache_enabled? && !bypass_cache
  RedmineGitHosting::ShellRedirector.execute(cmd_str, git_cache_id, options, &block)
else
  Redmine::Scm::Adapters::AbstractAdapter.shellout(cmd_str, options, &block)
end

The method ShellRedirector.execute will check for the exit code, but AbstractAdapter.shellout not. It's then impossible to extend the adapter and use the Git status code.

Redmine's Git adapter also check the status code that way:

        def git_cmd(args, options = {}, &block)
          # ...
          ret = shellout(
                   self.class.sq_bin + ' ' + full_args.map { |e| shell_quote e.to_s }.join(' '),
                   options,
                   &block
                   )
          if $? && $?.exitstatus != 0
            raise ScmCommandAborted, "git exited with non-zero status: #{$?.exitstatus}"
          end
          ret
        end
@PowerKiKi
Copy link
Collaborator

As discussed in #732 (comment), issues related to Redmine < 4.0 or severely outdated issues are being closed to help clean up the issue tracker.

If this issue is still relevant to you and you are running Redmine >= 4.0, please open a new issue including all new relevant information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants