mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo: ensure we properly quote a filename
When we invoked the 'ls' command of fast-import, we just passed the filename as-is. That will work for most filenames, but some have to be quoted. Make sure we do so. Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
805ce360fa
commit
5f06c19c55
@ -1311,11 +1311,12 @@ class FastExportFilter(object):
|
|||||||
# buffers filling up so I instead read from it as I go.
|
# buffers filling up so I instead read from it as I go.
|
||||||
for change in commit.file_changes:
|
for change in commit.file_changes:
|
||||||
parent = new_1st_parent or commit.parents[0] # exists due to above checks
|
parent = new_1st_parent or commit.parents[0] # exists due to above checks
|
||||||
self._output.write("ls :{} {}\n".format(parent, change.filename))
|
quoted_filename = PathQuoting.enquote(change.filename)
|
||||||
|
self._output.write("ls :{} {}\n".format(parent, quoted_filename))
|
||||||
self._output.flush()
|
self._output.flush()
|
||||||
parent_version = fi_output.readline().split()
|
parent_version = fi_output.readline().split()
|
||||||
if change.type == 'D':
|
if change.type == 'D':
|
||||||
if parent_version != ['missing', change.filename]:
|
if parent_version != ['missing', quoted_filename]:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
blob_sha = change.blob_id
|
blob_sha = change.blob_id
|
||||||
@ -1323,7 +1324,7 @@ class FastExportFilter(object):
|
|||||||
self._output.write("get-mark :{}\n".format(change.blob_id))
|
self._output.write("get-mark :{}\n".format(change.blob_id))
|
||||||
self._output.flush()
|
self._output.flush()
|
||||||
blob_sha = fi_output.readline().rstrip()
|
blob_sha = fi_output.readline().rstrip()
|
||||||
if parent_version != [change.mode, 'blob', blob_sha, change.filename]:
|
if parent_version != [change.mode, 'blob', blob_sha, quoted_filename]:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user