Repository navigation
only show git config warnings for lfs keys - #861
Merged
Merged
Conversation
This was referenced Nov 25, 2015
Contributor
|
👍 |
technoweenie
added a commit
that referenced
this pull request
Dec 4, 2015
only show git config warnings for lfs keys
Closed
chrisd8088
added a commit
that referenced
this pull request
Oct 22, 2026
In commits dcb2d4e and 265feee of PR #837 we updated the "git lfs env" command to output a warning when a Git configuration option was defined more than once. Later, in commit dcae83d of PR #861, we limited these warnings so they are only reported for options in the "lfs" configuration section. At present, the readGitConfig() function in our "config" package tracks which configuration options it has parsed so far using an internal map named "uniqKeys". During a "git lfs env" command, the function refers to the map to check if an option in the "lfs" configuration section has been encountered previously. If so, and if the value of the current option differs from the value set previously for the option, then the function outputs a warning message. In a subsequent commit, we expect to revise the readGitConfig() function and simplify the variables it uses to populate the "uniqKeys" map. Before we do so, though, we first add a shell integration test which verifies that the "git lfs env" command reports the expected warnings when an option in the "lfs" section has multiple different values. The test also checks that the "git lfs env" command does not report duplicate values of configuration options that are not in the "lfs" section. Our new test will then serve to guarantee that when we update the readGitConfig() function in subsequent commits, we do not inadvertently alter its handling of duplicate option values. Co-authored-by: Chris Darroch <[email protected]>
chrisd8088
added a commit
that referenced
this pull request
Oct 22, 2026
In commits dcb2d4e and 265feee of PR #837 we updated the "git lfs env" command to output a warning when a Git configuration option was defined more than once. Later, in commit dcae83d of PR #861, we limited these warnings so they are only reported for options in the "lfs" configuration section. At present, the readGitConfig() function in our "config" package tracks which configuration options it has parsed so far using an internal map named "uniqKeys". During a "git lfs env" command, the function refers to the map to check if an option in the "lfs" configuration section has been encountered previously. If so, and if the value of the current option differs from the value set previously for the option, then the function outputs a warning message. The readGitConfig() function accepts Git configuration data in the form generated by the ParseConfigLines() function of our "git" package. Currently, this function splits the output of "git config -l" commands on each line feed (LF) character, so the readGitConfig() function then iterates over those lines and splits each one on the first equals sign ("=") character to determine the name and value of a configuration option. As each option is processed, its name and value are stored in a slice variable named "pieces", whose two elements are then assigned to variables named "key" and "val", respectively. For the most part, the remainder of the per-option loop refers to the current option's name and value via the "key" and "val" variables. However, when populating the "uniqKeys" map and when generating warning messages about multiple values for a single option, we refer directly to the first element of the "pieces" slice even though this element's value will always be identical to that of the "key" variable. In a subsequent commit, we expect to revise our parsing of Git configuration sources to support values which contain line feed (LF) characters. The readGitConfig() function will therefore iterate over a slice of configuration entry structures rather than parse individual lines, and so will no longer require a "pieces" slice. Before we make these changes, we first update the two instances where we refer to the first element of the "pieces" slice so they instead refer to the "key" variable. This will permit us to more easily remove the "pieces" slice entirely in a subsequent commit. Since the "key" variable and the first element of the "pieces" slice are always identical, this change will not alter either the option names stored in the "uniqKeys" map or those reported in warnings by the "git lfs env" command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We don't care if other git values clash.