Browse Source

Fixed UpdateAssemblyInfo error when git repository exists but git.exe cannot be found.

pull/344/merge
Daniel Grunwald 13 years ago
parent
commit
ba4700d253
  1. 16
      BuildTools/UpdateAssemblyInfo/Main.cs

16
BuildTools/UpdateAssemblyInfo/Main.cs

@ -195,8 +195,12 @@ namespace UpdateAssemblyInfo @@ -195,8 +195,12 @@ namespace UpdateAssemblyInfo
{
if (revisionNumber == null) {
if (Directory.Exists(".git")) {
ReadRevisionNumberFromGit();
ReadBranchNameFromGit();
try {
ReadRevisionNumberFromGit();
ReadBranchNameFromGit();
} catch (Exception ex) {
Console.WriteLine(ex.ToString());
}
} else {
Console.WriteLine("There's no git working copy in " + Path.GetFullPath("."));
}
@ -226,10 +230,12 @@ namespace UpdateAssemblyInfo @@ -226,10 +230,12 @@ namespace UpdateAssemblyInfo
}
revNum++;
}
revisionNumber = revNum.ToString();
p.WaitForExit();
if (p.ExitCode != 0)
throw new Exception("git-rev-list exit code was " + p.ExitCode);
// Only set revisionNuber once we ensured the operation was successful,
// so that we retrieve the number from the REVISION file in case of errors
revisionNumber = revNum.ToString();
}
}
@ -269,11 +275,11 @@ namespace UpdateAssemblyInfo @@ -269,11 +275,11 @@ namespace UpdateAssemblyInfo
Console.WriteLine();
Console.WriteLine("Build continues with revision number '0'...");
revisionNumber = "0";
gitCommitHash = "0000000000000000000000000000000000000000";
revisionNumber = null;
}
if (revisionNumber == null || revisionNumber.Length == 0) {
revisionNumber = "0";
gitCommitHash = "0000000000000000000000000000000000000000";
//throw new ApplicationException("Error reading revision number");
}
}

Loading…
Cancel
Save