Skip to content

Commit f59d00c

Browse files
committed
add function to do line splitting with when using -z
1 parent 0cbfa4f commit f59d00c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jupyterlab_git/git.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ class Git:
110110
def __init__(self, contents_manager):
111111
self.contents_manager = contents_manager
112112
self.root_dir = os.path.expanduser(contents_manager.root_dir)
113+
114+
def strip_and_split(self, s):
115+
"""strip trailing \x00 and split on \x00
116+
117+
Useful for parsing output of git commands with -z flag.
118+
"""
119+
return s.strip("\x00").split("\x00")
113120

114121
async def config(self, top_repo_path, **kwargs):
115122
"""Get or set Git options.

0 commit comments

Comments
 (0)