summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 88a8b79)
raw | patch | inline | side by side (parent: 88a8b79)
author | Fredrik Kuivinen <freku045@student.liu.se> | |
Fri, 17 Mar 2006 21:49:31 +0000 (22:49 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 17 Mar 2006 22:09:18 +0000 (14:09 -0800) |
Before this patch git-blame <directory> gave non-sensible output. (It
assigned blame to some random file in <directory>) Abort with an error
message instead.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
assigned blame to some random file in <directory>) Abort with an error
message instead.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
blame.c | patch | blob | history |
index 8af4b543000588f352d49e671888b815b5dce55f..9c97aeca451f641ff319fc4bee70a97488e619cd 100644 (file)
--- a/blame.c
+++ b/blame.c
unsigned mode, int stage);
static unsigned char blob_sha1[20];
+static const char* blame_file;
static int get_blob_sha1(struct tree *t, const char *pathname,
unsigned char *sha1)
{
int i;
const char *pathspec[2];
+ blame_file = pathname;
pathspec[0] = pathname;
pathspec[1] = NULL;
memset(blob_sha1, 0, sizeof(blob_sha1));
if (S_ISDIR(mode))
return READ_TREE_RECURSIVE;
+ if (strncmp(blame_file, base, baselen) ||
+ strcmp(blame_file + baselen, pathname))
+ return -1;
+
memcpy(blob_sha1, sha1, 20);
return -1;
}