From cc122c41cb5c49391e63f2a2c1ff90cb41000d9a Mon Sep 17 00:00:00 2001 From: Ossama Hjaji Date: Thu, 8 Oct 2020 21:56:13 +0200 Subject: [PATCH 1/2] fix number of branches to ignore HEAD --- src/info.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.rs b/src/info.rs index 2a50c8936..994cc1bf3 100644 --- a/src/info.rs +++ b/src/info.rs @@ -428,7 +428,7 @@ impl Info { let branches = String::from_utf8_lossy(&output.stdout); - branches.lines().count() + branches.lines().count() - 1 //Exclude origin/HEAD -> origin/master }; futures::join!(tags, branches) From fa63290295548565bcb77da2cd020239ba971020 Mon Sep 17 00:00:00 2001 From: Ossama Hjaji Date: Fri, 9 Oct 2020 17:32:38 +0200 Subject: [PATCH 2/2] fix underflow when no remote branch --- src/info.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/info.rs b/src/info.rs index 994cc1bf3..a10b2e410 100644 --- a/src/info.rs +++ b/src/info.rs @@ -428,7 +428,11 @@ impl Info { let branches = String::from_utf8_lossy(&output.stdout); - branches.lines().count() - 1 //Exclude origin/HEAD -> origin/master + if branches.lines().count() > 0 { + branches.lines().count() - 1 //Exclude origin/HEAD -> origin/master + } else { + 0 + } }; futures::join!(tags, branches)