Skip to contentSkip to conversation

builtin-blame: Fix blame -C -C with submodules.

RFC PATCH New Alexander Gavrilov 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 builtin-blame: Fix blame -C -C with submodules.

When performing copy detection, git-blame tries to read gitlinks as blobs, which causes it to die.

This patch adds a check to skip them.

---

	I don't know if this is enough for all cases, but it fixes mine.

	-- Alexander


	$ git blame --incremental -C -C ImpactMessages.cpp
	767f36d1ce2f361e9148bb23155e6aafad034f4b 6 6 10                      
	...
	767f36d1ce2f361e9148bb23155e6aafad034f4b 49 49 7                     
	filename BackEnd/Impact/ImpactMessages.cpp                           
	767f36d1ce2f361e9148bb23155e6aafad034f4b 57 57 1                     
	filename BackEnd/Impact/ImpactMessages.cpp                           
	767f36d1ce2f361e9148bb23155e6aafad034f4b 59 59 14                    
	filename BackEnd/Impact/ImpactMessages.cpp                           
	fatal: Cannot read blob 27152bb4f8b10d4ce5f9fa584c14511dceba3c06 for path BackEnd/Boost
 builtin-blame.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
builtin-blame.c +2 -0
index 9bc901c..101c416 100644
@@ -1136,6 +1136,8 @@ static int find_copy_in_parent(struct scoreboard *sb,
 
 			if (!DIFF_FILE_VALID(p->one))
 				continue; /* does not exist in parent */
+			if (S_ISGITLINK(p->one->mode))
+				continue; /* ignore git links */
 			if (porigin && !strcmp(p->one->path, porigin->path))
 				/* find_move already dealt with this path */
 				continue;
Signature · 1 line
1.6.0.20.g6148bc