浏览代码

Implementing dirty git checkout indicator

Shawn Siefkas 12 年之前
父节点
当前提交
5471f5b2ee
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      Makefile

+ 4 - 1
Makefile

@@ -10,7 +10,10 @@ ifeq ($(VERBOSE), 1)
 GO_OPTIONS += -v
 endif
 
-BUILD_OPTIONS = -ldflags "-X main.GIT_COMMIT `git rev-parse --short HEAD`"
+GIT_COMMIT = $(shell git rev-parse --short HEAD)
+GIT_STATUS = $(shell test -n "`git status --porcelain`" && echo "+CHANGES")
+
+BUILD_OPTIONS = -ldflags "-X main.GIT_COMMIT $(GIT_COMMIT)$(GIT_STATUS)"
 
 SRC_DIR := $(GOPATH)/src