send-email: recognize absolute path on Windows
[gitweb.git] / tree-diff.c
index f4c92f6e200e592ddf8971e5e65566f4ea81d910..456660c7a29ef75030141721205f34134daea51c 100644 (file)
@@ -195,7 +195,6 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
        struct diff_options diff_opts;
        struct diff_queue_struct *q = &diff_queued_diff;
        struct diff_filepair *choice;
-       const char *paths[1];
        int i;
 
        /*
@@ -203,7 +202,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
         * path. Magic that matches more than one path is not
         * supported.
         */
-       GUARD_PATHSPEC(&opt->pathspec, PATHSPEC_FROMTOP);
+       GUARD_PATHSPEC(&opt->pathspec, PATHSPEC_FROMTOP | PATHSPEC_LITERAL);
 #if 0
        /*
         * We should reject wildcards as well. Unfortunately we
@@ -225,11 +224,9 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
        DIFF_OPT_SET(&diff_opts, RECURSIVE);
        DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
        diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
-       diff_opts.single_follow = opt->pathspec.raw[0];
+       diff_opts.single_follow = opt->pathspec.items[0].match;
        diff_opts.break_opt = opt->break_opt;
        diff_opts.rename_score = opt->rename_score;
-       paths[0] = NULL;
-       init_pathspec(&diff_opts.pathspec, paths);
        diff_setup_done(&diff_opts);
        diff_tree(t1, t2, base, &diff_opts);
        diffcore_std(&diff_opts);
@@ -246,15 +243,20 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
                 * the future!
                 */
                if ((p->status == 'R' || p->status == 'C') &&
-                   !strcmp(p->two->path, opt->pathspec.raw[0])) {
+                   !strcmp(p->two->path, opt->pathspec.items[0].match)) {
+                       const char *path[2];
+
                        /* Switch the file-pairs around */
                        q->queue[i] = choice;
                        choice = p;
 
                        /* Update the path we use from now on.. */
+                       path[0] = p->one->path;
+                       path[1] = NULL;
                        free_pathspec(&opt->pathspec);
-                       opt->pathspec.raw[0] = xstrdup(p->one->path);
-                       init_pathspec(&opt->pathspec, opt->pathspec.raw);
+                       parse_pathspec(&opt->pathspec,
+                                      PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
+                                      PATHSPEC_LITERAL_PATH, "", path);
 
                        /*
                         * The caller expects us to return a set of vanilla