#1130890 dh-make-golang: stop adding debian/.gitignore file

Package:
dh-make-golang
Source:
dh-make-golang
Description:
tool that converts Go packages into Debian package source
Submitter:
Simon Josefsson
Date:
2026-03-16 10:29:01 UTC
Severity:
normal
#1130890#5
Date:
2026-03-15 16:33:41 UTC
From:
To:
Generating the debian/.gitignore file breaks dgit/tag2upload, see
earlier discussions:

https://lists.debian.org/debian-go/2026/03/msg00034.html

It is arguable a dpkg-source bug, but unfixed:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908747

We can work around this by not generated these debian/.gitignore files
in the first place.  I don't think the value of those files outweigh the
problem.  In my build workflows, I never see any difference with or
without that debian/.gitignore file.

/Simon

#1130890#10
Date:
2026-03-16 01:43:34 UTC
From:
To:
Hi,

Thanks for reporting!

I don't see any error messages in
https://lists.debian.org/debian-go/2026/03/msg00034.html, nor is there
any output from `git debpush` or something. The Bug#908747 does not
have the error message either and it does not differentiate between
/.gitignore and debian/.gitignore. The dh-make-golang package has been
generating a /.gitignore file in the project root for many years. The
change now is that it was moved to `debian/.gitignore` as Debian
packages should not be polluting the upstream "file namespace".

Is your suggestion to just stop having a `.gitignore` at all?

Searching https://codesearch.debian.net/search?q=debian%2F.gitignore&literal=1
yields quite a lot of packages having a `debian/.gitignore`. I don't
think it is a sensible stanze to take that such a file is forbidden.
It is a pity the dpkg maintainer hasn't responded to Bug#908747 since
2018 when it was filed..

#1130890#15
Date:
2026-03-16 09:43:04 UTC
From:
To:
Otto Kekäläinen <otto@debian.org> writes:

The error message is in the git commit message if you follow the URL in
that message.  I get similar errors for dgit/tag2upload uploads for any
'dh-make-golang make' generated debian/* tree (which is pretty much ALL
of golang-* packages) unless I remove the debian/.gitignore file.

jas@frallan:~/dpkg/golang-github-gen2brain-shm$ dgit push-built --new -Cgolang-github-gen2brain-shm_0.2.1-1_amd64.changes
Format `3.0 (quilt)', need to check/update patch stack
canonical suite name for unstable is sid
no version available from the archive
nothing quilty to commit, ok.
checking that golang-github-gen2brain-shm_0.2.1-1.dsc corresponds to HEAD
dpkg-source: varning: extraherar osignerat källkodspaket (/home/jas/dpkg/golang-github-gen2brain-shm/../golang-github-gen2brain-shm_0.2.1-1.dsc)
dpkg-source: info: extraherar golang-github-gen2brain-shm i unpacked
dpkg-source: info: packar upp golang-github-gen2brain-shm_0.2.1.orig.tar.gz
dpkg-source: info: packar upp golang-github-gen2brain-shm_0.2.1-1.debian.tar.xz

dgit: error: HEAD specifies a different tree to golang-github-gen2brain-shm_0.2.1-1.dsc:
dgit:  debian/.gitignore | 8 ++++++++
dgit:  1 file changed, 8 insertions(+)
dgit: Mode change from 000000 to 644: debian/.gitignore
dgit: There is a problem with your source tree (see dgit(7) for some hints).
dgit: For full diff showing the problem(s), type:
dgit:  git diff 54e919be4a120eabfb8986c887b4e0a0f5513958 HEAD
dgit:
! Push failed, while preparing your push.
! You can retry the push, after fixing the problem, if you like.
jas@frallan:~/dpkg/golang-github-gen2brain-shm$

Both files cause similar problems, but I think the reason is somewhat
different:

1) For top-level .gitignore modifications the problem is that this make
the upstream git different from Debian's git view and *.orig.* tarballs.
That's bad, and we fixed that.

2) For debian/.gitignore, the problem is that this results in a
different between the Debian salsa git view of debian/ compared to the
dpkg-source *.debian.tar.* tarball, which is bad for the same reason.

If 908747 would be solved, this wouldn't be a blocker for
dgit/tag2upload.  However I still don't see the value of the file, so we
might as well remove it.

My thinking is that file should be permitted if the maintainer wants to
have it there.

For me, I don't want the file there, because it breaks dgit/tag2upload.

I also never understood why we have that file in the first place.  Does
anyone find it useful?  In which scenario does it do anything uesful?
I've never found it contributing to my workflows, only breaking it.

Since I believe dgit/tag2upload to be(come) common among Go packages,
and I lack any strong justification for debian/.gitignore that motivate
using the old debsign+dput upload method as a workaround, I would like
'dh-make-golang make' to stop adding the file by default.

There could be a -add-git-ignore parameter to use the current behaviour?
If anyone likes the current behaviour, and wants to prohibit use of
dgit/tag2upload.

/Simon

#1130890#20
Date:
2026-03-16 10:26:52 UTC
From:
To:
Hi,

..
...

I rarely make git commits with a dirty build tree, so personally I
don't need this file but also not keen on immediately removing it as
it seems to have been a feature to someone.

tag2upload has potential, but is of limited utility if it does not
store upstream tarball signatures or upstream tag signatures. I am
waiting for these to be fixed before I start using tag2upload:

* #1106071 wanted: tag2upload support for pristine-tar

* #1110269 tag2upload (and dgit?) should deposit upstream tags &
#1106073 dgit should convey upstream git tags to dgit-repos

* #1111331 git-debpush: check if CI passed before tagging

You can just `git rm debian/.gitignore` as the immediate solution or
never commit it into git to begin with. No automation will re-add it.