Philip Oakley <philipoakley@iee.email> writes:

Hi again,

> If you do come up with a reasonably simple script for this purpose, it 
> maybe worth proposing to the Git-List for possible inclusion in the 
> /contrib part of the git hierarchy as part of being inclusive of other 
> folks problems ;-)

I currently use this:

--8<---------------cut here---------------start------------->8---
#!/bin/sh

file="$1"

# Non-merged branches which have had activity within the last 3 month.
active_branches () {
    git branch --remote --list --no-merged HEAD \
        | while read branch; do
        commit=`git log -n1 --since='3 months' $branch`
        if [ x"$commit" != "x" ]; then
            echo $branch
        fi
    done
}

printf "%15s | %6s%% | %s\n" 'LOC changed' '' 'branch'
for branch in `active_branches`; do
    changed_lines=`git diff HEAD..$branch -- $file \
                                 | grep '^[+-][^+-]' \
                                 | wc -l`
    if [ "$changed_lines" != "0" ]; then
        file_lines=`cat $file | wc -l`
        percentage=`echo "scale=4; x=$changed_lines/$file_lines*100; scale=2; 
(100*x)/100" | bc`
        printf "%15s | %6s%% | %s\n" "$changed_lines/$file_lines" "$percentage" 
"$branch"
    fi
done
--8<---------------cut here---------------end--------------->8---

It's very simple (so probably nothing for git/contrib) but enough to get
a clue at which branch to look at in more detail.

Bye,
Tassilo

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/87r1olzqt3.fsf%40gnu.org.

Reply via email to