Skip to content

Commit 04178a7

Browse files
nix/lib: drop a patch with no hunks in a source subset
filterdiff leaves only the mail header of a util/-only patch in the module's source, and patch rejects it ("Only garbage was found in the patch input"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 105faa5 commit 04178a7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎nix/lib/default.nix‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ let
4444
name = "homa-src-${name}";
4545
src = lib.fileset.toSource { inherit root fileset; };
4646
patches = map (patchFor dirs) patches;
47+
# A patch with nothing inside this subset (a util/-only fix in the module's source) has
48+
# no hunks left after filterdiff, only its mail header, and patch rejects it: drop it.
49+
prePatch = ''
50+
kept=""
51+
for p in $patches; do
52+
if grep -q '^@@ ' "$p"; then kept="$kept $p"; fi
53+
done
54+
patches=$kept
55+
'';
4756
};
4857
# A directory without its Markdown files: no build reads them.
4958
dirNoDocs = d: lib.fileset.difference (root + "/${d}")

0 commit comments

Comments
 (0)