Kentzo / git-archive-all

A python script wrapper for git-archive that archives a git superproject and its submodules, if it has any. Takes into account .gitattributes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No such file or directory crash due to erroneously duplicated path segment in submodule

rubenwardy opened this issue · comments

The module duplicates the "display_api" in /tmp/test/mesecons_lab/mods/display_modpack/display_api/display_api/API.md, despite there being no such subfolder.

From command line

git clone --recursive https://github.com/BuckarooBanzay/mesecons_lab
git-archive-all -C mesecons_lab --force-submodules out.zip
[Errno 2] No such file or directory: '/tmp/test/mesecons_lab/mods/display_modpack/display_api/display_api/API.md'

as a library

  File "/home/cdb/app/tasks/importtasks.py", line 304, in makeVCSRelease
    archiver.create(destPath)
  File "/usr/local/lib/python3.6/site-packages/git_archive_all.py", line 260, in create
    self.archive_all_files(archiver)
  File "/usr/local/lib/python3.6/site-packages/git_archive_all.py", line 307, in archive_all_files
    archiver(path.join(self.main_repo_abspath, file_path), path.join(self.prefix, file_path))
  File "/usr/local/lib/python3.6/site-packages/git_archive_all.py", line 253, in archiver
    add_file(file_path, arcname)
  File "/usr/local/lib/python3.6/site-packages/git_archive_all.py", line 227, in add_file
    archive.write(file_path, arcname, ZIP_DEFLATED)
  File "/usr/local/lib/python3.6/zipfile.py", line 1617, in write
    zinfo = ZipInfo.from_file(filename, arcname)
  File "/usr/local/lib/python3.6/zipfile.py", line 507, in from_file
    st = os.stat(filename)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/test/mesecons_lab/mods/display_modpack/display_api/display_api/API.md'

/re minetest/contentdb#245

I have a feeling this is due to this incorrect .gitmodules config in display_modpack: https://github.com/pyrollo/display_modpack/blob/6135b3a60c4adb270b1a3a05b8d3449ecfa68148/.gitmodules
(display_api is both a folder and a submodule here)

It might be incorrect, but if git handles it without failure so should git-archive-all.

Please try the issue-85 branch, I hope I got quoting right.

Hi, I can confirm that this branch fixes the problem in my code. Thanks!

Hi, This fix also worked for me!

Thank you for the work

Time to get it merged then.

How long does it take for a new version to be available on PIP?