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

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

 



Since none of the methods using plain git worked, my next try was to reach out
to git-filter-repo:

Again, using my renormalize-helper script:

  $ cat renormalize-helper
  #! /bin/sh -e
  
  git add --renormalize .
  git diff --quiet --cached || \
      git commit --amend --no-edit

So I go with git-filter-repo:
 
   $ git clone ssh://gitrepos@my.server/repo fresh-clone
   $ cd fresh-clone

   $ git-filter-repo \
       --prune-empty always \
       --invert-paths --use-base-name \
       --path-regex '\.ets5hash$'

   $ for branch in branch-1 branch-2 branch-3 ; do
        git checkout -b $branch-renormalized $branch
   
        git add --renormalize .
        git diff --quiet --cached || \
             git commit -m"Renormalize HEAD"
   
        git rebase \
             --root -X renormalize \
             -x $renormalize_helper
     done

This went without problem and contents looked fine, so I really thought I got
it finally.

But then I tried to move .gitattributes to the very beginnig of history:

   $ git rebase -i --root

AGAIN conflicts due to line ending errors. Adding
'--attr-source=$(git rev-parse HEAD)' and '-x renormalize-helper' did not
help beside moving the conflicts to another location.

Thus, although the renormalization process finished successfully, there are
_still_ commits with unclean content in the repository.

I REALLY REALLY REALLY think there should be an option

--always-apply-clean-filter-to-all-content-before-feeding-to-merge-or-diff

or something!



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)
> 
> - 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
> 
> 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.
> 
> So I check all revisions in the history. Resut: no revision has CRLF.
> 
> So the renormalization process does not work for me at all.
> 
> Any ideas?
> 
> -- 
> Josef Wolf
> jw@xxxxxxxxxxxxx
> 
> 

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