Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Wed, 3 Jun 2009 07:49:40 +0000 (00:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Jun 2009 07:49:40 +0000 (00:49 -0700)
* 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

1  2 
builtin-blame.c
diff --combined builtin-blame.c
index 9dc333591045b4232e47eec32488e5a2104540c7,0afdb16cb0e14367994fac99b60f36c292aeaac9..0c2d29a43005e0afe7c0b0754499a37156e235ef
@@@ -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)) {