filter-repo: consistently use bytestrings for directory names

Signed-off-by: Elijah Newren <newren@gmail.com>
pull/13/head
Elijah Newren 5 years ago
parent e6dd613e3f
commit e333be7b17

@ -2745,7 +2745,7 @@ class RepoFilter(object):
print("[DEBUG] Passed arguments:\n{}".format(self._args))
# Determine basic repository information
target_working_dir = self._args.target or '.'
target_working_dir = self._args.target or b'.'
self._orig_refs = GitUtils.get_refs(target_working_dir)
is_bare = GitUtils.is_repository_bare(target_working_dir)
@ -3525,7 +3525,7 @@ class RepoFilter(object):
return
if self._args.debug:
print("[DEBUG] Migrating refs/remotes/origin/* -> refs/heads/*")
target_working_dir = self._args.target or '.'
target_working_dir = self._args.target or b'.'
p = subprocess.Popen('git update-ref --no-deref --stdin'.split(),
stdin=subprocess.PIPE,
cwd=target_working_dir)
@ -3635,7 +3635,7 @@ class RepoFilter(object):
else: # Must be either an annotated tag, or a ref whose tip was pruned
if not batch_check_process:
cmd = 'git cat-file --batch-check'.split()
target_working_dir = self._args.target or '.'
target_working_dir = self._args.target or b'.'
batch_check_process = subprocess.Popen(cmd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,

@ -158,7 +158,7 @@ test_expect_success 'other error cases' '
mkdir other &&
cd other &&
! python3 -c "import git_filter_repo as fr; fr.GitUtils.get_commit_count(\".\", [\"HEAD\"])" 2>err &&
! python3 -c "import git_filter_repo as fr; fr.GitUtils.get_commit_count(b\".\", [\"HEAD\"])" 2>err &&
test_i18ngrep ". does not appear to be a valid git repository" err
)
'

@ -11,8 +11,8 @@ import git_filter_repo as fr
if len(sys.argv) != 3:
raise SystemExit("Syntax:\n %s SOURCE_REPO TARGET_REPO")
source_repo = sys.argv[1]
target_repo = sys.argv[2]
source_repo = sys.argv[1].encode()
target_repo = sys.argv[2].encode()
total_objects = fr.GitUtils.get_total_objects(source_repo) # blobs+trees
total_commits = fr.GitUtils.get_commit_count(source_repo)

Loading…
Cancel
Save