2013-03-18 78 views
0

該行取自一個包含2852個文件更改(切換多個庫)的原始差異。Git diff文件名破解一致性

diff --git "a/system/cms/config/database.php\n" "b/system/cms/config/database.php\n" 

超出了所有2852度文件的變化,這是它的文件名用引號括起來,並用「\ n」終止的唯一差異。其他每條相關線都適合這種模式。

diff --git a/system/cms/config/constants.php b/system/cms/config/constants.php 

任何想法爲什麼會發生這種情況?

回答

5

發生這種情況的原因是您實際上有一個文件名,其末尾包含\n

$ git init 
Initialized empty Git repository in /home/foo/tmp/.git/ 
$ echo foo > a$'\n' 
$ git add a* 
$ git commit -m one 
[master (root-commit) 2ce40fd] one 
1 file changed, 1 insertion(+) 
create mode 100644 "a\n" 
$ echo bar >> a* 
$ git diff|less 
diff --git "a/a\n" "b/a\n" 
index 257cc56..3bd1f0e 100644 
--- "a/a\n" 
+++ "b/a\n" 
@@ -1 +1,2 @@ 
foo 
+bar