Skip to content

Commit 27df8f4

Browse files
authored
make empty output fix specific to Git.status method
- making edits through the gihub web UI (don't presently have access to a proper dev env). hopefully no typos
1 parent 2a9006c commit 27df8f4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

jupyterlab_git/git.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,12 @@ def call_subprocess(
101101

102102
return code, output, error
103103

104-
def strip_and_split(s: "str") -> "List[str]":
105-
"""Strip trailing \x00 and split on \x00 a string.
106104

105+
def strip_and_split(s):
106+
"""strip trailing \x00 and split on \x00
107107
Useful for parsing output of git commands with -z flag.
108108
"""
109-
s = s.strip("\x00")
110-
if len(s) > 0:
111-
return s.split("\x00")
112-
else:
113-
return list()
109+
return s.strip("\x00").split("\x00")
114110

115111

116112
class Git:
@@ -260,7 +256,7 @@ async def status(self, current_path):
260256
}
261257

262258
result = []
263-
line_iterable = iter(strip_and_split(my_output))
259+
line_iterable = line_iterable = (line for line in strip_and_split(my_output)) if line)
264260
for line in line_iterable:
265261
result.append({
266262
"x": line[0],

0 commit comments

Comments
 (0)