Bug 1082038

Summary: "%autosetup -S git" should use "git am" whenever possible
Product: [Fedora] Fedora Reporter: Michal Schmidt <mschmidt>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: jzeleny, novyjindrich, packaging-team-maint, pknirsch, pmatilai, sochotni
Target Milestone: ---Keywords: FutureFeature, Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.11.3-1.fc20 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-08 13:05:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Try "git am" first in "%autosetup -S git"
none
[PATCH] add support for "%autosetup -S git_am" none

Description Michal Schmidt 2014-03-28 14:17:36 UTC
Created attachment 879856 [details]
Try "git am" first in "%autosetup -S git"

In Fedora packaging I often use patch files generated by "git format-patch". They are best applied using "git am", which preserves the authorship information and commit messages.

Unfortunately "%autosetup -S git" does not use "git am" and loses the commit messages. For this reason I've been staying away from autosetup in %prep and calling sequences of git commands manually instead.

It would be nice if autosetup preferred "git am" and only if that failed, it would fall back to "git apply". I found an earlier attempt to implement this feature, by Stanislav Ochotnický:
  https://bugzilla.redhat.com/show_bug.cgi?id=1059285#c2
That attempt however was buggy and was not pushed forward.

Here is a new proposed patch. I've tested it on a package with a mixture of git-formatted and plain patches and they applied successfully.

Comment 1 Panu Matilainen 2014-04-08 10:05:03 UTC
I will consider a patch that adds an option to make %autosetup use "git am" (and require it works for all patches), but these "lets try this, oops didn't work, lets try something else" kind of patches will not be accepted. Consistency and predictability are more important than preserving original git commit information in rpmbuild context.

Comment 2 Michal Schmidt 2014-04-08 12:12:58 UTC
Created attachment 884001 [details]
[PATCH] add support for "%autosetup -S git_am"

Panu, thanks for the review. Here's a new patch that leaves the existing "%autosetup -S git" alone and adds a new variant: "%autosetup -S git_am"

Comment 3 Panu Matilainen 2014-04-08 13:05:37 UTC
Works for me. Applied upstream, thanks for the patch!

Comment 4 Fedora Update System 2014-09-08 06:56:25 UTC
rpm-4.11.3-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/rpm-4.11.3-1.fc20

Comment 5 Fedora Update System 2014-09-16 07:49:56 UTC
rpm-4.11.3-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/rpm-4.11.3-1.fc19

Comment 6 Fedora Update System 2014-09-19 09:58:39 UTC
rpm-4.11.3-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2014-10-04 03:26:58 UTC
rpm-4.11.3-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.