summaryrefslogtreecommitdiff
path: root/file/git-file.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-27 00:41:09 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-27 00:41:09 -0300
commitbfc763f768a4d9c1e0998669d796ee9cae057264 (patch)
tree7a643512efeea116e986ed22315fc03fe267e4a7 /file/git-file.c
parent19b6ddff92b79530add41b2b6205035bea362cb2 (diff)
downloadeeshow-bfc763f768a4d9c1e0998669d796ee9cae057264.tar.gz
eeshow-bfc763f768a4d9c1e0998669d796ee9cae057264.tar.bz2
eeshow-bfc763f768a4d9c1e0998669d796ee9cae057264.zip
file/git-file.c, git-hist.c: use pfatal_git, perror_git
Diffstat (limited to 'file/git-file.c')
-rw-r--r--file/git-file.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/file/git-file.c b/file/git-file.c
index 6c828ef..3d67f8f 100644
--- a/file/git-file.c
+++ b/file/git-file.c
@@ -96,21 +96,15 @@ static git_tree *pick_revision(git_repository *repo, const char *revision)
git_object *obj;
git_tree *tree;
- if (git_revparse_single(&obj, repo, revision)) {
- const git_error *e = giterr_last();
-
- fatal("%s: %s\n", git_repository_path(repo), e->message);
- }
+ if (git_revparse_single(&obj, repo, revision))
+ pfatal_git(git_repository_path(repo));
if (git_object_type(obj) != GIT_OBJ_COMMIT)
- fatal("%s: not a commit\n", revision);
+ fatal("%s: not a commit", revision);
commit = (git_commit *) obj;
- if (git_commit_tree(&tree, commit)) {
- const git_error *e = giterr_last();
-
- fatal("%s: %s\n", revision, e->message);
- }
+ if (git_commit_tree(&tree, commit))
+ pfatal_git(revision);
return tree;
}
@@ -284,9 +278,7 @@ static git_tree_entry *find_file(git_repository *repo, git_tree *tree,
free(repo_path);
if (git_tree_entry_bypath(&entry, tree, canon_path)) {
- const git_error *e = giterr_last();
-
- error("%s: %s", path, e->message);
+ perror_git(path);
free(canon_path);
return NULL;
}
@@ -305,21 +297,15 @@ static const void *get_data(struct vcs_git *vcs_git, git_tree_entry *entry,
if (git_tree_entry_type(entry) != GIT_OBJ_BLOB)
fatal("entry is not a blob\n");
- if (git_tree_entry_to_object(&obj, repo, entry)) {
- const git_error *e = giterr_last();
-
- fatal("%s\n", e->message);
- }
+ if (git_tree_entry_to_object(&obj, repo, entry))
+ pfatal_git("git_tree_entry_to_object");
vcs_git->obj = obj;
if (verbose > 2) {
git_buf buf = { 0 };
- if (git_object_short_id(&buf, obj)) {
- const git_error *e = giterr_last();
-
- fatal("%s\n", e->message);
- }
+ if (git_object_short_id(&buf, obj))
+ pfatal_git("git_object_short_id");
progress(3, "object %s", buf.ptr);
git_buf_free(&buf);
}