Fix parsing of @{-1}@{1}
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index f160c1a35b786c8b1bb4451c254915bffde0fae3..d23548292ad319defd691655409098f824ec9e94 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1469,6 +1469,7 @@ static void builtin_diff(const char *name_a,
                ecbdata.file = o->file;
                xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
                xecfg.ctxlen = o->context;
+               xecfg.interhunkctxlen = o->interhunkcontext;
                xecfg.flags = XDL_EMIT_FUNCNAMES;
                if (pe)
                        xdiff_set_find_func(&xecfg, pe->pattern, pe->cflags);
@@ -1778,7 +1779,8 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
 
                        if (strbuf_readlink(&sb, s->path, s->size))
                                goto err_empty;
-                       s->data = strbuf_detach(&sb, &s->size);
+                       s->size = sb.len;
+                       s->data = strbuf_detach(&sb, NULL);
                        s->should_free = 1;
                        return 0;
                }
@@ -2038,7 +2040,7 @@ static void diff_fill_sha1_info(struct diff_filespec *one)
                        if (lstat(one->path, &st) < 0)
                                die("stat %s", one->path);
                        if (index_path(one->sha1, one->path, &st, 0))
-                               die("cannot hash %s\n", one->path);
+                               die("cannot hash %s", one->path);
                }
        }
        else
@@ -2537,6 +2539,9 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
                options->b_prefix = arg + 13;
        else if (!strcmp(arg, "--no-prefix"))
                options->a_prefix = options->b_prefix = "";
+       else if (opt_arg(arg, '\0', "inter-hunk-context",
+                        &options->interhunkcontext))
+               ;
        else if (!prefixcmp(arg, "--output=")) {
                options->file = fopen(arg + strlen("--output="), "w");
                options->close_file = 1;