stagit

check if LICENSE, README and .gitmodules is a file blob

don't link to directory trees, etc. Thanks 600360 for reporting it!

Hiltjo Posthuma contact@arjunchoudhary.com

commit: 83c6b88 parent: cf96350
1 files changed, 8 insertions(+), 3 deletions(-)
Mstagit.c+8-3
M · stagit.c +8, -3
 1@@ -1085,12 +1085,17 @@ main(int argc, char *argv[])
 2 	}
 3 
 4 	/* check LICENSE */
 5-	haslicense = !git_revparse_single(&obj, repo, "HEAD:LICENSE");
 6+	haslicense = (!git_revparse_single(&obj, repo, "HEAD:LICENSE") &&
 7+		git_object_type(obj) == GIT_OBJ_BLOB);
 8 	git_object_free(obj);
 9+
10 	/* check README */
11-	hasreadme = !git_revparse_single(&obj, repo, "HEAD:README");
12+	hasreadme = (!git_revparse_single(&obj, repo, "HEAD:README") &&
13+		git_object_type(obj) == GIT_OBJ_BLOB);
14 	git_object_free(obj);
15-	hassubmodules = !git_revparse_single(&obj, repo, "HEAD:.gitmodules");
16+
17+	hassubmodules = (!git_revparse_single(&obj, repo, "HEAD:.gitmodules") &&
18+		git_object_type(obj) == GIT_OBJ_BLOB);
19 	git_object_free(obj);
20 
21 	/* log for HEAD */