-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mbeelman-AddGitClean' into develop
* mbeelman-AddGitClean: Add the git clean command to project.
- Loading branch information
Showing
4 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using Cake.Core; | ||
using Cake.Core.Annotations; | ||
using Cake.Core.IO; | ||
using Cake.Git.Extensions; | ||
using LibGit2Sharp; | ||
|
||
// ReSharper disable MemberCanBePrivate.Global | ||
// ReSharper disable UnusedMember.Global | ||
namespace Cake.Git | ||
{ | ||
// ReSharper disable once PublicMembersMustHaveComments | ||
public static partial class GitAliases | ||
{ | ||
/// <summary> | ||
/// Remove untracked file(s) workspace. | ||
/// </summary> | ||
/// <example> | ||
/// <code> | ||
/// var filePaths = new FilePath[] { ".\\test.txt" }; | ||
/// GitClean("c:/temp/cake"); | ||
/// </code> | ||
/// </example> | ||
/// <param name="context">The context.</param> | ||
/// <param name="repositoryDirectoryPath">Path to repository.</param> | ||
/// <exception cref="ArgumentNullException"></exception> | ||
/// <exception cref="ArgumentException"></exception> | ||
[CakeMethodAlias] | ||
[CakeAliasCategory("Clean")] | ||
public static void GitClean( | ||
this ICakeContext context, | ||
DirectoryPath repositoryDirectoryPath | ||
) | ||
{ | ||
if (context == null) | ||
{ | ||
throw new ArgumentNullException(nameof(context)); | ||
} | ||
|
||
if (string.IsNullOrWhiteSpace(repositoryDirectoryPath.FullPath)) | ||
{ | ||
throw new ArgumentException(nameof(repositoryDirectoryPath)); | ||
} | ||
|
||
context.UseRepository( | ||
repositoryDirectoryPath, | ||
repository => repository.RemoveUntrackedFiles() | ||
); | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters