Skip to content

Commit

Permalink
filter-repo: provide a changed-refs metadata file as well
Browse files Browse the repository at this point in the history
For sensitive data removals, quickly determining which refs were changed
may be helpful (e.g. to see how many pull-requests/merge-requests/
change-reviews/whatever-you-want-to-call-it refs were modified).

Signed-off-by: Elijah Newren <newren@gmail.com>
  • Loading branch information
newren committed Nov 22, 2024
1 parent 8248947 commit 203894b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Documentation/git-filter-repo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,18 @@ references were (or were not) changed.
* An all-zeros hash, or null SHA, represents a non-existent object.
When in the "new" column, this means the ref was removed entirely.

Changed References
~~~~~~~~~~~~~~~~~~

The `$GIT_DIR/filter-repo/changed-refs` file contains a list of refs that
were changed.

* No header is provided
* Lists the subsets of refs from ref-map for which old != new
* While unnecessary since this provides no new information over ref-map,
it does make it easier to quickly determine which refs were changed by
the rewrite.

First Changed Commits
~~~~~~~~~~~~~~~~~~~~~

Expand Down
4 changes: 4 additions & 0 deletions git-filter-repo
Original file line number Diff line number Diff line change
Expand Up @@ -4791,6 +4791,10 @@ class RepoFilter(object):
if old_hash != new_hash:
self._changed_refs.add(refname)

with open(os.path.join(metadata_dir, b'changed-refs'), 'bw') as f:
for refname in sorted(self._changed_refs):
f.write(b'%s\n' % refname)

with open(os.path.join(metadata_dir, b'first-changed-commits'), 'bw') as f:
for commit, undeleted_self_or_ancestor in sorted(first_changes.items()):
f.write(b'%s %s\n' % (commit, undeleted_self_or_ancestor))
Expand Down

0 comments on commit 203894b

Please sign in to comment.