git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: Josef Wolf <jw@raven.inka.de>, git@vger.kernel.org
Subject: Re: renormalize histroy with smudge/clean-filter, again
Date: Wed, 12 Feb 2025 07:12:36 +0100	[thread overview]
Message-ID: <20250212061236.GA990@tb-raspi4> (raw)
In-Reply-To: <20250211235707.GQ30202@raven.inka.de>

On Wed, Feb 12, 2025 at 12:57:07AM +0100, Josef Wolf wrote:
> Still struggling with my filter problem.
>
> Here is what I do:
>
> - Set up a clean filter which enforces CRLF (yes, for this specific use
>   case I want CRLF even on linux)

In general, clean filters do their work when 'git add' or 'git commit file'
is run.
Does the filter do the CRLF conversion ?
Or is it done in .gitattributes ?

>
> - Smudge filter does not modify the file at all
>
> - Set up git to fail when filter fails, so I can double-check that the
>   filter is actually runnning:
>
>    $ grep -A3 filter..etsfile ~/.gitconfig
>    [filter "etsfile"]
>       required = true
>       clean = ets-utils -c
>       smudge = ets-utils -s %f
>
> - Specify file as non-text and install the filter:
>
>     $ grep etsfile .gitattributes
>     */P -text filter=etsfile
>     $ git commit .gitattributes
>
> - Check that git gets attributes as I want them:
>
>     $ git --attr-source=$(git rev-parse HEAD) check-attr -a P-0113/P
>     P-0113/P: text: unset
>     P-0113/P: filter: etsfile
>     $ git ls-files --eol P-0113/P
>     i/lf    w/      attr/-text              P-0113/P
>
> - Create helper for renormalization
>
>     $ cat renormalization-helper
>     #! /bin/sh -e
>     git add --renormalize .
>     git diff --quiet --cached || \
>         git commit --amend --no-edit
>
> - Run the renormalization for the linear history:
>
>     $ git --attr-source=$(git rev-parse HEAD) \
>          rebase --root -X renormalize \
>          -x $(dirname $0)/renormalize-helper

That will change the index, the repo, but not the working tree on disk,
right ?

>
> So at this point, I'd expect the falie to have CRLF line endings. But it
> doesn't, so I do:
>
>     $ rm -rf P-0113
>     git checkout  --attr-source=$(git rev-parse HEAD) P-0113
>
> Still no CRLF, so I look at what is stored by git:
>
>     $ git --attr-source=$(git rev-parse HEAD) show 873a9b:P-0113/P |less -U
>
> Again, no CRLF.

Just to make sure:
You want to see the CRLF in the files on disk ?
Do you have a valid .gitattributes file on disk now ?
If yes, what does 'git ls-files --eol P-0113' say ?
What does 'git status' say ?

>
> So I check all revisions in the history. Resut: no revision has CRLF.
> So the renormalization process does not work for me at all.

In general, renormalization is about the content inside the repo.
If a filter is applied, or .gitattributes are changed, the files
on disk are not updated automatically.
'mv -f P-0113 /tmp && git checkout P-0113' may be needed.

>
> Any ideas?

Yes. The best thing to do (tm) would be to create a dummy repo,
do all all the operations from scratch and post the stuff here.
In other words, write a shell script that creates an empty repo,
fills it with content, and does all the operations.
That would enable people to reproduce it and look what is going on.
Hope that make sense.

>
> --
> Josef Wolf
> jw@raven.inka.de
>

  reply	other threads:[~2025-02-12  6:17 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 21:47 renormalize histroy with smudge/clean-filter Josef Wolf
2025-02-05 22:55 ` brian m. carlson
2025-02-05 23:59   ` Josef Wolf
2025-02-06  0:29     ` brian m. carlson
2025-02-06  8:07       ` Elijah Newren
2025-02-06 13:40         ` Josef Wolf
2025-02-06 20:04           ` Josef Wolf
2025-02-07  6:10             ` Chris Torek
2025-02-07 10:45               ` Josef Wolf
2025-02-07 11:06                 ` Torsten Bögershausen
2025-02-07 11:12                 ` Chris Torek
2025-02-07 11:17                   ` Chris Torek
2025-02-07 14:01                   ` Elijah Newren
2025-02-07 20:32                     ` Josef Wolf
2025-02-08  0:23                       ` Elijah Newren
2025-02-08 11:14                         ` Phillip Wood
2025-02-08 21:08                           ` Josef Wolf
2025-02-08 21:43                           ` Elijah Newren
2025-02-08 23:26                             ` Josef Wolf
2025-02-09  2:33                               ` D. Ben Knoble
2025-02-09  8:53                                 ` Josef Wolf
2025-02-09  7:21                               ` Elijah Newren
2025-02-09  8:57                                 ` Josef Wolf
2025-02-10 17:51                                   ` D. Ben Knoble
2025-02-08 20:57                         ` Josef Wolf
2025-02-08 21:56                           ` Elijah Newren
2025-02-09  9:25                           ` Josef Wolf
2025-02-09 11:14                             ` Torsten Bögershausen
2025-02-09 15:09                               ` Josef Wolf
2025-02-09 17:54                                 ` Josef Wolf
2025-02-09 18:01                                   ` Josef Wolf
2025-02-07 20:21                   ` Josef Wolf
2025-02-07 15:39                 ` Junio C Hamano
2025-02-06 10:13     ` Phillip Wood
2025-02-06  7:55   ` Elijah Newren
2025-02-06 19:00     ` Junio C Hamano
2025-02-11 23:57 ` renormalize histroy with smudge/clean-filter, again Josef Wolf
2025-02-12  6:12   ` Torsten Bögershausen [this message]
2025-02-12  8:18     ` Josef Wolf
2025-02-13 11:36   ` Collisions while cloning (was: Re: renormalize histroy with smudge/clean-filter, again) Josef Wolf
2025-02-13 16:40     ` Torsten Bögershausen
2025-02-14 20:03   ` renormalize histroy with smudge/clean-filter, again Josef Wolf
2025-02-14 20:21   ` brian m. carlson
2025-02-14 20:55     ` Josef Wolf

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=20250212061236.GA990@tb-raspi4 \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.org \
    --cc=jw@raven.inka.de \
    /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).