Commit Graph

10 Commits

Author SHA1 Message Date
Taylor Blau
f0094ebd8f config: Unmarshal using default values 2016-08-09 10:08:56 -06:00
Taylor Blau
09f7d655fd config: introduce func Unmarshal(v interface{})
Calling `Unmarshal` on a struct-pointer will inspect each of that struct's
field's tags, and unmarshal configuration data into said field according to
three parameters:

- The environment specified, either `git` or `os`.
- The name of the key given (in the tag).
- The type of the field (either `string`, `int`, or `bool`).

If there is already a non-zero value stored in the field, then that field will
be skipped, allowing constructors to set up default behavior.
2016-08-09 09:42:48 -06:00
risk danger olson
ee687d74b0 get all tests passing
* remove fetchIncludePaths/fetchExcludePaths caching in *Configuration
* fix config file parsing
* fix extension property parsing
2016-08-05 15:13:31 -06:00
Taylor Blau
8ca4fcbade config: eradicate uses of SetAllEnv
The `SetAllEnv` function is one of two functions that allow for mutable
behavior within the `*config.Configuration` type. It is desirable for us to
remove that function, and all of its uses throughout the LFS codebase.

Unfortunately, a lot of `SetAllEnv` uses are coupled to initializing the
`config.Configuration` instance with custom `.gitconfig` data, a-la
`NewFromValues`. This coupling makes it difficult to write an atomic commit
that *only* removes the usage of `SetAllEnv`.

As a compromise, the signature of `NewFromValues` changed from:

```
func NewFromValues(gitconfig map[string]strimg) *Configuration
```

to...

```
type Values struct {
  Git, Env map[string]string
}

func NewFrom(v Values) *Configuration
```

To support reading fixed data as a part of the `Env` fetcher, a new Fetcher
type was introduced:

```
type mapFetcher map[string]string

func (m mapFetcher) Get(key string) (val string) { ... }
```

and is used in place of the old `*EnvFetcher` to retrieve data from the
"environment".
2016-08-03 17:55:39 -06:00
risk danger olson
c2ae16a305 dark ship the tus adapter 2016-07-25 12:50:58 -06:00
Steve Streeting
b051a4169d Add lfs.basictransfersonly option to disable non-basic transfer adapters
Will be useful as a workaround where there are server bugs & avoid having
to retry across adapters without knowing whether the cause is transient
or not.
2016-06-09 11:45:24 +01:00
Taylor Blau
f9536fc692 config: test that include/exclude filters are loaded correctly 2016-05-31 18:36:19 -06:00
Taylor Blau
fc1daa28e3 lfs: use github.com/stretchr/testify for assertions 2016-05-25 10:43:10 -06:00
Taylor Blau
4593d0a641 vendor: vendor dependencies in vendor/ using Glide
- script/vendor received an update in order to work with Glide
- import paths have been rewritten to work with GO15VENDOREXPERIMENT
2016-05-23 12:10:35 -06:00
Steve Streeting
c4bbd3724e Major refactor to pull things into config, httputil, tools
Mainly required to avoid cyclical dependencies when separating other things
2016-05-13 17:38:06 +01:00