950559b2e8
When we attempt to look up an endpoint to push to or pull from a remote, we call the endpoint finder's Endpoint method, which honors lfs.url, not the RemoteEndpoint method, which does not. However, when enumerating remotes in git lfs env, we call RemoteEndpoint, which means we produce the wrong endpoint if the lfs.url option is set. Update the code to call the correct method, so that we get the correct results. Since the tests check for this case and print the old information (which doesn't match what we actually do), update them as well. Now that we have several tests that produce similar output because they all use lfs.url, update one of the tests to test more useful cases by removing the use of lfs.url.
60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
package commands
|
|
|
|
import (
|
|
"github.com/git-lfs/git-lfs/config"
|
|
"github.com/git-lfs/git-lfs/git"
|
|
"github.com/git-lfs/git-lfs/lfs"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func envCommand(cmd *cobra.Command, args []string) {
|
|
config.ShowConfigWarnings = true
|
|
|
|
gitV, err := git.Version()
|
|
if err != nil {
|
|
gitV = "Error getting git version: " + err.Error()
|
|
}
|
|
|
|
Print(config.VersionDesc)
|
|
Print(gitV)
|
|
Print("")
|
|
|
|
defaultRemote := ""
|
|
if cfg.IsDefaultRemote() {
|
|
defaultRemote = cfg.Remote()
|
|
endpoint := getAPIClient().Endpoints.Endpoint("download", defaultRemote)
|
|
if len(endpoint.Url) > 0 {
|
|
access := getAPIClient().Endpoints.AccessFor(endpoint.Url)
|
|
Print("Endpoint=%s (auth=%s)", endpoint.Url, access.Mode())
|
|
if len(endpoint.SshUserAndHost) > 0 {
|
|
Print(" SSH=%s:%s", endpoint.SshUserAndHost, endpoint.SshPath)
|
|
}
|
|
}
|
|
}
|
|
|
|
for _, remote := range cfg.Remotes() {
|
|
if remote == defaultRemote {
|
|
continue
|
|
}
|
|
remoteEndpoint := getAPIClient().Endpoints.Endpoint("download", remote)
|
|
remoteAccess := getAPIClient().Endpoints.AccessFor(remoteEndpoint.Url)
|
|
Print("Endpoint (%s)=%s (auth=%s)", remote, remoteEndpoint.Url, remoteAccess.Mode())
|
|
if len(remoteEndpoint.SshUserAndHost) > 0 {
|
|
Print(" SSH=%s:%s", remoteEndpoint.SshUserAndHost, remoteEndpoint.SshPath)
|
|
}
|
|
}
|
|
|
|
for _, env := range lfs.Environ(cfg, getTransferManifest()) {
|
|
Print(env)
|
|
}
|
|
|
|
for _, key := range []string{"filter.lfs.process", "filter.lfs.smudge", "filter.lfs.clean"} {
|
|
value, _ := cfg.Git.Get(key)
|
|
Print("git config %s = %q", key, value)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
RegisterCommand("env", envCommand, nil)
|
|
}
|