コード例 #1
0
        public static TM_UserData   setupGitSupportAndLoadTMConfigFile(this TM_UserData userData)
        {
            if (userData.UsingFileStorage && userData.Path_UserData.notNull())
            {
                userData.load_UserData_FromGitRepo();               // will create the custom UserData repo clone (if mapped)
                userData.load_TMConfigFile();                       // loads the user configured TMConfig.Config file (from either the default or the custom UserData folder)

                var gitEnabled = userData.tmConfig().Git.UserData_Git_Enabled;

                if (gitEnabled)
                {
                    if (userData.Path_UserData.isGitRepository())
                    {
                        //"[TM_UserData][setupGitSupport] open repository: {0}".info(userData.Path_UserData);
                        "[TM_UserData][GitOpen]".info();
                        userData.NGit = userData.Path_UserData.git_Open();
                    }
                    else
                    {
                        //"[TM_UserData][setupGitSupport] initializing repository at: {0}".info(userData.Path_UserData);
                        "[TM_UserData][GitInit]".info();
                        userData.NGit = userData.Path_UserData.git_Init();
                    }
                    userData.triggerGitCommit();        // in case there are any files that need to be commited
                }
            }
            return(userData);
        }