Bug 1059285

Summary: rpm: __scm_apply_git macro should use --index for git apply and omit -a for git commit
Product: [Fedora] Fedora Reporter: Stanislav Ochotnicky <sochotni>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ffesti, jzeleny, novyjindrich, packaging-team-maint, pahan, pknirsch, pmatilai
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.11.2-1.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-16 23:22:05 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 before git apply none

Description Stanislav Ochotnicky 2014-01-29 15:10:04 UTC
Description of problem:
Currently scm_apply_git looks like this:
%__scm_apply_git(qp:m:)\
%{__git} apply %{-p:-p%{-p*}} -\
%{__git} commit %{-q} -a -m %{-m*} --author "%{__scm_author}"

Which means that any file additions will not be committed and in case the patch contains *only* file addition the macro can fail completely (empty commit).

I'd suggest changing the above definition to:
%__scm_apply_git(qp:m:)\
%{__git} apply --index %{-p:-p%{-p*}} -\
%{__git} commit %{-q} -m %{-m*} --author "%{__scm_author}"

That means adding the patch directly to index and then there is no need to add '-a' switch for git commit. 


Version-Release number of selected component (if applicable):
rpm-4.11.1-7.fc20.x86_64

How reproducible:
always

Comment 1 Panu Matilainen 2014-01-30 09:38:51 UTC
Right, the %autosetup stuff has seen fairly little real-world testing up to now, its entirely possible or even likely I haven't happened to test a patch that adds new files or at least one that *only* adds new files. Thanks for the report and education :)

Applied upstream now: http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=3f698977435bb8730e0865322f8a4856b0bb16af I'll pull this into 4.11.2 which will find its way to F20 via updates in nearish future.

Comment 2 Stanislav Ochotnicky 2014-01-31 13:43:17 UTC
Created attachment 857859 [details]
Try git am before git apply

I have improved this a bit by doing git am before git apply. The patch is created against master and seems to work fine for me at least.

Comment 3 Fedora Update System 2014-02-13 09:02:09 UTC
rpm-4.11.2-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/rpm-4.11.2-1.fc20

Comment 4 Fedora Update System 2014-02-13 09:43:53 UTC
rpm-4.11.2-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/rpm-4.11.2-1.fc19

Comment 5 Fedora Update System 2014-02-14 07:56:23 UTC
Package rpm-4.11.2-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing rpm-4.11.2-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-2467/rpm-4.11.2-1.fc20
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2014-02-16 23:22:05 UTC
rpm-4.11.2-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-04-09 01:00:37 UTC
rpm-4.11.2-2.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.