2014-06-03 15:08:58 +00:00
|
|
|
package commands
|
2013-11-05 17:52:31 +00:00
|
|
|
|
|
|
|
import (
|
2021-09-01 19:41:10 +00:00
|
|
|
"github.com/git-lfs/git-lfs/v3/config"
|
|
|
|
"github.com/git-lfs/git-lfs/v3/git"
|
|
|
|
"github.com/git-lfs/git-lfs/v3/lfs"
|
2016-05-23 18:02:27 +00:00
|
|
|
"github.com/spf13/cobra"
|
2013-11-05 17:52:31 +00:00
|
|
|
)
|
|
|
|
|
2014-06-26 20:09:14 +00:00
|
|
|
func envCommand(cmd *cobra.Command, args []string) {
|
2016-05-13 16:43:04 +00:00
|
|
|
config.ShowConfigWarnings = true
|
2015-03-27 22:36:33 +00:00
|
|
|
|
2017-10-26 02:23:43 +00:00
|
|
|
gitV, err := git.Version()
|
2015-06-17 17:08:22 +00:00
|
|
|
if err != nil {
|
|
|
|
gitV = "Error getting git version: " + err.Error()
|
|
|
|
}
|
|
|
|
|
2016-05-16 11:13:13 +00:00
|
|
|
Print(config.VersionDesc)
|
2015-06-17 17:08:22 +00:00
|
|
|
Print(gitV)
|
|
|
|
Print("")
|
|
|
|
|
2018-07-26 18:40:47 +00:00
|
|
|
defaultRemote := ""
|
2017-10-27 21:31:46 +00:00
|
|
|
if cfg.IsDefaultRemote() {
|
2018-07-26 18:40:47 +00:00
|
|
|
defaultRemote = cfg.Remote()
|
|
|
|
endpoint := getAPIClient().Endpoints.Endpoint("download", defaultRemote)
|
2017-10-27 21:31:46 +00:00
|
|
|
if len(endpoint.Url) > 0 {
|
|
|
|
access := getAPIClient().Endpoints.AccessFor(endpoint.Url)
|
2018-10-02 23:35:54 +00:00
|
|
|
Print("Endpoint=%s (auth=%s)", endpoint.Url, access.Mode())
|
2021-02-03 21:46:28 +00:00
|
|
|
if len(endpoint.SSHMetadata.UserAndHost) > 0 {
|
|
|
|
Print(" SSH=%s:%s", endpoint.SSHMetadata.UserAndHost, endpoint.SSHMetadata.Path)
|
2017-10-27 21:31:46 +00:00
|
|
|
}
|
2015-03-27 22:36:33 +00:00
|
|
|
}
|
2014-02-01 20:46:58 +00:00
|
|
|
}
|
|
|
|
|
2016-07-21 22:37:53 +00:00
|
|
|
for _, remote := range cfg.Remotes() {
|
2018-07-26 18:40:47 +00:00
|
|
|
if remote == defaultRemote {
|
|
|
|
continue
|
|
|
|
}
|
command/env: ensure we honor lfs.url
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.
2019-01-11 17:22:51 +00:00
|
|
|
remoteEndpoint := getAPIClient().Endpoints.Endpoint("download", remote)
|
2017-04-14 16:43:25 +00:00
|
|
|
remoteAccess := getAPIClient().Endpoints.AccessFor(remoteEndpoint.Url)
|
2018-10-02 23:35:54 +00:00
|
|
|
Print("Endpoint (%s)=%s (auth=%s)", remote, remoteEndpoint.Url, remoteAccess.Mode())
|
2021-02-03 21:46:28 +00:00
|
|
|
if len(remoteEndpoint.SSHMetadata.UserAndHost) > 0 {
|
|
|
|
Print(" SSH=%s:%s", remoteEndpoint.SSHMetadata.UserAndHost, remoteEndpoint.SSHMetadata.Path)
|
2015-03-27 22:36:33 +00:00
|
|
|
}
|
2014-02-01 20:38:29 +00:00
|
|
|
}
|
|
|
|
|
2020-10-02 18:20:26 +00:00
|
|
|
for _, env := range lfs.Environ(cfg, getTransferManifest(), oldEnv) {
|
2014-06-05 18:19:30 +00:00
|
|
|
Print(env)
|
2014-01-24 01:30:48 +00:00
|
|
|
}
|
2015-09-23 20:02:22 +00:00
|
|
|
|
2016-10-24 06:13:49 +00:00
|
|
|
for _, key := range []string{"filter.lfs.process", "filter.lfs.smudge", "filter.lfs.clean"} {
|
2016-08-15 21:43:38 +00:00
|
|
|
value, _ := cfg.Git.Get(key)
|
2015-09-23 20:02:22 +00:00
|
|
|
Print("git config %s = %q", key, value)
|
|
|
|
}
|
2013-11-05 17:52:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2016-08-31 22:51:37 +00:00
|
|
|
RegisterCommand("env", envCommand, nil)
|
2013-11-05 17:52:31 +00:00
|
|
|
}
|