in scbuild/scbuild.cs [359:421]
public string CheckRelDirSynced( string relDir )
// Returns the name of the current branch
{
string [] res = RunCmd( relDir, "git status ." );
string branch = null;
bool unSync = false;
bool Sync = false;
foreach( string resLine in res )
{
Match match = Regex.Match( resLine, @"^\s*On branch (?<branch>\S+)");
// Print( "{0} -> {1}\n", resLine, match.Success );
if( match.Success )
{
if( branch != null )
{
Fatal( "Found two branch names, '{0}' and '{1}'", branch, match.Groups[ "branch" ].Value );
}
branch = match.Groups[ "branch" ].Value;
}
if( Regex.IsMatch( resLine, @"nothing to commit, working tree clean" ) )
{
Sync = true;
}
else if( Regex.IsMatch( resLine, @"untracked files present" ) ||
Regex.IsMatch( resLine, @"Changes to be committed" ) )
{
unSync = true;
}
}
if( unSync )
{
if( m_option_ignore_sync )
{
Print( "...ignoring directory '{0}' not in sync\n", relDir );
}
else
{
Fatal( "Directory '{0}' is not in sync", relDir );
}
}
if( !Sync )
{
if( m_option_ignore_sync )
{
// No point in printing another warning if we already did one.
if( !unSync )
{
Print( "...ignoring directory '{0}' not validated as sync'd\n", relDir );
}
}
else
{
Fatal( "Could not validate/recognize that directory '{0}' is in sync", relDir );
}
}
return branch;
}