Hi Chris,
On Fri, Nov 22, 2024 at 08:43:53AM +0000, Chris Lamb wrote:
> Source: git-buildpackage
> Version: 0.9.35
> Severity: normal
> Tags: patch
> 
> Hi,
> 
> Using diff.noprefix=true globally makes Git nicer to use, as it makes
> it possible to copy file paths when running git diff (etc.) on the
> command line.
> 
> Otherwise, you typically see filenames which technically don't exist:
> these files aren't under a directory called "a" or "b":
> 
>   --- a/tochange.py
>   +++ b/tochange.py
> 
> However, when this option is set, "pq export" will serialise the patch
> branch into debian/patches with the filenames missing the prefix,
> which dpkg-source then can't actually parse and it errors out. In other
> words, they look like this:
> 
>   --- tochange.py
>   +++ tochange.py
> 
> A patch is attached that overrides diff.noprefix when calling out to
> "git diff", meaning that it will use "a/" and "b/" as expected. This
> seems somewhat analogous to overriding the user's core.abbrev setting.
> 
> 
> Regards,
> 
> -- 
>       ,''`.
>      : :'  :     Chris Lamb
>      `. `'`      [email protected] / chris-lamb.co.uk
>        `-

> diff --git gbp/git/repository.py gbp/git/repository.py
> index 98f7e43..d879032 100644
> --- gbp/git/repository.py
> +++ gbp/git/repository.py
> @@ -1835,6 +1835,7 @@ class GitRepository(object):
>              options.add('--', paths)
>          if abbrev is not None:
>              config_args.add('core.abbrev=%d' % abbrev)
> +        config_args.add('diff.noprefix=false')

Thanks! Could you do a MR at

   https://salsa.debian.org/agx/git-buildpackage

so we see CI still passes? Otherwise I can do so over the next days.

Cheers,
 -- Guido

>          output, stderr, ret = self._git_inout('diff',
>                                                options.args,
>                                                config_args=config_args.args)

Reply via email to