Why does git assign the same SHA-1
to files with different names and different locations although contents is the same?
100644 43efcd84207788e5289ee23a9ce95d9f43b13d9a 0 dir1/dir1_d2/dir1_d2_f1.txt
100644 43efcd84207788e5289ee23a9ce95d9f43b13d9a 0 test.txt
Show file contents:
$ git cat-file -p 43efcd84207788e5289ee23a9ce95d9f43b13d9a
Line 1
Thanks
Because content is the same!
Git tracks content in blob object.
Paths are resolved by git with tree objects.
You can read Pro Git - Git Internals - Git Objects to know how git store data.