Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

diff for deleted file only, when changed to directory

From: Bert Wesarg <hidden>
Date: 2016-06-15 22:50:12

Hi,

when I stage a file deletion (named foo) and than add a new file
(named foo/bar) in a directory with  the name of deleted file. git
diff --cached -- foo shows me the diff for both the file foo and file
foo/bar.

Here is a recipe:

echo foo >f
git add f
git commit -mfoo
git rm f
mkdir f
echo bar >f/0
git add f/0
git diff -- f
git diff --cached -- f

gives me this:
diff --git c/f i/f
deleted file mode 100644
index 257cc56..0000000
--- c/f
+++ /dev/null
@@ -1 +0,0 @@
-foo
diff --git c/f/0 i/f/0
new file mode 100644
index 0000000..5716ca5
--- /dev/null
+++ i/f/0
@@ -0,0 +1 @@
+bar
For the other case, when I stage a symlink under the name foo, I can
understand that git diff shows me two diffs. But for the case
file->directory, I would like to see only the deleted diff, not
recursing into the directory.

Bert
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help