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 'git config' instead of ConfigParser #58

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

ecsavin
Copy link

@ecsavin ecsavin commented Jun 26, 2015

ConfigParser is no longer used and all parsing is done by 'git config'.
If no configuration file is passed as an argument, git-fat will parse
the following files:

  1. Any colon-separated files in the environment variable $GIT_FAT_CONFIG, if any.
  2. All Git configuration files as per 'git config' without the '--file' switch.
  3. $(git rev-parse --show-toplevel)/.gitfat

git-fat will perform interpolation if needed to resolve git-fat related configuration
values.

This version works fine with legacy .gitffat files, but introduces support for
the syntax below. See the README file for more details.

[gitfat]
    canned-error-message = "Please have a look at ..."
    [gitfat "rsync"]
            remote = {siteconfig.synchost}:{siteconfig.syncroot}
            user = git
            port = 2222
    [gitfat "http"]
            remote = {siteconfig.http-url}
    [defaults "gitfat"]
            backend = rsync
    [defaults "siteconfig"]
            synchost = localhost
            syncroot = /path/to/local/store/mount
            http-url = http://storage.example.com/store

ConfigParser is no longer used  and all parsing is done by 'git config'.
If no configuration file is passed as an argument, git-fat will parse
the following files:
1. Any colon-separated files in the environment variable $GIT_FAT_CONFIG, if any.
2. All Git configuration files as per 'git config' without the '--file' switch.
3. $(git rev-parse --show-toplevel)/.gitfat

git-fat will perform interpolation if needed to resolve git-fat related configuration
values.

This version works fine with legacy .gitffat files, but  introduces support for
the following syntax:

	[gitfat]
		canned-error-message = "Please have a look at ..."
        [gitfat "rsync"]
                remote = {siteconfig.synchost}:{siteconfig.syncroot}
                user = git
                port = 2222
        [gitfat "http"]
                remote = {siteconfig.http-url}
        [defaults "gitfat"]
                backend = rsync
        [defaults "siteconfig"]
                synchost = localhost
                syncroot = /path/to/local/store/mount
                http-url = http://storage.example.com/store
@ecsavin
Copy link
Author

ecsavin commented Jun 26, 2015

As agreed, here you have the pull request associated to issue #40. Note that in the issue #40 discussion I have been using my private account (avicent).

@abraithwaite
Copy link

Wow, thanks! This is going to take a while to review so please forgive me if it's slow :-P.


::

cat >> .gitattributes <<EOF
*.deb filter=fat -crlf
*.deb filter=kat -crlf

Choose a reason for hiding this comment

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

Typo?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, indeed. Thanks @justinclift.

@abraithwaite, should I close this pull request and make a new one? Or do you want to go through the changes first?.

Choose a reason for hiding this comment

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

You can actually just push an additional commit to your branch and it will automatically be added to the pull request. Sorry I haven't had time to review this yet.

Copy link
Author

Choose a reason for hiding this comment

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

No problem @abraithwaite I bet it will take you less time to review this than it took for me to get it sent anyway.

@KeithHanlan
Copy link

I was just adding a fat file to one of my repos and it occured to me that in some environments, common fat files such as *.gz and *.tgz are included in one ore more .gitignore files.

In this case, the documentation should point out that users will need to use git status --ignored to see newly created fat files and they will need to use git add --force to add them.

Also, another point that wasn't immediately apparent to me when I first started using git-fat is that the user must do the git fat push after commiting the file and before pushing the commit.

Taken together, I think a little cookbook might be in order for the end user who starts working in a repo already configured for git fat:

  1. git fat init
    This only needs to be done once per repo and clone.
  2. git status --ignored
    The --ignored option is required if the new files name matches an entry in one of the git-ignore files.
  3. git add --force _new-fat-file.gz
    If the file is being ignored, you must specify the --force option.
  4. git commit
  5. git show
    This will illustrate how the commit only contains a short git-fat record instead of the binary contents.
  6. git fat push
    This will use the appropriate backend mechanism to transfer the new binary file to the external storage location.
  7. git push _origin_ HEAD:refs/for/_master_

@abraithwaite
Copy link

Just started to take a look at this. Can you try running the tests against the code? I'm seeing a lot of style tests failing.

sudo pip install virtualenvwrapper
mkvirtualenv git-fat
pip install -r requirements.txt
pip install tox
python setup.py test

@ecsavin
Copy link
Author

ecsavin commented Jul 8, 2015

I was running the tests directly with python tests/test_git_fat.py with the following results:

 python tests/test_git_fat.py 
.......WARNING:git_fat.py: Missing configfile at: /tmp/git-fat-testD3CYKh/fat-test1/.git-rewrite/t/.gitfat
WARNING:git_fat.py: Missing configfile at: /tmp/git-fat-testD3CYKh/fat-test1/.git-rewrite/t/.gitfat
WARNING:git_fat.py: Missing configfile at: /tmp/git-fat-testD3CYKh/fat-test1/.git-rewrite/t/.gitfat
WARNING:git_fat.py: Missing configfile at: /tmp/git-fat-testD3CYKh/fat-test1/.git-rewrite/t/.gitfat
.......
----------------------------------------------------------------------
Ran 14 tests in 78.630s

OK

I will look into the tox/virtualenv way of running it and get back.

@ecsavin
Copy link
Author

ecsavin commented Jul 8, 2015

Hi,

I pushed now a commit where Tox is passing. In addition to cleaning the style violations, I have had to tweak a little the config files:

  • I removed string from the list of deprecated modules as I extend string.Formatter, which is not considered to be deprecated (this is arguably a bug in pylint)
  • I allowed classes to have up to 8 attributes.
  • I set Tox to pass $HOME to the virtual environments. I don't know if the behaviour of Tox has changed, but this was necessary in my Ubuntu machine.

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

Successfully merging this pull request may close these issues.

4 participants