Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-08-31 20:03:50 +0300
committerJunio C Hamano <gitster@pobox.com>2016-08-31 20:03:50 +0300
commit4762bf36d9d4190dd7afdbc9ccc8bd8bc5af40f8 (patch)
tree99d9b401dbb6f5e27982ed9356a2820b84830bc3 /builtin/blame.c
parent9010077be2de8be28bfa6eebd6de723236324477 (diff)
parentbc6b13a7d2300e982dd3a3aeef2f3ad4d39cf149 (diff)
Merge branch 'mh/blame-worktree'
* mh/blame-worktree: blame: fix segfault on untracked files
Diffstat (limited to 'builtin/blame.c')
-rw-r--r--builtin/blame.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index 7ec7823430..a5bbf91e49 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2244,7 +2244,8 @@ static void verify_working_tree_path(struct commit *work_tree, const char *path)
pos = cache_name_pos(path, strlen(path));
if (pos >= 0)
; /* path is in the index */
- else if (!strcmp(active_cache[-1 - pos]->name, path))
+ else if (-1 - pos < active_nr &&
+ !strcmp(active_cache[-1 - pos]->name, path))
; /* path is in the index, unmerged */
else
die("no such path '%s' in HEAD", path);