git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Calum McConnell <calumlikesapplepie@gmail.com>
To: git@vger.kernel.org
Cc: Calum McConnell <calumlikesapplepie@gmail.com>
Subject: [PATCH 3/3] Document the new gitattributes change
Date: Mon,  6 Sep 2021 14:10:02 -0400	[thread overview]
Message-ID: <20210906181002.625647-3-calumlikesapplepie@gmail.com> (raw)
In-Reply-To: <20210906181002.625647-1-calumlikesapplepie@gmail.com>

The warning I included might make this feature hard-to-use: but
people are clever, and there are ways around it, which also
grant other useful properties to smudge- and clean- filters.

For instance, if you add at the beginning of each file you filter,
you add GITTATTRIBUTES_FILTERED_VERSION_1, that grants the "no
double clean" property and allows for versioning of the script.

To do this perfectly, you'd want to let the user declare the
script file, and then have git figure out what version of it
to run.  But that would take an understanding of the conversion
code which I lack, and would also be a lot of a work for a
little-used addition to an underused feature.

Signed-off-by: Calum McConnell <calumlikesapplepie@gmail.com>
---
 Documentation/gitattributes.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 83fd4e19a4..33b0087d4f 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -486,6 +486,19 @@ not exist, or may have different contents. So, smudge and clean commands
 should not try to access the file on disk, but only act as filters on the
 content provided to them on standard input.
 
+Sequence "%w" on the filter command line is replaced with the absolute path
+to the root of the repository working tree.  This is useful if you have
+complex scripts specific to your project.  Note that these scripts should
+be mostly static for the life of the project, since the script version that 
+is run may significantly predate or follow the version of the file being
+processed
+
+------------------------
+[filter "unzip-file"]
+	clean = %w/scripts/filter-unzip-clean
+	smudge = %w/scripts/filter-unzip-smudge
+------------------------
+
 Long Running Filter Process
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-- 
2.30.2


  parent reply	other threads:[~2021-09-06 18:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-06 18:10 [PATCH 1/3] Add support for new %w wildcard in checkout filter Calum McConnell
2021-09-06 18:10 ` [PATCH 2/3] Die if filter is attempted without a worktree Calum McConnell
2021-09-06 22:09   ` Ævar Arnfjörð Bjarmason
2021-09-07 14:56     ` Calum McConnell
2021-09-07  8:18   ` Bagas Sanjaya
2021-09-06 18:10 ` Calum McConnell [this message]
2021-09-07 16:33 ` [PATCH 1/3] Add support for new %w wildcard in checkout filter Jeff King
2021-09-07 20:28 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210906181002.625647-3-calumlikesapplepie@gmail.com \
    --to=calumlikesapplepie@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).