Browse Source

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

pull/26/merge
Daniel Grunwald 14 years ago
parent
commit
b6fe975de1
  1. 12
      src/Tools/UpdateAssemblyInfo/Main.cs

12
src/Tools/UpdateAssemblyInfo/Main.cs

@ -203,8 +203,12 @@ namespace UpdateAssemblyInfo @@ -203,8 +203,12 @@ namespace UpdateAssemblyInfo
{
if (revisionNumber == null) {
if (Directory.Exists(".git")) {
try {
ReadRevisionNumberFromGit();
ReadBranchNameFromGit();
} catch (Exception ex) {
Console.WriteLine(ex.ToString());
}
} else {
Console.WriteLine("There's no git working copy in " + Path.GetFullPath("."));
}
@ -234,10 +238,12 @@ namespace UpdateAssemblyInfo @@ -234,10 +238,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();
}
}
@ -277,11 +283,11 @@ namespace UpdateAssemblyInfo @@ -277,11 +283,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