From: Junio C Hamano Date: Wed, 3 Jun 2009 07:49:40 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.6.4-rc0~89 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/433e972aeb5e485d2f7a7ac605a1c043822e25d9?ds=inline;hp=-c 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 --- 433e972aeb5e485d2f7a7ac605a1c043822e25d9 diff --combined builtin-blame.c index 9dc3335910,0afdb16cb0..0c2d29a430 --- a/builtin-blame.c +++ b/builtin-blame.c @@@ -362,18 -362,28 +362,28 @@@ static struct origin *find_origin(struc "", &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)", @@@ -2229,7 -2239,7 +2239,7 @@@ int cmd_blame(int argc, const char **ar save_commit_buffer = 0; dashdash_pos = 0; - parse_options_start(&ctx, argc, argv, PARSE_OPT_KEEP_DASHDASH | + parse_options_start(&ctx, argc, argv, prefix, PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0); for (;;) { switch (parse_options_step(&ctx, options, blame_opt_usage)) {