vmware-archive / git-author

An easy way to setup multiple authors based on `git commit --template`. It depends on git-together
BSD 3-Clause "New" or "Revised" License
30 stars 11 forks source link

git-author should work in single-repo configuration #21

Closed michaelabon closed 4 years ago

michaelabon commented 5 years ago

After #17 was merged, git-author appears to assume that it's being uses system-wide.

I'm in a position where I want to use git-author in just one repository. The authors for this one repository don't work on other projects on my workstation and I don't want to accidentally commit as them.

Reproduction Steps

# Install the two tools
brew install pivotal/tap/git-together pivotal/tap/git-author
$(brew --prefix git-author)/bin/setup.sh

# Create a new git repo
mkdir repro && cd repro
git init

# Set up local pairs
git config --add include.path ../.git-together
git config --file .git-together --add git-together.domain example.com
git config --file .git-together --add git-together.authors.ab 'Abigail Bave; abigail.bave'
git config --file .git-together --add git-together.authors.cd 'Chris Daunders; chris.daunders'
git author ab cd

Actual Results

git author ab cd
Error: author not found for 'ab'
Caused by: error getting git config for 'git-together.authors.ab'
Caused by: config value 'git-together.authors.ab' was not found; class=Config (7); code=NotFound (-3)

Expected Results

git author ab cd
Co-authored-by: Abigail Bave <abigail.bave@example.com>
Co-authored-by: Chris Daunders <chris.daunders@example.com>
xinzweb commented 4 years ago

Yeah, this is due to the --global in the git-author script. Let me think about a way to get around it.