Skip to content

Commit

Permalink
fixup! filter-repo: provide warnings about filterability on subpar fi…
Browse files Browse the repository at this point in the history
…lesystems
  • Loading branch information
newren committed Aug 1, 2024
1 parent 8b1b22c commit 41af644
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions git-filter-repo
Original file line number Diff line number Diff line change
@@ -2987,11 +2987,14 @@ class RepoFilter(object):
abort(_("GIT_DIR must be .git"))

# Check for refname collisions
print("AQUI 1");
if config_settings.get(b'core.ignorecase', b'false') == b'true':
print("AQUI 2");
collisions = collections.defaultdict(list)
for ref in refs:
collisions[ref.lower()].append(ref)
msg = ""
print(collisions)
for ref in collisions:
if len(collisions[ref]) >= 2:
msg += " " + decode(b", ".join(collisions[ref])) + "\n"
@@ -3001,8 +3004,10 @@ class RepoFilter(object):
"filesystem since you have refs that differ in case only:\n"
"%s") % msg)
if config_settings.get(b'core.precomposeunicode', b'false') == b'true':
print("AQUI 3");
import unicodedata # Mac users need to have python-3.8
collisions = collections.defaultdict(list)
print(collisions)
for ref in refs:
strref = decode(ref)
collisions[unicodedata.normalize('NFC', strref)].append(strref)
4 changes: 3 additions & 1 deletion t/t9390-filter-repo.sh
Original file line number Diff line number Diff line change
@@ -1361,7 +1361,7 @@ test_expect_success 'startup sanity checks' '
git config core.precomposeUnicode true &&
git update-ref refs/remotes/origin/lamé refs/heads/master &&
git update-ref refs/remotes/origin/lamé refs/heads/master &&
git config core.ignoreCase true &&
git show-ref &&
test_must_fail git filter-repo --path numbers 2>../err
test_i18ngrep "Cannot rewrite history on a character normalizing" ../err &&
git update-ref -d refs/remotes/origin/lamé &&
@@ -1370,6 +1370,8 @@ test_expect_success 'startup sanity checks' '
)
'

exit 2

test_expect_success 'other startup error cases and requests for help' '
(
# prevent MSYS2 (Git for Windows) from converting the colon to

0 comments on commit 41af644

Please sign in to comment.