@@ -684,15 +684,15 @@ char *interpolate_path(const char *path, int real_home)
684684 * links. User relative paths are also returned as they are given,
685685 * except DWIM suffixing.
686686 */
687- const char * enter_repo (const char * path , int strict )
687+ const char * enter_repo (const char * path , unsigned flags )
688688{
689689 static struct strbuf validated_path = STRBUF_INIT ;
690690 static struct strbuf used_path = STRBUF_INIT ;
691691
692692 if (!path )
693693 return NULL ;
694694
695- if (!strict ) {
695+ if (!( flags & ENTER_REPO_STRICT ) ) {
696696 static const char * suffix [] = {
697697 "/.git" , "" , ".git/.git" , ".git" , NULL ,
698698 };
@@ -736,7 +736,8 @@ const char *enter_repo(const char *path, int strict)
736736 if (!suffix [i ])
737737 return NULL ;
738738 gitfile = read_gitfile (used_path .buf );
739- die_upon_dubious_ownership (gitfile , NULL , used_path .buf );
739+ if (!(flags & ENTER_REPO_ANY_OWNER_OK ))
740+ die_upon_dubious_ownership (gitfile , NULL , used_path .buf );
740741 if (gitfile ) {
741742 strbuf_reset (& used_path );
742743 strbuf_addstr (& used_path , gitfile );
@@ -747,7 +748,8 @@ const char *enter_repo(const char *path, int strict)
747748 }
748749 else {
749750 const char * gitfile = read_gitfile (path );
750- die_upon_dubious_ownership (gitfile , NULL , path );
751+ if (!(flags & ENTER_REPO_ANY_OWNER_OK ))
752+ die_upon_dubious_ownership (gitfile , NULL , path );
751753 if (gitfile )
752754 path = gitfile ;
753755 if (chdir (path ))
0 commit comments