Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support diff.context config #1483

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

Closed
wants to merge 1 commit into from

Conversation

linquize
Copy link
Contributor

Support diff.context config

@vmg
Copy link
Member

vmg commented Apr 19, 2013

This is not the right way to load default values. There is a config var cache in git_repository. Can you please use that to store the default value, and then load it into the diff context from the cache? Thanks!

@arrbee
Copy link
Member

arrbee commented Apr 19, 2013

@vmg In defense of this code, it is copying code that I wrote (immediately above it in the file) that does the same thing for a bool value. Diff looks at core.symlinks, core.ignorestat, core.filemode, core.trustctime, and with this PR diff.context. Also, implicitly it uses core.ignorecase. Should we move all of those into the repository cvar cache? Should pure boolean config values have explicit entries in git_cvar_value or can we just use generic -1, 0, and 1 without expanding that enum?

By the way, there are a ton of other config options that we could probably be checking also (and growing all the time). This diff.context is just one of probably 10+ other settings that we could (should?) be applying. Of course, if we do that, we need to start being more thorough in the test suite to isolate ourselves from the global and system config settings!

@vmg
Copy link
Member

vmg commented Apr 19, 2013

@arrbee: If you feel that all these options are not used enough to deserve caching, then this helper that "looks up config var and returns it or a default without setting an error message" needs to be part of the config code. Looks like a very common operation to perform, so let's implement it where it belongs.

@arrbee
Copy link
Member

arrbee commented Apr 19, 2013

@vmg - sounds good. I think the answer is somewhere in the middle. core.symlinks core.filemode and core.ignorecase should almost certainly be moved into the cvar cache. Maybe all of the core... ones, actually. diff.context and some of the other diff... configs are fairly uncommon, so a config helper that took a default and did not set an error on a failed lookup would be a useful thing.

@linquize Do you want to take this on? If so, feel free! Otherwise, I'm happy to grab your commit as a start and do the rest of the things that @vmg is suggesting... Just let me know.

@linquize
Copy link
Contributor Author

Yes, you can start your work based on this commit.

@arrbee
Copy link
Member

arrbee commented Apr 23, 2013

Merged as part of #1499. I had to rebase, so this commit ended up getting merged as a5df71c instead, but it should still be credited to you. Thanks!

@arrbee arrbee closed this Apr 23, 2013
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.

3 participants