On 03/02/23 10:51, Guido Günther wrote:
On Mon, Jan 30, 2023 at 05:36:43PM +0100, Gioele Barabucci wrote:
The patches exported by `gbp-pq` can be wildly different depending on the
value set in the git option `diff.algorithm`.
[...]
This issue can be fixed by forcing the use of a specific diff algorithm
inside `gbp-pq`, for example by using `--diff-algorithm=histogram` in
`gbp.git.Repository.diff`.
Yeah, that's kind of expected as no attempt is made to force
options. One possibility would be to have `gbp clone` dump a set of
options into `.git/config` when cloning the repo. Forcing this in a
hardcoded way would disallow people to tweak these which can make
sense depending on the project.
I believe something like what has been done to "force" `--abbrev` could
also be done for `--diff-algorithm`:
* pq: Hardcode commit abbrev to 7 when exporting patches
https://git.sigxcpu.org/cgit/git-buildpackage/commit/?id=b8ea6621be6b96e8f2b187b503e1d788bf25b9ae
* pq: make --abbrev= configurable
https://git.sigxcpu.org/cgit/git-buildpackage/commit/?id=f97b910ca2b149c862636b8e7dcf6211d2ad7f0e
Another setting that can reduce diff churn and should be forced by `gbp-pq`
is `diff.rename`, that should be set to `copies`.
Why's that?
Why it should be set? because `diff.rename` influences the output of
`git diff`.
Why should it be set to `copies` (i.e. `--find-copies`)? Because it
improves rename detection and leads to smaller and more readable patches.
Regards,
--
Gioele Barabucci