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)
| 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() |
nothing calls this directly
no test coverage detected