[go: up one dir, main page]

Add project support to unsigned_commit_shas for SSH commit signatures

The following discussion from !214739 (merged) should be addressed:

  • @vyaklushin started a discussion:

    issue: I found this code that only supports commit shas without projects.

        # Find commits that are lacking a signature in the database at present
        def unsigned_commit_shas(commit_shas)
          return [] if commit_shas.empty?
    
          signed = by_commit_sha(commit_shas).pluck(:commit_sha)
          commit_shas - signed
        end
    

    source

    It's used in BranchHooksService to create commit signatures after the git push.

    signature_types
      .map { |signature| signature.unsigned_commit_shas(commit_shas) }
      .reduce(&:&)

    source

    It shouldn't be a problem right now, since CreateCommitSignatureWorker doesn't support Ssh::Commits.

        # Instantiate commits first to lazily load the signatures
        commits.map! do |commit|
          case commit.signature_type
          when :PGP
            Gitlab::Gpg::Commit.new(commit)
          when :X509
            Gitlab::X509::Commit.new(commit)
          end
        end

    source

    But it sounds like a follow up issue. WDYT? 🤔

Edited by 🤖 GitLab Bot 🤖