path: only set dotgit flags when configs were read

This commit is contained in:
Patrick Steinhardt 2017-06-06 14:57:31 +02:00
parent 9be4c3039a
commit 78a8f68f06

View File

@ -1708,6 +1708,7 @@ GIT_INLINE(unsigned int) dotgit_flags(
unsigned int flags) unsigned int flags)
{ {
int protectHFS = 0, protectNTFS = 0; int protectHFS = 0, protectNTFS = 0;
int error = 0;
flags |= GIT_PATH_REJECT_DOT_GIT_LITERAL; flags |= GIT_PATH_REJECT_DOT_GIT_LITERAL;
@ -1720,13 +1721,13 @@ GIT_INLINE(unsigned int) dotgit_flags(
#endif #endif
if (repo && !protectHFS) if (repo && !protectHFS)
git_repository__cvar(&protectHFS, repo, GIT_CVAR_PROTECTHFS); error = git_repository__cvar(&protectHFS, repo, GIT_CVAR_PROTECTHFS);
if (protectHFS) if (!error && protectHFS)
flags |= GIT_PATH_REJECT_DOT_GIT_HFS; flags |= GIT_PATH_REJECT_DOT_GIT_HFS;
if (repo && !protectNTFS) if (repo && !protectNTFS)
git_repository__cvar(&protectNTFS, repo, GIT_CVAR_PROTECTNTFS); error = git_repository__cvar(&protectNTFS, repo, GIT_CVAR_PROTECTNTFS);
if (protectNTFS) if (!error && protectNTFS)
flags |= GIT_PATH_REJECT_DOT_GIT_NTFS; flags |= GIT_PATH_REJECT_DOT_GIT_NTFS;
return flags; return flags;