Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

merge git send-email and git imap-send achievement #61

Open
wants to merge 5 commits into from

1 participant

@rgenoud

git send-email and git imap-send do basically the same thing.
I think they should unlock the same achievement. (Postman)

rgenoud added some commits
@rgenoud rgenoud merge git send-email and git imap-send achievement
git send-email and git imap-send do basically the same thing.
I think they should unlock the same achievement. (Postman)
fb7cfb2
@rgenoud rgenoud [BUG] count_command: correct the regex matching commands
this caused a problem with git am for example, because every action with
am in it was a match.
Thus, commit --amend was a match, git blame was a match etc...
7da89ee
@rgenoud rgenoud [BUG] count_command: do not match --help commands
when a git xxx --help command is issued, the only achievement unlocked
is Student, then the function returns.
So, "git add --help" for exemple does not fire the
count_unlock_achievement function.
BUT the count_command counts the git add --help commands, that's why
some achievements are missed :
if you start from scratch and then do :
git add toto
git add --help
git add titi
=> you should have the add achievement level 1 and you don't...
c5427e0
@rgenoud

I found and corrected 2 bugs
As I'm not familiar with awk, I used a grep -v to unmatch --help lines...

rgenoud added some commits
@rgenoud rgenoud don't count git x --help commands in web page
otherwise, you could have 34 git commits on the index.html page for
instance, and still be Author level 4 because of the 3 or more git
commit --help commands
9e2f5d5
@rgenoud rgenoud Speed up the commit without a parent test
There's no need to do the full git log to check if there's only one
entry.
git log -2 is enough.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
7843a51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 29, 2012
  1. @rgenoud

    merge git send-email and git imap-send achievement

    rgenoud authored
    git send-email and git imap-send do basically the same thing.
    I think they should unlock the same achievement. (Postman)
Commits on Jul 6, 2012
  1. @rgenoud

    [BUG] count_command: correct the regex matching commands

    rgenoud authored
    this caused a problem with git am for example, because every action with
    am in it was a match.
    Thus, commit --amend was a match, git blame was a match etc...
  2. @rgenoud

    [BUG] count_command: do not match --help commands

    rgenoud authored
    when a git xxx --help command is issued, the only achievement unlocked
    is Student, then the function returns.
    So, "git add --help" for exemple does not fire the
    count_unlock_achievement function.
    BUT the count_command counts the git add --help commands, that's why
    some achievements are missed :
    if you start from scratch and then do :
    git add toto
    git add --help
    git add titi
    => you should have the add achievement level 1 and you don't...
Commits on Jul 10, 2012
  1. @rgenoud

    don't count git x --help commands in web page

    rgenoud authored
    otherwise, you could have 34 git commits on the index.html page for
    instance, and still be Author level 4 because of the 3 or more git
    commit --help commands
Commits on Apr 25, 2013
  1. @rgenoud

    Speed up the commit without a parent test

    rgenoud authored
    There's no need to do the full git log to check if there's only one
    entry.
    git log -2 is enough.
    
    Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 6 deletions.
  1. +6 −6 git-achievements
View
12 git-achievements
@@ -90,8 +90,8 @@ function unlock_achievement()
function count_command
{
- export power=`awk "BEGIN {n=0} /$1/ {n++} END { print log(n)/log(2) }" "$ACTIONLOGFILE"`
- export count=`awk "BEGIN {n=0} /$1/ {n++} END { print n }" "$ACTIONLOGFILE"`
+ export power=`grep -v -- "--help" "$ACTIONLOGFILE" | awk "BEGIN {n=0} /^\\<$1\\>/ {n++} END { print log(n)/log(2) }"`
+ export count=`grep -v -- "--help" "$ACTIONLOGFILE" | awk "BEGIN {n=0} /^\\<$1\\>/ {n++} END { print n }"`
#export powerof2=`awk "BEGIN {n=0} /$1/ {n++} END { print and(n, n-1) }" "$ACTIONLOGFILE"`
# mysys gawk it old and doesn't have the bitwise operation and :( so we have to use perl for now
export powerof2=`echo 'use Env; $y=$ENV{'count'}; $x=($y & ($y-1)); print "$x\n" ' | perl -`
@@ -212,7 +212,7 @@ function check_for_achievements
;;
commit )
count_unlock_achievement "Author" "Made 2^Level commits using git commit." "$command"
- if [ "`git log --pretty=oneline | wc -l`" -eq "1" ] ; then
+ if [ "`git log -2 --pretty=oneline | wc -l`" -eq "1" ] ; then
unlock_achievement "Let there be light" "Commit without a parent." "$command"
fi
case $2 in
@@ -255,8 +255,8 @@ function check_for_achievements
grep )
count_unlock_achievement "Fisherman" "Look for specified patterns in the current repository with git grep." "$command"
;;
- imap-send )
- count_unlock_achievement "Postman" "Send a collection of patches from stdin to an IMAP folder with git imap-send" "$command"
+ imap-send|send-email )
+ count_unlock_achievement "Postman" "Send a collection of patches with git imap-send or git send-email" "$command"
;;
init )
count_unlock_achievement "Architect" "Created a new repository with git init." "$command"
@@ -421,7 +421,7 @@ echo "
# Git Commands
echo 'Git commands sorted by usage:' >> index.html
echo "<pre style=\"text-align: left\">" >> index.html
- cat "${ACTIONLOGFILE}" | grep -v Date | grep -v 'git-dir' | awk '{ print $1 }' | sort | uniq -c | sort -nr >> index.html
+ cat "${ACTIONLOGFILE}" | grep -v Date | grep -v -- --help | grep -v 'git-dir' | awk '{ print $1 }' | sort | uniq -c | sort -nr >> index.html
echo "</pre>" >> index.html
# Locked Achievements
Something went wrong with that request. Please try again.