Example #1
0
		/// <summary>Breaks apart a DiffEntry into two entries, one DELETE and one ADD.</summary>
		/// <remarks>Breaks apart a DiffEntry into two entries, one DELETE and one ADD.</remarks>
		/// <param name="entry">the DiffEntry to break apart.</param>
		/// <returns>
		/// a list containing two entries. Calling
		/// <see cref="GetChangeType()">GetChangeType()</see>
		/// on the first entry will return ChangeType.DELETE. Calling it on
		/// the second entry will return ChangeType.ADD.
		/// </returns>
		internal static IList<NGit.Diff.DiffEntry> BreakModify(NGit.Diff.DiffEntry entry)
		{
			NGit.Diff.DiffEntry del = new NGit.Diff.DiffEntry();
			del.oldId = entry.GetOldId();
			del.oldMode = entry.GetOldMode();
			del.oldPath = entry.GetOldPath();
			del.newId = A_ZERO;
			del.newMode = FileMode.MISSING;
			del.newPath = NGit.Diff.DiffEntry.DEV_NULL;
			del.changeType = DiffEntry.ChangeType.DELETE;
			NGit.Diff.DiffEntry add = new NGit.Diff.DiffEntry();
			add.oldId = A_ZERO;
			add.oldMode = FileMode.MISSING;
			add.oldPath = NGit.Diff.DiffEntry.DEV_NULL;
			add.newId = entry.GetNewId();
			add.newMode = entry.GetNewMode();
			add.newPath = entry.GetNewPath();
			add.changeType = DiffEntry.ChangeType.ADD;
			return Arrays.AsList(del, add);
		}