summaryrefslogtreecommitdiff
path: root/builtin/blame.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-06-16 21:33:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-06-16 21:33:47 (GMT)
commitdfb67594e964e63f20546361597c06432c73779d (patch)
tree3ea858127e139ee620a010f4ba82aa95b9fca77c /builtin/blame.c
parent2cd8ebdd3d28359b7886d994e84a8725394935e7 (diff)
parent22570b68e3cb9380403d903680be3b3112a26490 (diff)
downloadgit-dfb67594e964e63f20546361597c06432c73779d.zip
git-dfb67594e964e63f20546361597c06432c73779d.tar.gz
git-dfb67594e964e63f20546361597c06432c73779d.tar.bz2
Merge branch 'rs/janitorial' into maint
Code clean-up. * rs/janitorial: dir: remove unused variable sb clean: remove unused variable buf use file_exists() to check if a file exists in the worktree
Diffstat (limited to 'builtin/blame.c')
-rw-r--r--builtin/blame.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index 8d70623..ff97825 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -26,6 +26,7 @@
#include "userdiff.h"
#include "line-range.h"
#include "line-log.h"
+#include "dir.h"
static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] file");
@@ -2151,16 +2152,6 @@ static void sanity_check_refcnt(struct scoreboard *sb)
}
}
-/*
- * Used for the command line parsing; check if the path exists
- * in the working tree.
- */
-static int has_string_in_work_tree(const char *path)
-{
- struct stat st;
- return !lstat(path, &st);
-}
-
static unsigned parse_score(const char *arg)
{
char *end;
@@ -2656,14 +2647,14 @@ parse_done:
if (argc < 2)
usage_with_options(blame_opt_usage, options);
path = add_prefix(prefix, argv[argc - 1]);
- if (argc == 3 && !has_string_in_work_tree(path)) { /* (2b) */
+ if (argc == 3 && !file_exists(path)) { /* (2b) */
path = add_prefix(prefix, argv[1]);
argv[1] = argv[2];
}
argv[argc - 1] = "--";
setup_work_tree();
- if (!has_string_in_work_tree(path))
+ if (!file_exists(path))
die_errno("cannot stat path '%s'", path);
}