diff options
author | Doesnot Matter <you@example.com> | 2022-05-26 12:28:47 +0200 |
---|---|---|
committer | Doesnot Matter <you@example.com> | 2022-05-26 12:29:32 +0200 |
commit | 59bf3a6e709d929a98d5bec97227c5f586f00772 (patch) | |
tree | 19ea27a924f420917ef2ea5ca63d1a07f4096b84 | |
parent | 25327d14f68fdfe4e3c033372878baaf74dea1e5 (diff) |
repository: list_tree: Handle '-'
This is returned for git submodules and broke the the clone test like:
======================================================================
ERROR: Test that cloning from github urls works
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/scratch/src/git-buildpackage/git-buildpackage/tests/component/deb/test_clone.py", line 81, in test_clone_github
ret = clone(['arg0', "github:agx/git-buildpackage", dest])
File "/var/scratch/src/git-buildpackage/git-buildpackage/gbp/scripts/clone.py", line 214, in main
if options.defuse_gitattributes.is_on() or not repo_setup.check_gitattributes(repo, 'HEAD'):
File "/var/scratch/src/git-buildpackage/git-buildpackage/gbp/scripts/common/repo_setup.py", line 43, in check_gitattributes
for mode, _type, sha1, size, path in repo.list_tree(treeish, recurse=True, sizes=True):
File "/var/scratch/src/git-buildpackage/git-buildpackage/gbp/git/repository.py", line 1105, in list_tree
yield mode, type, sha1, int(size), filename
ValueError: invalid literal for int() with base 10: '-'
-------------------- >> begin captured logging << --------------------
gbp: info: Cloning from 'https://github.com/agx/git-buildpackage.git' into '/.../git-buildpackage/gbp_TestClone_730g3vkb/tmp_test_clone_github_i9jrqgmy/cloned_repo'
--------------------- >> end captured logging << ---------------------
-rw-r--r-- | gbp/git/repository.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 176be9bf..01226804 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -1102,6 +1102,8 @@ class GitRepository(object): filename = parts.pop() if sizes: mode, type, sha1, size = (part.decode() for part in parts) + # Git submodules report '-' instead of a size + size = size if size != '-' else 0 yield mode, type, sha1, int(size), filename else: mode, type, sha1 = (part.decode() for part in parts) |