Skip to content

Commit 2822e79

Browse files
ianhitelamonian
andauthored
simplify flow in status
Co-Authored-By: Max Klein <[email protected]>
1 parent 43feaeb commit 2822e79

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

jupyterlab_git/git.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,13 @@ async def status(self, current_path):
258258
line_iterable = iter(strip_and_split(my_output))
259259
for line in line_iterable:
260260
from_path = line[3:]
261-
if line[0]=='R':
262-
#If file was renamed then we need both this line
263-
#and the next line, then we want to move onto the subsequent
264-
#line. We can accomplish this by calling next on the iterable
265-
from_path = next(line_iterable)
266-
result.append({"x": line[0], "y": line[1], "to": line[3:], "from": from_path})
261+
result.append({
262+
"x": line[0],
263+
"y": line[1],
264+
"to": line[3:],
265+
# if file was renamed, next line contains original path
266+
"from": next(line_iterable) if line[0]=='R' else line[3:]
267+
})
267268

268269
return {"code": code, "files": result}
269270

0 commit comments

Comments
 (0)