config: allow vendors to customize the version info
It's common for vendors (such as Linux distros) to want to customize the User-Agent string and version information for software they provide. This is valuable for vendors, but it also allows troubleshooting problems with custom patches that may have been applied by the vendor. Allow vendors to set a VENDOR makefile flag to set the vendor field for the User-Agent and version information.
This commit is contained in:
parent
97d75e1af4
commit
a8c3d8f070
3
Makefile
3
Makefile
@ -22,6 +22,9 @@ GO_TEST_EXTRA_ARGS =
|
|||||||
# the config.GitCommit variable is always set via this variable, and
|
# the config.GitCommit variable is always set via this variable, and
|
||||||
# DWARF-stripping is enabled unless DWARF=YesPlease.
|
# DWARF-stripping is enabled unless DWARF=YesPlease.
|
||||||
BUILTIN_LD_FLAGS =
|
BUILTIN_LD_FLAGS =
|
||||||
|
ifneq ("$(VENDOR)","")
|
||||||
|
BUILTIN_LD_FLAGS += -X github.com/git-lfs/git-lfs/config.Vendor=$(VENDOR)
|
||||||
|
endif
|
||||||
BUILTIN_LD_FLAGS += -X github.com/git-lfs/git-lfs/config.GitCommit=$(GIT_LFS_SHA)
|
BUILTIN_LD_FLAGS += -X github.com/git-lfs/git-lfs/config.GitCommit=$(GIT_LFS_SHA)
|
||||||
ifneq ("$(DWARF)","YesPlease")
|
ifneq ("$(DWARF)","YesPlease")
|
||||||
BUILTIN_LD_FLAGS += -s
|
BUILTIN_LD_FLAGS += -s
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
GitCommit string
|
GitCommit string
|
||||||
VersionDesc string
|
VersionDesc string
|
||||||
|
Vendor string
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -20,8 +21,12 @@ func init() {
|
|||||||
if len(GitCommit) > 0 {
|
if len(GitCommit) > 0 {
|
||||||
gitCommit = "; git " + GitCommit
|
gitCommit = "; git " + GitCommit
|
||||||
}
|
}
|
||||||
VersionDesc = fmt.Sprintf("git-lfs/%s (GitHub; %s %s; go %s%s)",
|
if len(Vendor) == 0 {
|
||||||
|
Vendor = "GitHub"
|
||||||
|
}
|
||||||
|
VersionDesc = fmt.Sprintf("git-lfs/%s (%s; %s %s; go %s%s)",
|
||||||
Version,
|
Version,
|
||||||
|
Vendor,
|
||||||
runtime.GOOS,
|
runtime.GOOS,
|
||||||
runtime.GOARCH,
|
runtime.GOARCH,
|
||||||
strings.Replace(runtime.Version(), "go", "", 1),
|
strings.Replace(runtime.Version(), "go", "", 1),
|
||||||
|
Loading…
Reference in New Issue
Block a user