kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: KAFKA-1901; Added error handling when no file exists in .git/refs/heads.
Date Wed, 06 Jan 2016 20:48:51 GMT
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 <manikumar.reddy@gmail.com>

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 <manikumar.reddy@gmail.com>
Authored: Wed Jan 6 12:48:47 2016 -0800
Committer: Guozhang Wang <wangguoz@gmail.com>
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) {


Mime
View raw message