public static void Init(this Flow gitFlow, GitFlowRepoSettings settings, Signature author)
        {
            var repo = gitFlow.Repository;
            //Only init if it is not initialized
            if (gitFlow.IsInitialized())
                //TODO: Does Init do anything if already initialized? Is it sufficient to just check the ConfigValues? Should it check branch existance as well?
                return;

            if (gitFlow.IsEmptyRepository())
            {
                Log("New Repository Detected - Creating Master Branch");
                //TODO: Decide if Init should create necesarry branches too?
                //Create Master branch
                Signature committer = author;
                var opts = new CommitOptions {AllowEmptyCommit = true};
                repo.Commit("Initial commit", author, committer, opts);
                //Now make Dev
            }

            SetupMasterBranch(repo, settings.Settings[GitFlowSetting.Master], author);
            SetupDevBranch(repo, settings.Settings[GitFlowSetting.Develop], settings.Settings[GitFlowSetting.Master],
                author);

            //TODO.. Repo has branches

            settings.Settings
                    .ToList()
                    .ForEach(item =>
                        repo.Config.Set(GetConfigKey(item.Key), item.Value, settings.ConfigurationLocation)
                    );

            Log("Init Complete");
        }
Пример #2
0
        public static void Init(this Flow gitFlow, GitFlowRepoSettings settings, Signature author)
        {
            var repo = gitFlow.Repository;

            //Only init if it is not initialized
            if (gitFlow.IsInitialized())
            {
                //TODO: Does Init do anything if already initialized? Is it sufficient to just check the ConfigValues? Should it check branch existance as well?
                return;
            }

            if (gitFlow.IsEmptyRepository())
            {
                Log("New Repository Detected - Creating Master Branch");
                //TODO: Decide if Init should create necesarry branches too?
                //Create Master branch
                Signature committer = author;
                var       opts      = new CommitOptions {
                    AllowEmptyCommit = true
                };
                repo.Commit("Initial commit", author, committer, opts);
                //Now make Dev
            }

            SetupMasterBranch(repo, settings.Settings[GitFlowSetting.Master], author);
            SetupDevBranch(repo, settings.Settings[GitFlowSetting.Develop], settings.Settings[GitFlowSetting.Master],
                           author);

            //TODO.. Repo has branches

            settings.Settings
            .ToList()
            .ForEach(item =>
                     repo.Config.Set(GetConfigKey(item.Key), item.Value, settings.ConfigurationLocation)
                     );

            Log("Init Complete");
        }