salarkhan / git-pear

swap credentials after each commit
3 stars 0 forks source link

use git config file instead of team.txt #42

Closed salarkhan closed 10 years ago

salarkhan commented 10 years ago

it is time.

salarkhan commented 10 years ago

we should sink some time into this. i def think it's cleaner than using a text file.

however

if we find that making this happen results in code that is less inefficient than using team.txt, i'm cool with simply moving team.txt to the .git/info dir. thoughts?

supertopher commented 10 years ago

i'm not opposed, but i think i see a clear path with git config --local

salarkhan commented 10 years ago

BTW: https://www.kernel.org/pub/software/scm/git/docs/git-config.html

salarkhan commented 10 years ago

making solid progress on this. think I'll have it done by tonight

salarkhan commented 10 years ago

my game plan was to pretty much mimic everything about what we were doing, except using git config --local team.emails as a key to store all emails as values.

worked wonderfully until I tried to cycle. here's the problem:

git config --local --get-all gives us all values associated with a key git config --local --get gives us the last value associated with a key git config --local --unset-all unsets all values associated with a key git config --local --unset fails if there is more than 1 value associated with a key

this means that we can't just take the top value of team.emails out and then paste it on the bottom as we were doing with team.txt. if we unset-all, we lose the emails before we can cycle.

i guess we could read the values of team.emails, store 'em in an array and then write them back in a cycled order? sounds kinda gross tbh

anyway, I got it working pretty cleanly with just 2 emails. i'll submit that PR once i iron out the kinks, that way we can have a choice of solutions.

i'm tired as shit, so this all prob sounds like straight up derp. feel free to knock this one out if you think you got it

salarkhan commented 10 years ago

FINALLY DONE AWWW YEAHHH