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.