File tree Expand file tree Collapse file tree
CSharp/TfsCmdlets/Cmdlets/Git Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ partial class RemoveGitRepository
1919 [ Alias ( "Name" ) ]
2020 public object Repository { get ; set ; }
2121
22+ /// <summary>
23+ /// Permanently deletes the repository instead of moving it to the recycle bin.
24+ /// When omitted, the repository is moved to a recycle bin and can be recovered.
25+ /// When specified, the deletion is irreversible.
26+ /// </summary>
27+ [ Parameter ]
28+ public SwitchParameter Hard { get ; set ; }
29+
2230 /// <summary>
2331 /// HELP_PARAM_FORCE_REMOVE
2432 /// </summary>
@@ -37,7 +45,16 @@ protected override IEnumerable Run()
3745
3846 if ( ! ( repo . DefaultBranch == null || Force ) && ! PowerShell . ShouldContinue ( $ "Are you sure you want to delete Git repository '{ repo . Name } '?") ) continue ;
3947
48+ if ( Has_Hard && ! ( Force || PowerShell . ShouldContinue (
49+ "You are using the -Hard switch. The repository deletion is IRREVERSIBLE " +
50+ $ "and may cause DATA LOSS. Are you sure you want to permanently delete Git repository '{ repo . Name } '?") ) ) continue ;
51+
4052 Client . DeleteRepositoryAsync ( repo . Id ) . Wait ( ) ;
53+
54+ if ( Has_Hard )
55+ {
56+ Client . DeleteRepositoryFromRecycleBinAsync ( repo . ProjectReference . Id . ToString ( ) , repo . Id ) . Wait ( ) ;
57+ }
4158 }
4259
4360 return null ;
You can’t perform that action at this time.
0 commit comments