MCPcopy
hub / github.com/jisaacks/GitGutter / _run_diff

Method _run_diff

modules/handler.py:372–401  ·  view source on GitHub ↗

Call git diff and return the decoded unified diff string. Arguments: updated_git_file (bool): Is True if the file was updated from git database since last call. Returns: tuple: (first_line, last_line, [inserted], [modified], [deleted])

(self, updated_git_file)

Source from the content-addressed store, hash-verified

370 return self.update_git_file().then(self._run_diff)
371
372 def _run_diff(self, updated_git_file):
373 """Call git diff and return the decoded unified diff string.
374
375 Arguments:
376 updated_git_file (bool): Is True if the file was updated
377 from git database since last call.
378 Returns:
379 tuple: (first_line, last_line, [inserted], [modified], [deleted])
380 The processed result of git diff with the information about
381 the modifications of the file.
382 None: Returns None if nothing has changed since last call.
383 """
384 updated_view_file = self.view_cache.update()
385 if not updated_git_file and not updated_view_file:
386 return self.process_diff(self._git_diff_cache)
387
388 if not self._git_temp_file:
389 return self.process_diff(self._git_diff_cache)
390
391 return self.execute_async(list(filter(None, (
392 self._git_binary,
393 '-c', 'core.autocrlf=input',
394 '-c', 'core.eol=lf',
395 '-c', 'core.safecrlf=false',
396 'diff', '-U0', '--no-color', '--no-index',
397 self.settings.ignore_whitespace,
398 self.settings.diff_algorithm,
399 self.translate_path_to_wsl(self._git_temp_file.name),
400 self.translate_path_to_wsl(self.view_cache.name)
401 ))), decode=False).then(self._decode_diff)
402
403 def _decode_diff(self, results):
404 encoding = self.view_cache.python_friendly_encoding()

Callers

nothing calls this directly

Calls 5

process_diffMethod · 0.95
execute_asyncMethod · 0.95
translate_path_to_wslMethod · 0.95
thenMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected