summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/git2/index.h8
-rw-r--r--src/index.c2
-rw-r--r--src/repository.c10
3 files changed, 11 insertions, 9 deletions
diff --git a/include/git2/index.h b/include/git2/index.h
index ba0bcc984..131d04945 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -120,9 +120,9 @@ typedef struct git_index_entry {
/** Capabilities of system that affect index actions. */
typedef enum {
- GIT_INDEXCAP_IGNORE_CASE = 1,
- GIT_INDEXCAP_NO_FILEMODE = 2,
- GIT_INDEXCAP_NO_SYMLINKS = 4,
+ GIT_INDEXCAP_IGNORE_CASE = 1u,
+ GIT_INDEXCAP_NO_FILEMODE = 2u,
+ GIT_INDEXCAP_NO_SYMLINKS = 4u,
GIT_INDEXCAP_FROM_OWNER = ~0u
} git_indexcap_t;
@@ -219,7 +219,7 @@ GIT_EXTERN(unsigned int) git_index_caps(const git_index *index);
* @param caps A combination of GIT_INDEXCAP values
* @return 0 on success, -1 on failure
*/
-GIT_EXTERN(int) git_index_set_caps(git_index *index, int caps);
+GIT_EXTERN(int) git_index_set_caps(git_index *index, unsigned int caps);
/**
* Update the contents of an existing index object in memory
diff --git a/src/index.c b/src/index.c
index b4f2a3b6b..21a8d31d1 100644
--- a/src/index.c
+++ b/src/index.c
@@ -408,7 +408,7 @@ static int create_index_error(int error, const char *msg)
return error;
}
-int git_index_set_caps(git_index *index, int caps)
+int git_index_set_caps(git_index *index, unsigned int caps)
{
unsigned int old_ignore_case;
diff --git a/src/repository.c b/src/repository.c
index 6dea48790..0d7c09484 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1145,17 +1145,19 @@ static int repo_init_structure(
}
if (!tdir) {
- if ((error = git_futils_find_template_dir(&template_buf)) >= 0);
+ if (!(error = git_futils_find_template_dir(&template_buf)))
tdir = template_buf.ptr;
default_template = true;
}
- error = git_futils_cp_r(tdir, repo_dir,
- GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_CHMOD_DIRS |
- GIT_CPDIR_SIMPLE_TO_MODE, dmode);
+ if (tdir)
+ error = git_futils_cp_r(tdir, repo_dir,
+ GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_CHMOD_DIRS |
+ GIT_CPDIR_SIMPLE_TO_MODE, dmode);
git_buf_free(&template_buf);
git_config_free(cfg);
+
if (error < 0) {
if (!default_template)
return error;