Bug 1059285 - rpm: __scm_apply_git macro should use --index for git apply and omit -a for git commit
Summary: rpm: __scm_apply_git macro should use --index for git apply and omit -a for g...
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2014-01-29 15:10 UTC by Stanislav Ochotnicky
Modified: 2014-04-09 01:00 UTC (History)
7 users (show)

Fixed In Version: rpm-4.11.2-1.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-02-16 23:22:05 UTC
Type: Bug

Attachments (Terms of Use)
Try git am before git apply (955 bytes, patch)
2014-01-31 13:43 UTC, Stanislav Ochotnicky
no flags Details | Diff

Description Stanislav Ochotnicky 2014-01-29 15:10:04 UTC
Description of problem:
Currently scm_apply_git looks like this:
%{__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:
%{__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):

How reproducible:

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.

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.

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:
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.

Note You need to log in before you can comment on or make changes to this bug.