diff mbox

[maintainer-tools,2/2] dim: Simplify test for current branch

Message ID 20170731171553.30586-2-thierry.reding@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thierry Reding July 31, 2017, 5:15 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

Instead of listing branches and grepping for the current branch, simply
read the name of the current branch and compare.

Suggested-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 dim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/dim b/dim
index 1422b35e2471..ebb1da05662d 100755
--- a/dim
+++ b/dim
@@ -333,7 +333,7 @@  function git_current_branch
 
 function git_is_current_branch # branch
 {
-	git branch --list $1 | grep -q '\*'
+	test "$(git_current_branch)" = "$1"
 }
 
 function git_branch_exists # branch