Merge pull request #4784 from tiennou/fix/warnings Some warnings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
diff --git a/src/path.c b/src/path.c
index c8bc8d4..9fab29e 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1887,7 +1887,7 @@ extern int git_path_is_gitfile(const char *path, size_t pathlen, git_path_gitfil
const char *file, *hash;
size_t filelen;
- if (gitfile < 0 && gitfile >= ARRAY_SIZE(gitfiles)) {
+ if (!(gitfile >= GIT_PATH_GITFILE_GITIGNORE && gitfile < ARRAY_SIZE(gitfiles))) {
giterr_set(GITERR_OS, "invalid gitfile for path validation");
return -1;
}
diff --git a/src/streams/stransport.c b/src/streams/stransport.c
index cca17bb..15b3057 100644
--- a/src/streams/stransport.c
+++ b/src/streams/stransport.c
@@ -62,7 +62,7 @@ static int stransport_connect(git_stream *stream)
ret = SSLHandshake(st->ctx);
if (ret != errSSLServerAuthCompleted) {
- giterr_set(GITERR_SSL, "unexpected return value from ssl handshake %d", ret);
+ giterr_set(GITERR_SSL, "unexpected return value from ssl handshake %d", (int)ret);
return -1;
}
diff --git a/tests/core/path.c b/tests/core/path.c
index 6910fab..058a710 100644
--- a/tests/core/path.c
+++ b/tests/core/path.c
@@ -676,3 +676,12 @@ void test_core_path__16_resolve_relative(void)
assert_common_dirlen(6, "a/b/c/foo.txt", "a/b/c/d/e/bar.txt");
assert_common_dirlen(7, "/a/b/c/foo.txt", "/a/b/c/d/e/bar.txt");
}
+
+void test_core_path__git_path_is_file(void)
+{
+ cl_git_fail(git_path_is_gitfile("blob", 4, -1, GIT_PATH_FS_HFS));
+ cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITIGNORE, GIT_PATH_FS_HFS));
+ cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITMODULES, GIT_PATH_FS_HFS));
+ cl_git_pass(git_path_is_gitfile("blob", 4, GIT_PATH_GITFILE_GITATTRIBUTES, GIT_PATH_FS_HFS));
+ cl_git_fail(git_path_is_gitfile("blob", 4, 3, GIT_PATH_FS_HFS));
+}