Skip to content

Commit 07bedd4

Browse files
Fix #2572: Shallow clones do not produce correct version numbers as these require full history.
1 parent f1bdbfb commit 07bedd4

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

BuildTools/update-assemblyinfo.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,22 @@ function gitVersion() {
4646
if (No-Git) {
4747
return 0;
4848
}
49-
return [Int32]::Parse((git rev-list --count "$baseCommit..HEAD")) + $baseCommitRev;
49+
try {
50+
return [Int32]::Parse((git rev-list --count "$baseCommit..HEAD")) + $baseCommitRev;
51+
} catch {
52+
return 0;
53+
}
5054
}
5155

5256
function gitCommitHash() {
5357
if (No-Git) {
5458
return "0000000000000000000000000000000000000000";
5559
}
56-
return (git rev-list --max-count 1 HEAD);
60+
try {
61+
return (git rev-list --max-count 1 HEAD);
62+
} catch {
63+
return "0000000000000000000000000000000000000000";
64+
}
5765
}
5866

5967
function gitBranch() {

0 commit comments

Comments
 (0)