Repository: kafka Updated Branches: refs/heads/trunk b098f677a -> 25fa39d5e
KAFKA-1901; Added error handling when no file exists in .git/refs/heads. guozhangwang added .git/refs/heads/ file existence check. Author: Manikumar reddy O <[email protected]> Reviewers: Ismael Juma, Guozhang Wang Closes #209 from omkreddy/KAFKA-1901 Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/25fa39d5 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/25fa39d5 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/25fa39d5 Branch: refs/heads/trunk Commit: 25fa39d5ef751ce5a79ff25f70203724d4272504 Parents: b098f67 Author: Manikumar reddy O <[email protected]> Authored: Wed Jan 6 12:48:47 2016 -0800 Committer: Guozhang Wang <[email protected]> Committed: Wed Jan 6 12:48:47 2016 -0800 ---------------------------------------------------------------------- build.gradle | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/25fa39d5/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 75db84a..181e7b1 100644 --- a/build.gradle +++ b/build.gradle @@ -431,13 +431,14 @@ project(':clients') { def headRef = file("../.git/HEAD").text if (headRef.contains('ref: ')) { headRef = headRef.replaceAll('ref: ', '').trim() - commitId = file("../.git/$headRef").text.trim().take(takeFromHash) + if (file("../.git/$headRef").exists()) { + commitId = file("../.git/$headRef").text.trim().take(takeFromHash) + } } else { commitId = headRef.trim().take(takeFromHash) } - } else { - commitId - } + } + commitId } task createVersionFile(dependsOn: determineCommitId) {
