1

when using the rugged git library how can I apply that diff to my dest branch as a commit?.

  # @param src [Rugged::Object] - the rugged object or string to compare from
  # @param dst [Rugged::Object] - the rugged object or string to compare to, defaults to parent
  # @return [Rugged::Diff] a rugged diff object between src and dst
  def create_diff(src, dst = nil)
    src = repo.lookup(find_ref(src))
    dst ||= repo.lookup(src.parents.first)
    dst = find_ref(dst)
    src.diff(dst)
  end

  # @param sha_or_ref [String] - the name or sha of the ref
  # @return [String] the oid of the sha or ref
  def find_ref(sha_or_ref)
    case sha_or_ref
      when Rugged::Object
        sha_or_ref.oid
      else
        repo.rev_parse_oid(sha_or_ref)
    end
  end

Is there not an easy way to apply a patch or diff? Seems silly that I would need to loop through each change in the diff and either add/rm the file.

apaderno
  • 28,547
  • 16
  • 75
  • 90

1 Answers1

0

Considering the:

You would have to wait for that feature to be ported in rugged.
The last official release v0.24.0 does not include 0.24.4.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250