summaryrefslogtreecommitdiff
path: root/builtin-blame.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-06-03 00:49:40 -0700
committerJunio C Hamano <gitster@pobox.com>2009-06-03 00:49:40 -0700
commit433e972aeb5e485d2f7a7ac605a1c043822e25d9 (patch)
tree53d39fd7fdbd01c870d08937e805849dd4d6c404 /builtin-blame.c
parenta5adcbe377de7c8f5d794fce1fe2b23a0bddf758 (diff)
parenta9b2d42486ee0b461220bf3895114926d9ddf9be (diff)
downloadgit-433e972aeb5e485d2f7a7ac605a1c043822e25d9.tar.gz
Merge branch 'maint'
* maint: blame: correctly handle a path that used to be a directory add -i: do not dump patch during application Update draft release notes for 1.6.3.2 grep: fix colouring of matches with zero length Documentation: teach stash/pop workflow instead of stash/apply Change xdl_merge to generate output even for null merges t6023: merge-file fails to output anything for a degenerate merge
Diffstat (limited to 'builtin-blame.c')
-rw-r--r--builtin-blame.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/builtin-blame.c b/builtin-blame.c
index 9dc3335910..0c2d29a430 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -362,18 +362,28 @@ static struct origin *find_origin(struct scoreboard *sb,
"", &diff_opts);
diffcore_std(&diff_opts);
- /* It is either one entry that says "modified", or "created",
- * or nothing.
- */
if (!diff_queued_diff.nr) {
/* The path is the same as parent */
porigin = get_origin(sb, parent, origin->path);
hashcpy(porigin->blob_sha1, origin->blob_sha1);
- }
- else if (diff_queued_diff.nr != 1)
- die("internal error in blame::find_origin");
- else {
- struct diff_filepair *p = diff_queued_diff.queue[0];
+ } else {
+ /*
+ * Since origin->path is a pathspec, if the parent
+ * commit had it as a directory, we will see a whole
+ * bunch of deletion of files in the directory that we
+ * do not care about.
+ */
+ int i;
+ struct diff_filepair *p = NULL;
+ for (i = 0; i < diff_queued_diff.nr; i++) {
+ const char *name;
+ p = diff_queued_diff.queue[i];
+ name = p->one->path ? p->one->path : p->two->path;
+ if (!strcmp(name, origin->path))
+ break;
+ }
+ if (!p)
+ die("internal error in blame::find_origin");
switch (p->status) {
default:
die("internal error in blame::find_origin (%c)",