Hi!

On Mon, 2026-03-16 at 11:39:33 +0000, Jonathan Dowland wrote:
> I've got an interesting problem with dgit. Upstream, I've made a
> change which performed the following operation (in one commit)
> 
> * removed a file (underlays/basewiki/style.css) which was a symlink
>   (to doc/style.css)
> * moved doc/style.css to the path removed in the previous step
> 
> If I cherry-pick this commit over to my debian/dgit branch, write a
> changelog and try "dgit sbuild", it fails:
> 
> > dgit:  cannot represent change: mode or type changed in
> > unsupported way (120000->100644): underlays/basewiki/style.css
> 
> I wondered if bundling the two steps into one commit was the problem.
> (The commit is ugly as a result: no move detected, and the file
> lengths look odd). But performing the steps in separate, serial
> commits provokes the same error.
> 
> Am I holding it wrong?

This seems to be an artificial limitation in dgit. dpkg-source (via
GNU patch) is capable of applying such changes, as long as they are
in git patch format. Although it cannot produce them (currently)
because GNU diff does not support generating git formatted patches.

This seems like a common misconception (even among dgit developers(?)
and users, or at least has been in the past), but perhaps the dgit
error and that GNU diff issue (and by extension «dpkg-source --commit»)
does not help matters, or the dpkg-source documentation is lacking.
Will look into whether the latter can be improved.

(As an example, I'm attaching a couple of patches and series file, to
be placed on top of pci.ids to demonstrate this.)

Thanks,
Guillem
From 2afe5dc6faa7c0a52327ea03fa61603fc249339c Mon Sep 17 00:00:00 2001
From: Guillem Jover <[email protected]>
Date: Mon, 16 Mar 2026 12:52:53 +0100
Subject: [PATCH 1/2] Add symlink

---
 pci.old | 1 +
 1 file changed, 1 insertion(+)
 create mode 120000 pci.old

diff --git a/pci.old b/pci.old
new file mode 120000
index 0000000..5415ba5
--- /dev/null
+++ b/pci.old
@@ -0,0 +1 @@
+pci.ids
\ No newline at end of file
-- 
2.53.0

From 0a7466eb5cc377735acf05a1a3420766834b9285 Mon Sep 17 00:00:00 2001
From: Guillem Jover <[email protected]>
Date: Mon, 16 Mar 2026 12:53:12 +0100
Subject: [PATCH 2/2] Switch symlink to file

---
 pci.old | 1 -
 1 file changed, 1 deletion(-)
 mode change 120000 => 100644 pci.old

diff --git a/pci.old b/pci.old
deleted file mode 120000
index 5415ba5..0000000
--- a/pci.old
+++ /dev/null
@@ -1 +0,0 @@
-pci.ids
\ No newline at end of file
diff --git a/pci.old b/pci.old
new file mode 100644
index 0000000..e69de29
-- 
2.53.0

0001-Add-symlink.patch
0002-Switch-symlink-to-file.patch

Reply via email to