]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Show full path on diffs
authorŁukasz Langa <lukasz@langa.pl>
Mon, 23 Apr 2018 19:00:03 +0000 (12:00 -0700)
committerŁukasz Langa <lukasz@langa.pl>
Mon, 23 Apr 2018 19:00:03 +0000 (12:00 -0700)
Fixes #130

README.md
black.py
tests/test_black.py

index 2d10a86f6090164edb702979f8aa0fa7c0aa9b39..9685172d7bf29fba584701b1a0bae670def97278 100644 (file)
--- a/README.md
+++ b/README.md
@@ -518,6 +518,8 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md).
 * generalized star expression handling, including double stars; this
   fixes multiplication making expressions "unsafe" for trailing commas (#132)
 
 * generalized star expression handling, including double stars; this
   fixes multiplication making expressions "unsafe" for trailing commas (#132)
 
+* fixed `--diff` not showing entire path (#130)
+
 * fixed parsing of complex expressions after star and double stars in
   function parameters (#2)
 
 * fixed parsing of complex expressions after star and double stars in
   function parameters (#2)
 
index dd2e2d19d8c8f52b7ced373e161b7ee7f9760dd2..eafc9e7be9251abaaee8fbef9b024e243b02a15c 100644 (file)
--- a/black.py
+++ b/black.py
@@ -341,8 +341,8 @@ def format_file_in_place(
         with open(src, "w", encoding=src_buffer.encoding) as f:
             f.write(dst_contents)
     elif write_back == write_back.DIFF:
         with open(src, "w", encoding=src_buffer.encoding) as f:
             f.write(dst_contents)
     elif write_back == write_back.DIFF:
-        src_name = f"{src.name}  (original)"
-        dst_name = f"{src.name}  (formatted)"
+        src_name = f"{src}  (original)"
+        dst_name = f"{src}  (formatted)"
         diff_contents = diff(src_contents, dst_contents, src_name, dst_name)
         if lock:
             lock.acquire()
         diff_contents = diff(src_contents, dst_contents, src_name, dst_name)
         if lock:
             lock.acquire()
index ba834c5cac8fa6d15ebca2a4e6be9c13ee3374fd..6f0ffa364ac749e770e67549ee6e4420bfc8e739 100644 (file)
@@ -200,7 +200,7 @@ class BlackTestCase(unittest.TestCase):
             self.assertTrue(ff(tmp_file, write_back=black.WriteBack.DIFF))
             sys.stdout.seek(0)
             actual = sys.stdout.read()
             self.assertTrue(ff(tmp_file, write_back=black.WriteBack.DIFF))
             sys.stdout.seek(0)
             actual = sys.stdout.read()
-            actual = actual.replace(tmp_file.name, "<stdin>")
+            actual = actual.replace(str(tmp_file), "<stdin>")
         finally:
             sys.stdout = hold_stdout
             os.unlink(tmp_file)
         finally:
             sys.stdout = hold_stdout
             os.unlink(tmp_file)