@@ -231,6 +231,15 @@ public class Git : ProcessSourceControl
231
231
[ ReflectorProperty ( "commitUntrackedFiles" , Required = false ) ]
232
232
public bool CommitUntrackedFiles { get ; set ; }
233
233
234
+ /// <summary>
235
+ /// Indicates that files committed during the build process should be pushed to remmote repository after tagging. This requires 'commitBuildModifications'
236
+ /// and 'pushCommitedOnSuccess' to be set to 'true'.
237
+ /// </summary>
238
+ /// <version>1.6</version>
239
+ /// <default>false</default>
240
+ [ ReflectorProperty ( "pushCommitedOnSuccess" , Required = false ) ]
241
+ public bool PushCommitedOnSuccess { get ; set ; }
242
+
234
243
/// <summary>
235
244
/// Used to set the "user.name" configuration setting in the local repository. Required for the 'tagOnSuccess ' feature.
236
245
/// </summary>
@@ -366,6 +375,11 @@ public override void LabelSourceControl(IIntegrationResult result)
366
375
// create a tag and push it.
367
376
GitCreateTag ( tagName , commitMessage , result ) ;
368
377
GitPushTag ( tagName , result ) ;
378
+
379
+ if ( CommitBuildModifications && PushCommitedOnSuccess )
380
+ {
381
+ GitPushAll ( result ) ;
382
+ }
369
383
}
370
384
371
385
#region private methods
@@ -754,6 +768,30 @@ private void GitPushTag(string tagName, IIntegrationResult result)
754
768
ProcessExecutor . ProcessOutput -= ProcessExecutor_ProcessOutput ;
755
769
}
756
770
771
+ /// <summary>
772
+ /// Push commited content with "git push origin HEAD:'branch name'".
773
+ /// </summary>
774
+ /// <param name="result">IIntegrationResult of the current build.</param>
775
+ private void GitPushAll ( IIntegrationResult result )
776
+ {
777
+ ProcessArgumentBuilder buffer = new ProcessArgumentBuilder ( ) ;
778
+ buffer . AddArgument ( "push" ) ;
779
+ buffer . AddArgument ( "origin" ) ;
780
+ buffer . AddArgument ( "HEAD:" + Branch ) ;
781
+
782
+ // initialize progress information
783
+ var bpi = GetBuildProgressInformation ( result ) ;
784
+ bpi . SignalStartRunTask ( string . Concat ( "git " , buffer . ToString ( ) ) ) ;
785
+
786
+ // enable Stdout monitoring
787
+ ProcessExecutor . ProcessOutput += ProcessExecutor_ProcessOutput ;
788
+
789
+ Execute ( NewProcessInfo ( buffer . ToString ( ) , result ) ) ;
790
+
791
+ // remove Stdout monitoring
792
+ ProcessExecutor . ProcessOutput -= ProcessExecutor_ProcessOutput ;
793
+ }
794
+
757
795
/// <summary>
758
796
/// Initialize the git submodules.
759
797
/// </summary>
0 commit comments