summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xgit-sonar5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-sonar b/git-sonar
index 4978818..47f3a7f 100755
--- a/git-sonar
+++ b/git-sonar
@@ -124,7 +124,8 @@ line_count() {
}
status_count() {
- echo "$git_status" | grep -E "$1" | line_count
+ # Use a sed transform to prevent unmerged paths from being miscounted
+ echo "$git_status" | sed -nE "s/^AA /AU /;s/^DD /DU /;/${1}/p" | line_count
}
print_commit_range() {
@@ -201,7 +202,7 @@ element_unstaged() {
element_unmerged() {
if [ -n "$opt_status" ]; then
for x in A D U; do
- if cnt="$(status_count "^(${x}${x}|U${x}|${x}U) ")"; then
+ if cnt="$(status_count "^(U${x}|${x}U) ")"; then
printf '%s%b%s%b' "$cnt" "$STATUS_COLOR_UNMERGED" "$x" "$COLOR_DEFAULT"
fi
done