summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkgrel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkgrel.c b/pkgrel.c
index d7551e1..89ce797 100644
--- a/pkgrel.c
+++ b/pkgrel.c
@@ -114,12 +114,19 @@ match_line(const git_diff_delta* delta, const git_diff_hunk* hunk, const git_dif
int
main(int argc, char* argv[])
{
+ FILE* file = fopen("PKGBUILD", "r");
+ if (NULL == file) {
+ dprintf(2, "PKGBUILD not found or cannot be opened\n");
+ exit(1);
+ }
+ fclose(file);
git_libgit2_init();
git_repository* repo = NULL;
try_git(git_repository_open_ext(&repo, NULL, GIT_REPOSITORY_OPEN_FROM_ENV, NULL), "opening repo");
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
diffopts.pathspec.strings = (char*[1]){relative_path_in_current_dir(repo, "PKGBUILD")};
diffopts.pathspec.count = 1;
+ diffopts.flags |= GIT_DIFF_SHOW_UNTRACKED_CONTENT;
if (NULL == diffopts.pathspec.strings[0]) {
dprintf(2, "finding PKGBUILD in repo\n");
exit(1);
@@ -159,7 +166,7 @@ main(int argc, char* argv[])
relpkg++;
}
if (MATCH_RESULT_INIT == match) {
- dprintf(2, "PKGBUILD not found\n");
+ dprintf(2, "PKGBUILD not found in history\n");
exit(1);
}
else