Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply inverted '--path' filtering after '--path-rename'? #504

Closed
MarkusMit opened this issue Sep 21, 2023 · 3 comments
Closed

Apply inverted '--path' filtering after '--path-rename'? #504

MarkusMit opened this issue Sep 21, 2023 · 3 comments

Comments

@MarkusMit
Copy link

I have a repository like this:

my-repo/
├── folder_a/
├── folder_b/
│   ├── folder_b_1/
│   ├── folder_b_2/
│   └── folder_b_3/
├── folder_c/
...
└── folder_z/

and - as part of a bigger restructuring - I want to change it like this:
folder_b_3 should be moved up to root, and folder folder_b with all its remaining contents should be removed:

my-repo/
├── folder_a/
├── folder_b_3/
├── folder_c/
...
└── folder_z/

I tried to do this with inverted path filtering (--invert-paths), but it seems the --path filtering is always executed before the --path-rename regardless of the order of the commands:

python3 'git-filter-repo' --force --invert-paths              \
            --path-rename 'folder_b/folder_b_3/:folder_b_3/'  \
            --path 'folder_b/' 

So, the current (undesired) result is, that nothing of folder_b survives:

my-repo/
├── folder_a/
├── folder_c/
...
└── folder_z/

Since "ordering issues" are mentioned with (positive) path filtering and renames in the user manual, I thought it should also be considered accordingly with inverted path filtering.

@newren
Copy link
Owner

newren commented Aug 2, 2024

Yeah, sorry, can you split this into two steps?

   python3 'git-filter-repo' --force \
            --path-rename 'folder_b/folder_b_3/:folder_b_3/'
   python3 'git-filter-repo' --invert-paths \
            --path 'folder_b/' 

@MarkusMit
Copy link
Author

Yeah, since this was already some months ago, I already found a solution for it. ;-)

But my main intend was anyway that this behaviour may be worth mentioning in the documentation.

@newren
Copy link
Owner

newren commented Nov 25, 2024

Sorry for taking so long to fix this. I looked at it a time or two in the past and was perplexed. Had a facepalm moment today.

Turns out this did work once upon a time, but was broken by 092d016 (filter-repo: implement --use-base-name, 2019-05-17). Anyway, now fixed by 19b1cb6 (filter-repo: also allow --path-rename arguments before --path arguments, 2024-11-25) which I just pushed.

(Also, to make matters worse, this is a duplicate of #142, meaning multiple people hit this issue.)

@newren newren closed this as completed Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants