Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use .lfsconfig (with fallback to .gitconfig) #837

Merged
merged 7 commits into from
Nov 18, 2015
Merged

Conversation

technoweenie
Copy link
Contributor

This changes Git LFS to read committed lfs config settings from .lfsconfig instead of .gitconfig. This makes it more clear what settings should go in that file. It does continue to check for .gitconfig but only IF .lfsconfig does not exist. This is meant as a way for projects to gradually rename this file on their own. By Git LFS v2.0, we'll remove support completely.

This also makes a few other changes:

  • ListFromFile() doesn't run os.Stat anymore. The new readGitConfigFromFiles() function minimizes os.Stat calls.
  • The config order was tweaked slightly, reducing the number of git config calls. No need to call git config --list AND git config --file .git/config --list. Now it only calls git config --file .lfsconfig --list and git config --list.

Fixes #780

@technoweenie technoweenie mentioned this pull request Nov 16, 2015
13 tasks
@technoweenie technoweenie mentioned this pull request Nov 16, 2015
fileOutput, err := git.Config.ListFromFile(configFile)
if err != nil {
panic(fmt.Errorf("Error listing git config from %s: %s", configFile, err))
// TODO: remove .gitconfig support for Git LFS v2.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the issue # tracking this work so that when we complete the work we know to remove the TODO.

@technoweenie technoweenie mentioned this pull request Nov 16, 2015
2 tasks
technoweenie added a commit that referenced this pull request Nov 18, 2015
use .lfsconfig (with fallback to .gitconfig)
@technoweenie technoweenie merged commit 14aeecc into master Nov 18, 2015
@technoweenie technoweenie deleted the use-lfsconfig branch November 18, 2015 00:24
@@ -280,9 +280,6 @@ func (c *gitConfig) List() (string, error) {

// ListFromFile lists all of the git config values in the given config file
func (c *gitConfig) ListFromFile(f string) (string, error) {
if _, err := os.Stat(f); os.IsNotExist(err) {
return "", nil
}
return simpleExec("git", "config", "-l", "-f", f)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

837

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants