Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unset GIT_TRACE environment variable for Git commands in Makefile #5240

Merged
merged 4 commits into from Jan 3, 2023

Conversation

chrisd8088
Copy link
Contributor

In commit c4874df of PR #971 the script/cibuild script was revised to run the Go test suite just for our git Go package in order to confirm that we do not leak the GIT_TRACE environment variable to Git itself when it is set.

Later, in commit 2235198 of PR #3144, our Makefile was updated to start by running some Git commands (git describe and git rev-parse) to determine the current tagged version of the project.

When GIT_TRACE=1 is set in second run of the Go test suite, these initial Git command output Git trace log lines, which does not affect the validity of the second Go test of our git package but does add some noise to the output of the script/cibuild script, for example:

09:53:27.393455 git.c:460               trace: built-in: git describe HEAD
09:53:27.395241 git.c:460               trace: built-in: git describe HEAD
09:53:27.396926 git.c:460               trace: built-in: git describe HEAD
09:53:27.398577 git.c:460               trace: built-in: git describe HEAD
09:53:27.400339 git.c:460               trace: built-in: git describe HEAD
09:53:27.401985 git.c:460               trace: built-in: git describe HEAD
09:53:27.403613 git.c:460               trace: built-in: git describe HEAD
09:53:27.405334 git.c:460               trace: built-in: git describe HEAD
09:53:27.406941 git.c:460               trace: built-in: git describe HEAD
09:53:27.408580 git.c:460               trace: built-in: git describe HEAD
09:53:27.410234 git.c:460               trace: built-in: git describe HEAD
09:53:27.411866 git.c:460               trace: built-in: git describe HEAD
09:53:27.413598 git.c:460               trace: built-in: git describe HEAD
09:53:27.415249 git.c:460               trace: built-in: git describe HEAD
09:53:27.416936 git.c:460               trace: built-in: git describe HEAD
09:53:27.418578 git.c:460               trace: built-in: git describe HEAD
09:53:27.420260 git.c:460               trace: built-in: git describe HEAD
09:53:27.421917 git.c:460               trace: built-in: git describe HEAD
09:53:27.423583 git.c:460               trace: built-in: git describe HEAD
09:53:27.425375 git.c:460               trace: built-in: git describe HEAD
09:53:27.427019 git.c:460               trace: built-in: git describe HEAD
09:53:27.428662 git.c:460               trace: built-in: git describe HEAD
09:53:27.430298 git.c:460               trace: built-in: git describe HEAD
09:53:28.605350 git.c:460               trace: built-in: git rev-parse --short HEAD
GOOS= GOARCH= go build -ldflags="-X github.com/git-lfs/git-lfs/v3/config.GitCommit=328eb98 -s -w " -gcflags=" " -trimpath -o ./bin/git-lfs ./git-lfs.go
...
ok  	github.com/git-lfs/git-lfs/v3/git	0.546s

We therefore just unset the GIT_TRACE environment variable for these two Git commands in our Makefile.

In commit c4874df of PR git-lfs#971 the
script/cibuild script was revised to run the Go test suite just for our
"git" Go package in order to confirm that we do not leak the GIT_TRACE
environment variable to Git itself when it is set.

Later, in commit 2235198 of PR git-lfs#3144,
our Makefile was updated to start by running some Git commands
("git describe" and "git rev-parse") to determine the current tagged
version of the project.

When GIT_TRACE=1 is set in second run of the Go test suite, these initial
Git command output Git trace log lines, which does not affect the
validity of the second Go test of our "git" package but does add some
noise to the output of the script/cibuild script.  We therefore just
unset the GIT_TRACE environment variable for these two Git commands in
our Makefile.
@chrisd8088 chrisd8088 requested a review from a team as a code owner December 26, 2022 19:40
@chrisd8088 chrisd8088 merged commit bad1d46 into git-lfs:main Jan 3, 2023
@chrisd8088 chrisd8088 deleted the unset-git-trace-make branch January 3, 2023 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants