therubymug / hitch

Git author attribution helper for pair programmers.
http://github.com/therubymug/hitch
MIT License
250 stars 32 forks source link

Adds support for a localized hitch_pairs #28

Open vjustov opened 7 years ago

vjustov commented 7 years ago

This is a proof of concept that would enable to have a .hitch_pairs localized in a project folder/repo in order to avoid polluting your general .hitch_pairs with one time only devs.

I haven't added tests because i'm still wondering what would be the best way to test this. I think maybe extracting those .hitch_pairs file concerns to its own file would make it easier to test.

I'm opening this PR for discussion.

therubymug commented 7 years ago

Hello there. This is an idea I've been meaning to get around to for a while.

Here are my initial thoughts:

I want to make it more composable. Meaning, I should be able to initialize any directory the same way we're initializing the $HOME directory. That way, it mirrors what git is doing with ~/.gitconfig and then .git/config in each initialized git repo.

Ideally, I would run (this would be a new command):

hitch init .

This would:

  1. Make sure the current directory is a git repo and bail if not
  2. Prompt the user with the usual initial hitch setup questions
  3. Create a local version of the following files:
.hitch_export_authors
.hitch_pairs
.hitchrc

The hitch command would source the files in the following order:

~/.hitch_export_authors
~/.hitch_pairs
~/.hitchrc

Then the local versions if they're present:

.hitch_export_authors
.hitch_pairs
.hitchrc

This approach would make the current code more reusable. I'll give it more thought but this is kinda the direction I'm leaning toward.