@@ -231,6 +231,15 @@ public class Git : ProcessSourceControl
231231 [ ReflectorProperty ( "commitUntrackedFiles" , Required = false ) ]
232232 public bool CommitUntrackedFiles { get ; set ; }
233233
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+
234243 /// <summary>
235244 /// Used to set the "user.name" configuration setting in the local repository. Required for the 'tagOnSuccess ' feature.
236245 /// </summary>
@@ -366,6 +375,11 @@ public override void LabelSourceControl(IIntegrationResult result)
366375 // create a tag and push it.
367376 GitCreateTag ( tagName , commitMessage , result ) ;
368377 GitPushTag ( tagName , result ) ;
378+
379+ if ( CommitBuildModifications && PushCommitedOnSuccess )
380+ {
381+ GitPushAll ( result ) ;
382+ }
369383 }
370384
371385 #region private methods
@@ -754,6 +768,30 @@ private void GitPushTag(string tagName, IIntegrationResult result)
754768 ProcessExecutor . ProcessOutput -= ProcessExecutor_ProcessOutput ;
755769 }
756770
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+
757795 /// <summary>
758796 /// Initialize the git submodules.
759797 /// </summary>
0 commit comments