Example #1
0
		public static Commit Create(string message, IEnumerable<Commit> parents, Tree tree, Author author, Author committer, DateTimeOffset time)
		{
			if (string.IsNullOrEmpty(message))
				throw new ArgumentException("message must not be null or empty");
			if (tree == null)
				throw new ArgumentException("tree must not be null");
			var repo = tree.Repository;
			var corecommit = new Core.Commit(repo._internal_repo);
			if (parents != null)
				corecommit.ParentIds = parents.Select(parent => parent._id).ToArray();
			corecommit.Author = new Core.PersonIdent(author.Name, author.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes);
			corecommit.Committer = new Core.PersonIdent(committer.Name, committer.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes);
			corecommit.Message = message;
			corecommit.TreeEntry = tree.InternalTree;
			corecommit.Encoding = GetCommitEncoding(repo);
			corecommit.Save();
			return new Commit(repo, corecommit);
		}
Example #2
0
 public static Commit Create(string message, Commit parent, Tree tree, Author author, Author committer, DateTimeOffset time)
 {
     if (string.IsNullOrEmpty(message))
         throw new ArgumentException("message must not be null or empty");
     if (tree == null)
         throw new ArgumentException("tree must not be null");
     var repo = tree.Repository;
     var corecommit = new CoreCommit(repo._internal_repo);
     if (parent != null)
         corecommit.ParentIds = new GitSharp.Core.ObjectId[] { parent._id };
     corecommit.Author = new GitSharp.Core.PersonIdent(author.Name, author.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes);
     corecommit.Committer = new GitSharp.Core.PersonIdent(committer.Name, committer.EmailAddress, time.ToMillisecondsSinceEpoch(), (int)time.Offset.TotalMinutes);
     corecommit.Message = message;
     corecommit.TreeEntry = tree.InternalTree;
     corecommit.Encoding = ExtractOverridenEncodingCommitFromConfig(repo);
     corecommit.Save();
     return new Commit(repo, corecommit);
 }