From c19412045c8105c70e085de7933d819614fafb4b Mon Sep 17 00:00:00 2001 From: Jan Schulz Date: Thu, 2 Jun 2016 12:45:07 +0200 Subject: [PATCH] Fix git branch name never shown as dirty The problem was that io.popen() returns a file and not the return code of the called program. The new code was inspired by http://stackoverflow.com/a/14031974/1380673 --- vendor/clink.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index b6f0059..133392b 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -193,7 +193,11 @@ end -- @return {bool} --- function get_git_status() - return io.popen("git diff --quiet --ignore-submodules HEAD 2>nul") + local file = io.popen("git diff --quiet --ignore-submodules HEAD 2>nul") + -- This will get a table with some return stuff + -- rc[3] will be the signal, 0 or 1 + local rc = {file:close()} + return rc[3] == 0 end function git_prompt_filter()