newren / git-filter-repo

Quickly rewrite git repository history (filter-branch replacement)
Other
8.09k stars 691 forks source link

paths-from-file keeping unrelated files #35

Closed robertocaldas closed 4 years ago

robertocaldas commented 4 years ago

I compiled a list with 568 file names to use with --paths-from-file. After using git filter-repo I ended up with a repo with files that were not on the list.

For example, all the files in the list are under Assets/AL/Common/Scripts/ but now I have files under Assets/AL/LevelDesign/, which should have been stripped out.

This is the command I'm running: git filter-repo --paths-from-file /tmp/git_rewrite_temp/PRESERVE --force --replace-refs delete-no-add

Unfortunately, I can't provide the repo, so it's hard to create a repro. Can you please advise on how to debug? Thank you.

newren commented 4 years ago

I suspect this is a duplicate of #3. If you run with --prune-empty=never, does it get the correct file contents (even if it leaves a lot of ugly empty commits around)?

robertocaldas commented 4 years ago

I believe you are right.

One thing though: running with --prune-empty=never also left an empty unrelated folder. Strangely enough, this folder wasn't there in my previous attempts, using prune empty.

Running twice with pruning on, like they mentioned on #3, seems to fix it.

After running with --prune-empty=never, is there a way to run a second time just to remove the empty commits? It feels like a better option than running the bugged way twice.

By the way, what is considered a "fresh clone"? I'm running filter-repo on repos that I just cloned but it keeps requiring --force.

I cloned filter-repo today, so I'm using latest. I'm not running it on master.

newren commented 4 years ago

I think the changes I just pushed up should fix this issue; could you try the newest version of the master branch and report whether it corrects the problems for you?

robertocaldas commented 4 years ago

It seems to be working with the repo I have and the test one they posted on #3. Thank you! I'll test further after 6/Jan.