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

assert(usoa == intermediate) could fail in subsequent filter-repo runs #618

Open
louiswpf opened this issue Dec 11, 2024 · 0 comments
Open

Comments

@louiswpf
Copy link

louiswpf commented Dec 11, 2024

assert(usoa == intermediate) could fail in subsequent filter-repo runs.
This is caused by the metadata stored in $GIT_DIR/filter-repo.

Here is a reproducer:

  • test.sh
#!/bin/sh -ex

git init -q repo
cd repo
touch file
git add file
git commit -q -m 'Initial commit'
orig_commit_id="$(git rev-parse HEAD)"
git filter-repo --quiet --to-subdirectory-filter dir0 --force --partial
git reset -q "${orig_commit_id}"
git filter-repo --quiet --to-subdirectory-filter dir1
git filter-repo --quiet --to-subdirectory-filter dir1
$ ./test.sh
+ git init -q repo
+ cd repo
+ touch file
+ git add file
+ git commit -q -m 'Initial commit'
++ git rev-parse HEAD
+ orig_commit_id=3bf1e5885e1dba5a890a91e1e3a3036c9f7fa867
+ git filter-repo --quiet --to-subdirectory-filter dir0 --force --partial
New history written in 0.01 seconds...
Completely finished after 0.02 seconds.
+ git reset -q 3bf1e5885e1dba5a890a91e1e3a3036c9f7fa867
+ git filter-repo --quiet --to-subdirectory-filter dir1
New history written in 0.01 seconds; now repacking/cleaning...
Completely finished after 0.04 seconds.
+ git filter-repo --quiet --to-subdirectory-filter dir1
New history written in 0.01 seconds; now repacking/cleaning...
Traceback (most recent call last):
  File "/usr/bin/git-filter-repo", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/git_filter_repo.py", line 4973, in main
    filter.run()
  File "/usr/lib/python3.12/site-packages/git_filter_repo.py", line 4936, in run
    self._record_metadata(self.results_tmp_dir(), self._orig_refs)
  File "/usr/lib/python3.12/site-packages/git_filter_repo.py", line 4767, in _record_metadata
    self._compute_metadata(metadata_dir, orig_refs)
  File "/usr/lib/python3.12/site-packages/git_filter_repo.py", line 4712, in _compute_metadata
    assert(usoa == intermediate) # old wasn't pruned => usoa == intermediate
           ^^^^^^^^^^^^^^^^^^^^
AssertionError
@louiswpf louiswpf changed the title "assert(usoa == intermediate)" could fail in subsequent filter-repo runs assert(usoa == intermediate) could fail in subsequent filter-repo runs Dec 11, 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

1 participant