ZeusWPI / gamification

Gamification of Zeus member engagement. Replaced by gamification2
https://github.com/ZeusWPI/gamification2
MIT License
4 stars 5 forks source link

Force pushed rewritten commits are counted again #57

Open TomNaessens opened 9 years ago

TomNaessens commented 9 years ago

We forcepused the ansible-config repo a few times, and it seems that the score of the repo has almost doubled. This is obviously not OK and we should find a way to fix this. As a quickfix, we could readd the full ansible-config repository (I think?)

From @feliciaan at Slack:

github 547 commits + 11 commits voor de abyss branch, game: 798 commits

TomNaessens commented 9 years ago

Github seems to have duplicated a lot of issues too: https://github.com/ZeusWPI/ansible-config/commits/master?page=1 I guess we did something wrong somewhere...

TomNaessens commented 9 years ago

That last comment shows that it perhaps is not a gamification issue. My guess is that I force pushed the rewritten repository and that somebody else has pushed the old history back.

TomNaessens commented 9 years ago

We corrected the problems at the ansible-repo, but because of the different hash values of the rewritten commits, these are still counted double in gamification.

iasoon commented 9 years ago

I think this is desirable behaviour. Rewriting a commit is work, too; you want to reward it.

What might not be desirable is keeping the old commit in the database. I'm not sure whether we can find out easily whether a commit has been modified, though.

TomNaessens commented 9 years ago

It depends on the case. If I rewrite an entire repository because someone added a secret file in the 10th commit, we don't want that all rewritten commits (where only the file has been removed) are counted twice.

iasoon commented 9 years ago

If I'm correct, only the 10th commit should change in that case. I think you are right, and something else happened at ansible-config.

TomNaessens commented 9 years ago

Check out the following use case:

[18:33] silox@Gallifrey ~/test ✔ git init
Initialized empty Git repository in /Users/silox/test/.git/
[18:33] silox@Gallifrey ~/test ✔ ls
[18:33] silox@Gallifrey ~/test ✔ echo "a" > een_bestand
[18:33] silox@Gallifrey ~/test ✔ git add een_bestand 
[18:33] silox@Gallifrey ~/test ✔ git commit -m "Een commit" 
[master (root-commit) 19e05b0] Een commit
 1 file changed, 1 insertion(+)
 create mode 100644 een_bestand
[18:33] silox@Gallifrey ~/test ✔ echo "b" > mijn_grootste_geheim.txt
[18:33] silox@Gallifrey ~/test ✔ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    mijn_grootste_geheim.txt

nothing added to commit but untracked files present (use "git add" to track)
[18:33] silox@Gallifrey ~/test ✔ git add mijn_grootste_geheim.txt 
[18:33] silox@Gallifrey ~/test ✔ git commit -m "Mijn grootste geheim"
[master 9e7e186] Mijn grootste geheim
 1 file changed, 1 insertion(+)
 create mode 100644 mijn_grootste_geheim.txt
[18:33] silox@Gallifrey ~/test ✔ git status
On branch master
nothing to commit, working directory clean
[18:33] silox@Gallifrey ~/test ✔ ls
een_bestand              mijn_grootste_geheim.txt
[18:34] silox@Gallifrey ~/test ✔ git log
commit 9e7e1865364a0400ff56c193a6834b11093533c0
Author: Tom Naessens <Tom.Naessens@UGent.be>
Date:   Tue Aug 25 18:33:52 2015 +0200

    Mijn grootste geheim

commit 19e05b05b6aba347d5ecaed822627b6e5712f776
Author: Tom Naessens <Tom.Naessens@UGent.be>
Date:   Tue Aug 25 18:33:30 2015 +0200

    Een commit
[18:34] silox@Gallifrey ~/test ✔ echo "b" > een_tweede_bestand
[18:34] silox@Gallifrey ~/test ✔ git commit -m "Nog een commit"
On branch master
Untracked files:
    een_tweede_bestand

nothing added to commit but untracked files present
[18:34] silox@Gallifrey ~/test ✗ git add een_tweede_bestand 
[18:34] silox@Gallifrey ~/test ✔ git commit -m "Nog een commit"
[master 81f32de] Nog een commit
 1 file changed, 1 insertion(+)
 create mode 100644 een_tweede_bestand
[18:34] silox@Gallifrey ~/test ✔ git sttaus
WARNING: You called a Git command named 'sttaus', which does not exist.
Continuing under the assumption that you meant 'status'
in 0.1 seconds automatically...
gOn branch master
nothing to commit, working directory clean
[18:34] silox@Gallifrey ~/test ✔ git log         
commit 81f32de66e1933ea26e0eb1b1cb7429b22d721b2
Author: Tom Naessens <Tom.Naessens@UGent.be>
Date:   Tue Aug 25 18:34:29 2015 +0200

    Nog een commit

commit 9e7e1865364a0400ff56c193a6834b11093533c0
Author: Tom Naessens <Tom.Naessens@UGent.be>
Date:   Tue Aug 25 18:33:52 2015 +0200

    Mijn grootste geheim

commit 19e05b05b6aba347d5ecaed822627b6e5712f776
Author: Tom Naessens <Tom.Naessens@UGent.be>
Date:   Tue Aug 25 18:33:30 2015 +0200

    Een commit
[18:34] silox@Gallifrey ~/test ✔ git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch mijn_grootste_geheim.txt' --prune-empty --tag-name-filter cat -- --all
Rewrite 9e7e1865364a0400ff56c193a6834b11093533c0 (2/3)rm 'mijn_grootste_geheim.txt'
Rewrite 81f32de66e1933ea26e0eb1b1cb7429b22d721b2 (3/3)rm 'mijn_grootste_geheim.txt'

Ref 'refs/heads/master' was rewritten
[18:36] silox@Gallifrey ~/test ✔ git log
commit 391820377f2b345d870b2ead87d7b14b1df273db
Author: Tom Naessens <Tom.Naessens@UGent.be>
Date:   Tue Aug 25 18:34:29 2015 +0200

    Nog een commit

commit 19e05b05b6aba347d5ecaed822627b6e5712f776
Author: Tom Naessens <Tom.Naessens@UGent.be>
Date:   Tue Aug 25 18:33:30 2015 +0200

    Een commit

391820377f2b345d870b2ead87d7b14b1df273db is not the same as 81f32de66e1933ea26e0eb1b1cb7429b22d721b2. This triggers gamification to count the force pushed rewritten commits twice.

iasoon commented 9 years ago

Right. To cover that case, we should just re-register all commits in the repo without rewarding bounty points (since they have already been rewarded) when a force push happens.

Unfortunately, this would mean none of your force pushed commits will be rewarded, and all unmerged work will be lost as well.