Skip to content

Commit 40f9a9c

Browse files
committed
Move Diff overloads to Extensions
1 parent 7c05885 commit 40f9a9c

File tree

3 files changed

+228
-204
lines changed

3 files changed

+228
-204
lines changed

LibGit2Sharp/Diff.cs

Lines changed: 0 additions & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,6 @@ private static IDictionary<DiffTargets, Func<Repository, TreeComparisonHandleRet
102102
{ typeof(PatchStats), diff => new PatchStats(diff) },
103103
};
104104

105-
/// <summary>
106-
/// Show changes between two <see cref="Blob"/>s.
107-
/// </summary>
108-
/// <param name="oldBlob">The <see cref="Blob"/> you want to compare from.</param>
109-
/// <param name="newBlob">The <see cref="Blob"/> you want to compare to.</param>
110-
/// <returns>A <see cref="ContentChanges"/> containing the changes between the <paramref name="oldBlob"/> and the <paramref name="newBlob"/>.</returns>
111-
public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob)
112-
{
113-
return Compare(oldBlob, newBlob, null);
114-
}
115-
116105
/// <summary>
117106
/// Show changes between two <see cref="Blob"/>s.
118107
/// </summary>
@@ -128,71 +117,6 @@ public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob, CompareOptions
128117
}
129118
}
130119

131-
/// <summary>
132-
/// Show changes between two <see cref="Tree"/>s.
133-
/// </summary>
134-
/// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
135-
/// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
136-
/// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
137-
public virtual T Compare<T>(Tree oldTree, Tree newTree) where T : class
138-
{
139-
return Compare<T>(oldTree, newTree, null, null, null);
140-
}
141-
142-
/// <summary>
143-
/// Show changes between two <see cref="Tree"/>s.
144-
/// </summary>
145-
/// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
146-
/// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
147-
/// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
148-
/// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
149-
public virtual T Compare<T>(Tree oldTree, Tree newTree, IEnumerable<string> paths) where T : class
150-
{
151-
return Compare<T>(oldTree, newTree, paths, null, null);
152-
}
153-
154-
/// <summary>
155-
/// Show changes between two <see cref="Tree"/>s.
156-
/// </summary>
157-
/// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
158-
/// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
159-
/// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
160-
/// <param name="explicitPathsOptions">
161-
/// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
162-
/// Use these options to determine how unmatched explicit paths should be handled.
163-
/// </param>
164-
/// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
165-
public virtual T Compare<T>(Tree oldTree, Tree newTree, IEnumerable<string> paths,
166-
ExplicitPathsOptions explicitPathsOptions) where T : class
167-
{
168-
return Compare<T>(oldTree, newTree, paths, explicitPathsOptions, null);
169-
}
170-
171-
/// <summary>
172-
/// Show changes between two <see cref="Tree"/>s.
173-
/// </summary>
174-
/// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
175-
/// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
176-
/// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
177-
/// <param name="compareOptions">Additional options to define patch generation behavior.</param>
178-
/// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
179-
public virtual T Compare<T>(Tree oldTree, Tree newTree, IEnumerable<string> paths, CompareOptions compareOptions) where T : class
180-
{
181-
return Compare<T>(oldTree, newTree, paths, null, compareOptions);
182-
}
183-
184-
/// <summary>
185-
/// Show changes between two <see cref="Tree"/>s.
186-
/// </summary>
187-
/// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
188-
/// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
189-
/// <param name="compareOptions">Additional options to define patch generation behavior.</param>
190-
/// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
191-
public virtual T Compare<T>(Tree oldTree, Tree newTree, CompareOptions compareOptions) where T : class
192-
{
193-
return Compare<T>(oldTree, newTree, null, null, compareOptions);
194-
}
195-
196120
/// <summary>
197121
/// Show changes between two <see cref="Tree"/>s.
198122
/// </summary>
@@ -240,64 +164,6 @@ public virtual T Compare<T>(Tree oldTree, Tree newTree, IEnumerable<string> path
240164
}
241165
}
242166

243-
/// <summary>
244-
/// Show changes between a <see cref="Tree"/> and the Index, the Working Directory, or both.
245-
/// <para>
246-
/// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
247-
/// or <see cref="Patch"/> type as the generic parameter.
248-
/// </para>
249-
/// </summary>
250-
/// <param name="oldTree">The <see cref="Tree"/> to compare from.</param>
251-
/// <param name="diffTargets">The targets to compare to.</param>
252-
/// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
253-
/// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
254-
/// <returns>A <typeparamref name="T"/> containing the changes between the <see cref="Tree"/> and the selected target.</returns>
255-
public virtual T Compare<T>(Tree oldTree, DiffTargets diffTargets) where T : class
256-
{
257-
return Compare<T>(oldTree, diffTargets, null, null, null);
258-
}
259-
260-
/// <summary>
261-
/// Show changes between a <see cref="Tree"/> and the Index, the Working Directory, or both.
262-
/// <para>
263-
/// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
264-
/// or <see cref="Patch"/> type as the generic parameter.
265-
/// </para>
266-
/// </summary>
267-
/// <param name="oldTree">The <see cref="Tree"/> to compare from.</param>
268-
/// <param name="diffTargets">The targets to compare to.</param>
269-
/// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
270-
/// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
271-
/// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
272-
/// <returns>A <typeparamref name="T"/> containing the changes between the <see cref="Tree"/> and the selected target.</returns>
273-
public virtual T Compare<T>(Tree oldTree, DiffTargets diffTargets, IEnumerable<string> paths) where T : class
274-
{
275-
return Compare<T>(oldTree, diffTargets, paths, null, null);
276-
}
277-
278-
/// <summary>
279-
/// Show changes between a <see cref="Tree"/> and the Index, the Working Directory, or both.
280-
/// <para>
281-
/// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
282-
/// or <see cref="Patch"/> type as the generic parameter.
283-
/// </para>
284-
/// </summary>
285-
/// <param name="oldTree">The <see cref="Tree"/> to compare from.</param>
286-
/// <param name="diffTargets">The targets to compare to.</param>
287-
/// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
288-
/// <param name="explicitPathsOptions">
289-
/// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
290-
/// Use these options to determine how unmatched explicit paths should be handled.
291-
/// </param>
292-
/// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
293-
/// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
294-
/// <returns>A <typeparamref name="T"/> containing the changes between the <see cref="Tree"/> and the selected target.</returns>
295-
public virtual T Compare<T>(Tree oldTree, DiffTargets diffTargets, IEnumerable<string> paths,
296-
ExplicitPathsOptions explicitPathsOptions) where T : class
297-
{
298-
return Compare<T>(oldTree, diffTargets, paths, explicitPathsOptions, null);
299-
}
300-
301167
/// <summary>
302168
/// Show changes between a <see cref="Tree"/> and the Index, the Working Directory, or both.
303169
/// <para>
@@ -353,76 +219,6 @@ public virtual T Compare<T>(Tree oldTree, DiffTargets diffTargets, IEnumerable<s
353219
}
354220
}
355221

356-
/// <summary>
357-
/// Show changes between the working directory and the index.
358-
/// <para>
359-
/// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
360-
/// or <see cref="Patch"/> type as the generic parameter.
361-
/// </para>
362-
/// </summary>
363-
/// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
364-
/// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
365-
/// <returns>A <typeparamref name="T"/> containing the changes between the working directory and the index.</returns>
366-
public virtual T Compare<T>() where T : class
367-
{
368-
return Compare<T>(DiffModifiers.None);
369-
}
370-
371-
/// <summary>
372-
/// Show changes between the working directory and the index.
373-
/// <para>
374-
/// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
375-
/// or <see cref="Patch"/> type as the generic parameter.
376-
/// </para>
377-
/// </summary>
378-
/// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
379-
/// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
380-
/// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
381-
/// <returns>A <typeparamref name="T"/> containing the changes between the working directory and the index.</returns>
382-
public virtual T Compare<T>(IEnumerable<string> paths) where T : class
383-
{
384-
return Compare<T>(DiffModifiers.None, paths);
385-
}
386-
387-
/// <summary>
388-
/// Show changes between the working directory and the index.
389-
/// <para>
390-
/// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
391-
/// or <see cref="Patch"/> type as the generic parameter.
392-
/// </para>
393-
/// </summary>
394-
/// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
395-
/// <param name="includeUntracked">If true, include untracked files from the working dir as additions. Otherwise ignore them.</param>
396-
/// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
397-
/// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
398-
/// <returns>A <typeparamref name="T"/> containing the changes between the working directory and the index.</returns>
399-
public virtual T Compare<T>(IEnumerable<string> paths, bool includeUntracked) where T : class
400-
{
401-
return Compare<T>(includeUntracked ? DiffModifiers.IncludeUntracked : DiffModifiers.None, paths);
402-
}
403-
404-
/// <summary>
405-
/// Show changes between the working directory and the index.
406-
/// <para>
407-
/// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
408-
/// or <see cref="Patch"/> type as the generic parameter.
409-
/// </para>
410-
/// </summary>
411-
/// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
412-
/// <param name="includeUntracked">If true, include untracked files from the working dir as additions. Otherwise ignore them.</param>
413-
/// <param name="explicitPathsOptions">
414-
/// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
415-
/// Use these options to determine how unmatched explicit paths should be handled.
416-
/// </param>
417-
/// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
418-
/// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
419-
/// <returns>A <typeparamref name="T"/> containing the changes between the working directory and the index.</returns>
420-
public virtual T Compare<T>(IEnumerable<string> paths, bool includeUntracked,
421-
ExplicitPathsOptions explicitPathsOptions) where T : class
422-
{
423-
return Compare<T>(includeUntracked ? DiffModifiers.IncludeUntracked : DiffModifiers.None, paths, explicitPathsOptions);
424-
}
425-
426222
/// <summary>
427223
/// Show changes between the working directory and the index.
428224
/// <para>

0 commit comments

Comments
 (0)