Re: renormalize histroy with smudge/clean-filter, again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx
>





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux