git-ftp
git-ftp copied to clipboard
FTP upload fails on submodules with bare proxy setup
Tried to upload, got this error;
remote: Traceback (most recent call last):
remote: File "_/git-ftp.py", line 357, in
Something new here? Have the same problem ...
Yeah, this is a case of "No one has written the functionality for this" yet.
The submodules are not really stored in the bare repository, so you would need to also work with bare repository of the submodule itself and then upload it.
For me the script would not continue. Given exception:
Traceback (most recent call last):
File "/usr/bin/git-ftp", line 489, in <module>
main()
File "/usr/bin/git-ftp", line 178, in main
upload_diff(repo, oldtree, tree, ftp, [base], patterns)
File "/usr/bin/git-ftp", line 417, in upload_diff
module = node.module()
File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/util.py", line 52, in wrapper
raise InvalidGitRepositoryError("Method '%s' cannot operate on bare repositories" % func.__name__)
git.exc.InvalidGitRepositoryError: Method 'module' cannot operate on bare repositories
I added after line 57
57: from git import Blob, Repo, Git, Submodule
58: from git.exc import InvalidGitRepositoryError
Around the codeblock on 417 i placed a try exception like
try:
module = node.module()
module_tree = module.commit(node.hexsha).tree
if status == "A":
module_oldtree = get_empty_tree(module)
else:
oldnode = oldtree[file]
assert isinstance(oldnode, Submodule) # TODO: What if not?
module_oldtree = module.commit(oldnode.hexsha).tree
module_base = base + [node.path]
logging.info('Entering submodule %s', node.path)
ftp.cwd(posixpath.join(*module_base))
upload_diff(module, module_oldtree, module_tree, ftp, module_base, ignored)
logging.info('Leaving submodule %s', node.path)
ftp.cwd(posixpath.join(*base))
except InvalidGitRepositoryError:
print "Skipping submodule"
I know it's a nasty workaround but it will do for me. If someone wants a patch u can drop me a line.