示例#1
0
		public TreeEntry (byte[] mode, string name, SHA1 id)
		{
			if (id.Bytes.Length != 20)
				throw new ArgumentException (String.Format
				                             ("The size of the SHA1 is incorrect, tree entry is invalid has to be 20 and is: ", 
				                              id.Bytes.Length));
			
			if (String.IsNullOrEmpty (name))
				throw new ArgumentException ("Name is null, tree entry is invalid");
			
			if (mode.Length < 5)
				throw new ArgumentException ("mode size is incorrect, tree entry is invalid, size has to be longer than 5 or 5");
			
			this.mode = new GitFileMode (mode);
			this.name = name;
			this.id = id;
		}
		public SymlinkTreeEntry (Tree myParent, SHA1 objId, string objName, bool exec) : 
			base (myParent, objId, objName)
		{
			mode = GitFileMode.Symlink;
		}
		public void SetExecutable (bool setExec)
		{
			mode = setExec ? GitFileMode.ExecutableFile : GitFileMode.RegularFile;
		}