diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-11-08 01:41:22 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-11-08 01:42:26 +0100 |
commit | 24a169536bf6708bb18fa907fcc0157615665633 (patch) | |
tree | a6b950f8503aca8312f1c8faac972922f0344c2d | |
parent | c9dc0ecdcbb86e88954aa311f13c85160ed31cbe (diff) | |
download | vendor_replicant-scripts-24a169536bf6708bb18fa907fcc0157615665633.tar.gz vendor_replicant-scripts-24a169536bf6708bb18fa907fcc0157615665633.tar.bz2 vendor_replicant-scripts-24a169536bf6708bb18fa907fcc0157615665633.zip |
replicant_prepare_patch.py: fix crash when not using -C
Without that fix we have:
$ ./patches/replicant_prepare_patch.py HEAD 1
Traceback (most recent call last):
File "./patches/replicant_prepare_patch.py", line 231, in <module>
repo = GitRepo(config, directory)
File "./patches/replicant_prepare_patch.py", line 97, in __init__
self.directory = re.sub('/+$', '', directory)
File "/usr/lib/python3.8/re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rwxr-xr-x | patches/replicant_prepare_patch.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/patches/replicant_prepare_patch.py b/patches/replicant_prepare_patch.py index 57f8d6c..c1f52e7 100755 --- a/patches/replicant_prepare_patch.py +++ b/patches/replicant_prepare_patch.py @@ -94,8 +94,10 @@ def get_config(): class GitRepo(object): def __init__(self, config, directory): self.config = config - self.directory = re.sub('/+$', '', directory) - if self.directory: + self.directory = None + + if directory: + self.directory = re.sub('/+$', '', directory) self.git = sh.git.bake("-C", self.directory) else: self.git = sh.git.bake() |