Skip to content

Commit b303cb0

Browse files
thetwojByron
authored andcommitted
Initial stab at fixing diffs involving submodule changes
1 parent 6fd0902 commit b303cb0

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎git/cmd.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868
def handle_process_output(process, stdout_handler, stderr_handler,
6969
finalizer=None, decode_streams=True):
70-
"""Registers for notifications to lean that process output is ready to read, and dispatches lines to
70+
"""Registers for notifications to learn that process output is ready to read, and dispatches lines to
7171
the respective line handlers.
7272
This function returns once the finalizer returns
7373

‎git/diff.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,14 @@ def __init__(self, repo, a_rawpath, b_rawpath, a_blob_id, b_blob_id, a_mode,
278278
if self.b_mode:
279279
self.b_mode = mode_str_to_int(self.b_mode)
280280

281+
# Determine whether this diff references a submodule, if it does then
282+
# we need to overwrite "repo" to the corresponding submodule's repo instead
283+
if repo and a_rawpath:
284+
for submodule in repo.submodules:
285+
if submodule.path == a_rawpath.decode("utf-8"):
286+
repo = submodule.module()
287+
break
288+
281289
if a_blob_id is None or a_blob_id == self.NULL_HEX_SHA:
282290
self.a_blob = None
283291
else:

0 commit comments

Comments
 (0)