mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-11-07 09:20:29 +00:00
filter-repo: use more versatile commit rename function
Being able to find the new commit hash for either an abbreviated commit hash or a full commit hash is much more useful than only working for a full commit hash. Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
47406a6cc0
commit
6ba30e9b98
@ -2733,8 +2733,10 @@ class RepoFilter(object):
|
||||
if limit and len(self._pending_renames) < limit:
|
||||
return
|
||||
|
||||
def _translate_commit_hash(self, matchobj):
|
||||
old_hash = matchobj.group(1)
|
||||
def _translate_commit_hash(self, matchobj_or_oldhash):
|
||||
old_hash = matchobj_or_oldhash
|
||||
if not isinstance(matchobj_or_oldhash, bytes):
|
||||
old_hash = matchobj_or_oldhash.group(1)
|
||||
orig_len = len(old_hash)
|
||||
new_hash = self._get_rename(old_hash)
|
||||
if new_hash is None:
|
||||
@ -2943,7 +2945,7 @@ class RepoFilter(object):
|
||||
self._commits_no_longer_merges.append((commit.original_id, new_id))
|
||||
|
||||
def callback_metadata(self, extra_items = dict()):
|
||||
return {'commit_rename_func': self._get_rename,
|
||||
return {'commit_rename_func': self._translate_commit_hash,
|
||||
'ancestry_graph': self._graph,
|
||||
'original_ancestry_graph': self._orig_graph,
|
||||
**extra_items}
|
||||
|
Loading…
Reference in New Issue
Block a user