reset: optionally setup worktree and refresh index on --mixed
[gitweb.git] / builtin / blame.c
index 6da7233968b6563d85d0689e3b1cae3ebe4027fb..9047b6ef4caa0aa5ca964cdfafdbc19985a3cb25 100644 (file)
@@ -409,7 +409,9 @@ static struct origin *find_origin(struct scoreboard *sb,
        paths[0] = origin->path;
        paths[1] = NULL;
 
-       parse_pathspec(&diff_opts.pathspec, PATHSPEC_ALL_MAGIC, 0, "", paths);
+       parse_pathspec(&diff_opts.pathspec,
+                      PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
+                      PATHSPEC_LITERAL_PATH, "", paths);
        diff_setup_done(&diff_opts);
 
        if (is_null_sha1(origin->commit->object.sha1))
@@ -1802,17 +1804,17 @@ static int prepare_lines(struct scoreboard *sb)
 static int read_ancestry(const char *graft_file)
 {
        FILE *fp = fopen(graft_file, "r");
-       char buf[1024];
+       struct strbuf buf = STRBUF_INIT;
        if (!fp)
                return -1;
-       while (fgets(buf, sizeof(buf), fp)) {
+       while (!strbuf_getwholeline(&buf, fp, '\n')) {
                /* The format is just "Commit Parent1 Parent2 ...\n" */
-               int len = strlen(buf);
-               struct commit_graft *graft = read_graft_line(buf, len);
+               struct commit_graft *graft = read_graft_line(buf.buf, buf.len);
                if (graft)
                        register_commit_graft(graft, 0);
        }
        fclose(fp);
+       strbuf_release(&buf);
        return 0;
 }