Bug 1807681 - git format-patch fails to honor git config diff.orderfile
Summary: git format-patch fails to honor git config diff.orderfile
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: git
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Todd Zullinger
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-02-26 22:44 UTC by Eric Blake
Modified: 2020-03-16 15:12 UTC (History)
10 users (show)

Fixed In Version: git-2.25.1-2.fc31
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-16 15:12:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Eric Blake 2020-02-26 22:44:37 UTC
Description of problem:
git format-patch --help documents:
      -O<orderfile>
           Control the order in which files appear in the output. This
           overrides the diff.orderFile configuration variable (see git-
           config(1)). To cancel diff.orderFile, use -O/dev/null.

but while -O works on the command line, the configuration option does NOT work (which is particularly annoying when what I see via 'git log' does not translate into what I send with 'git send-email').

Version-Release number of selected component (if applicable):
git-2.24.1-1.fc31.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
$ mkdir -p /tmp/proj
$ cd /tmp/proj
$ git init
$ printf '%s\n' '*.h' '*.c' > git.orderfile
$ git config diff.orderfile git.orderfile
$ echo c > a.c
$ echo h > a.h
$ git add a.*
$ git diff --cached   # Yay, a.h lists before a.c
$ git commit -m 'placeholder'
$ git format-patch -1 --stdout
$ git format-patch -1 --stdout -Ogit.orderfile

Actual results:
the last two commands produce different output (the first outputs .c before .h)

Expected results:
The command should honor the documented config setting without me having to supply explicit -O.

Additional info:

Comment 1 Todd Zullinger 2020-02-26 23:57:23 UTC
Thanks for the detailed reproduction recipe Eric!

This looks like it was broken in 13cdf78094 (format-patch: teach format.notes config option, 2019-05-16) which was first released in 2.23.0.  It was subsequently fixed in 09ac67a183 (format-patch: move git_config() before repo_init_revisions(), 2019-12-09) which was released in 2.25.0.  It's probably about time to push 2.25.1 to f31.

I have 2.25.1 built in the @git-maint/git copr if you'd like to test that sooner.

Comment 2 Eric Blake 2020-02-27 02:16:47 UTC
Confirmed that the copr 2.25.1 build fixes the problem. Thanks for the fast response!

Comment 3 Fedora Update System 2020-03-14 22:39:51 UTC
FEDORA-2020-f87c04bad1 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-f87c04bad1

Comment 4 Todd Zullinger 2020-03-14 22:52:16 UTC
Sorry for the slight lag in pushing this update.  I was hoping that a patch for bug#1791810 might come out of Ondrej's post on the git list.

Eric, thanks for the many, many interesting bits of shell and general knowledge I've picked up from your posts on various lists over a lot of years!  I couldn't tell you how often I've picked up something very useful from your messages.

Comment 5 Fedora Update System 2020-03-15 14:29:56 UTC
git-2.25.1-2.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-f87c04bad1

Comment 6 Fedora Update System 2020-03-16 15:12:06 UTC
git-2.25.1-2.fc31 has been pushed to the Fedora 31 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.