summaryrefslogtreecommitdiff
path: root/stagit.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-05-08 20:35:49 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-05-08 20:37:37 +0200
commitdf3ea10eca41a20aed38a12d9189fb745075e913 (patch)
treea1da37712b02cec1cfa05447ec1ed1549c3de146 /stagit.c
parent518556d7b0fd5fa215384926d558d29a3c42a5da (diff)
check if LICENSE, README and .gitmodules is a file blob
don't link to directory trees, etc. Thanks 600360 for reporting it!
Diffstat (limited to 'stagit.c')
-rw-r--r--stagit.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/stagit.c b/stagit.c
index bb7cd73..f97ade9 100644
--- a/stagit.c
+++ b/stagit.c
@@ -1085,12 +1085,17 @@ main(int argc, char *argv[])
}
/* check LICENSE */
- haslicense = !git_revparse_single(&obj, repo, "HEAD:LICENSE");
+ haslicense = (!git_revparse_single(&obj, repo, "HEAD:LICENSE") &&
+ git_object_type(obj) == GIT_OBJ_BLOB);
git_object_free(obj);
+
/* check README */
- hasreadme = !git_revparse_single(&obj, repo, "HEAD:README");
+ hasreadme = (!git_revparse_single(&obj, repo, "HEAD:README") &&
+ git_object_type(obj) == GIT_OBJ_BLOB);
git_object_free(obj);
- hassubmodules = !git_revparse_single(&obj, repo, "HEAD:.gitmodules");
+
+ hassubmodules = (!git_revparse_single(&obj, repo, "HEAD:.gitmodules") &&
+ git_object_type(obj) == GIT_OBJ_BLOB);
git_object_free(obj);
/* log for HEAD */