#1124384 git-deborig needs to use $negate_harmful_gitattrs

#1124384#5
Date:
2025-12-31 13:07:30 UTC
From:
To:
git-deborig defuses `export-subst` and `export-ignore`, no doubt
because those are the only ones mentioned in git-archive(1).

But many other transforming gitattributes do affect the output,
including eol etc.  git-deborig should use $negate_harmful_gitattrs,
(or dgit setup-new-tree in a playtree).  That variable is the one
place in our codebase that knows the names of all these attributes,
and it is covered by our tests.

This should be changed only when git-deborig can no longer leave the
user's tree with gitattributes unexpectedly permanently defused,
because otherwise fixing *this* bug is a regression to *that* bug.

Ian.

#1124384#10
Date:
2025-12-31 17:01:18 UTC
From:
To:
The more serious of these two bugs

  #1124383  git-deborig can capriciously leave gitattributes defused

has been significantly mitiigated bu 42684a225d21 (commit messabe
below).  I want to represent the various behaviours in the BTS, so I'm
cloning it, so that the fixed/found and done states can be different.

The new bug "git-deborig can leave working tree dirty" is in dgit 14.0
only, and replaces the more serious #1124383 (which is present in
13.20 and has existed in git-deborig since before it arrived in
src:dgit).


Both #1124383 and

  #1124384   git-deborig needs to use $negate_harmful_gitattrs

can be fully fixed by the folowing set of code changes:

 * Arrange for git-deborig to use a playtree;

 * Partially revert 42684a225d21, fishing out the .git/info/attributes
   writing code (minus the save/restore) and use it in the playtree;

 * Make the .git/info/attributes content use $negate_harmful_gitattrs
   rather than open-coding some gitattributes to suppress.

Ian.

  42684a225d210c558cb642b5fd6aae298b96a5d2

  git-deborig: Defuse all harmful gitattributes, by editing the working tree

  This relates to thse bugs:
    #1111548  tag2upload service makes .origs with un-defused gitattributes
    #1124383  git-deborig can capriciously leave gitattributes defused
    #1124384  git-deborig needs to use $negate_harmful_gitattrs

  The problem in tag2upload (#1111548) is because git-debpush replaces the
  .git/info/attributes file installed by tag2upload's dgit setup-gitattributes
  with one which doesn't defuse *all* the attributes (#1124384).

  Ideally we'd use a playtree (#1124383) but that's a bigger job than I have
  time for now.  Instead, we can take a different approach:

   - Remove the working tree's copy of .gitattributes
   - Use git-archive --worktree-attributes
   - Put the working tree's .gitattributes back later

  I think removing .gitattributes ought to completely neuter existing
  gitattributes transformations (at least on Unix).

  So this fixes tag2upload (#1111548); greatly mitigates the corrupted config
  hazard (#1124383) by turning it into a much more visible damaged working tree
  hazard; and sidesteps for now the need for a full attribute list (#1124384).

  Closes: #1111548
  Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>