diff options
author | Aki <please@ignore.pl> | 2022-07-08 22:42:44 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-07-08 22:42:44 +0200 |
commit | 44f8afdc44d4d7dd0124fac984356c18b966f2db (patch) | |
tree | cb6fb9445ff8da4761a8b2dea2f0fbf4397f6828 | |
parent | 43422b026d4728f9da372cb018bf33d223bb9569 (diff) | |
download | pkgrel-44f8afdc44d4d7dd0124fac984356c18b966f2db.zip pkgrel-44f8afdc44d4d7dd0124fac984356c18b966f2db.tar.gz pkgrel-44f8afdc44d4d7dd0124fac984356c18b966f2db.tar.bz2 |
Added file presence check
-rw-r--r-- | pkgrel.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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 |