public override async Task CommitAsync(IUserDirectoryUser user)
        {
            await base.CommitAsync(user).ConfigureAwait(false);

            this.Repo.Branches.Update(this.Repo.Branches[this.BranchName], b => b.TrackedBranch = "refs/remotes/origin/" + this.BranchName);

            this.Repo.Network.Push(
                this.Repo.Branches[this.BranchName],
                new PushOptions
            {
                CredentialsProvider = this.CredentialsHandler
            }
                );
        }
Esempio n. 2
0
        public override Task CommitAsync(IUserDirectoryUser user)
        {
            if (this.disposed)
            {
                throw new ObjectDisposedException(nameof(GitRaftRepositoryBase));
            }
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            if (this.ReadOnly)
            {
                throw new NotSupportedException();
            }

            if (this.variablesDirty)
            {
                this.SaveVariables();
            }

            if (this.dirty)
            {
                var signature = new Signature(AH.CoalesceString(user.DisplayName, user.Name), AH.CoalesceString(user.EmailAddress ?? "*****@*****.**"), DateTime.Now);

                var repo = this.lazyRepository.Value;
                var tree = repo.ObjectDatabase.CreateTree(this.lazyCurrentTree.Value);

                var branch = repo.Branches[this.BranchName];
                if (branch == null)
                {
                    var commit = repo.ObjectDatabase.CreateCommit(signature, signature, $"Updated by {SDK.ProductName}.", tree, repo.Head.Tip == null ? Enumerable.Empty <Commit>() : new[] { repo.Head.Tip }, false);
                    branch = repo.Branches.Add(this.BranchName, commit);

                    repo.Refs.Add("refs/head", repo.Refs.Head);
                }
                else
                {
                    var commit = repo.ObjectDatabase.CreateCommit(signature, signature, $"Updated by {SDK.ProductName}.", tree, new[] { branch.Tip }, false);
                    repo.Refs.UpdateTarget(repo.Refs[branch.CanonicalName], commit.Id);
                }
            }

            return(InedoLib.NullTask);
        }
 public bool Equals(IUserDirectoryUser other) => this.Equals(other as ActiveDirectoryUser);