Skip to content

Commit e4b75d6

Browse files
szedergitster
authored andcommitted
trace2: rename environment variables to GIT_TRACE2*
For an environment variable that is supposed to be set by users, the GIT_TR2* env vars are just too unclear, inconsistent, and ugly. Most of the established GIT_* environment variables don't use abbreviations, and in case of the few that do (GIT_DIR, GIT_COMMON_DIR, GIT_DIFF_OPTS) it's quite obvious what the abbreviations (DIR and OPTS) stand for. But what does TR stand for? Track, traditional, trailer, transaction, transfer, transformation, transition, translation, transplant, transport, traversal, tree, trigger, truncate, trust, or ...?! The trace2 facility, as the '2' suffix in its name suggests, is supposed to eventually supercede Git's original trace facility. It's reasonable to expect that the corresponding environment variables follow suit, and after the original GIT_TRACE variables they are called GIT_TRACE2; there is no such thing is 'GIT_TR'. All trace2-specific config variables are, very sensibly, in the 'trace2' section, not in 'tr2'. OTOH, we don't gain anything at all by omitting the last three characters of "trace" from the names of these environment variables. So let's rename all GIT_TR2* environment variables to GIT_TRACE2*, before they make their way into a stable release. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aa25c82 commit e4b75d6

File tree

13 files changed

+85
-85
lines changed

13 files changed

+85
-85
lines changed

Documentation/config/trace2.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,53 @@ command line arguments are not respected.
44

55
trace2.normalTarget::
66
This variable controls the normal target destination.
7-
It may be overridden by the `GIT_TR2` environment variable.
7+
It may be overridden by the `GIT_TRACE2` environment variable.
88
The following table shows possible values.
99

1010
trace2.perfTarget::
1111
This variable controls the performance target destination.
12-
It may be overridden by the `GIT_TR2_PERF` environment variable.
12+
It may be overridden by the `GIT_TRACE2_PERF` environment variable.
1313
The following table shows possible values.
1414

1515
trace2.eventTarget::
1616
This variable controls the event target destination.
17-
It may be overridden by the `GIT_TR2_EVENT` environment variable.
17+
It may be overridden by the `GIT_TRACE2_EVENT` environment variable.
1818
The following table shows possible values.
1919
+
2020
include::../trace2-target-values.txt[]
2121

2222
trace2.normalBrief::
2323
Boolean. When true `time`, `filename`, and `line` fields are
2424
omitted from normal output. May be overridden by the
25-
`GIT_TR2_BRIEF` environment variable. Defaults to false.
25+
`GIT_TRACE2_BRIEF` environment variable. Defaults to false.
2626

2727
trace2.perfBrief::
2828
Boolean. When true `time`, `filename`, and `line` fields are
2929
omitted from PERF output. May be overridden by the
30-
`GIT_TR2_PERF_BRIEF` environment variable. Defaults to false.
30+
`GIT_TRACE2_PERF_BRIEF` environment variable. Defaults to false.
3131

3232
trace2.eventBrief::
3333
Boolean. When true `time`, `filename`, and `line` fields are
3434
omitted from event output. May be overridden by the
35-
`GIT_TR2_EVENT_BRIEF` environment variable. Defaults to false.
35+
`GIT_TRACE2_EVENT_BRIEF` environment variable. Defaults to false.
3636

3737
trace2.eventNesting::
3838
Integer. Specifies desired depth of nested regions in the
3939
event output. Regions deeper than this value will be
40-
omitted. May be overridden by the `GIT_TR2_EVENT_NESTING`
40+
omitted. May be overridden by the `GIT_TRACE2_EVENT_NESTING`
4141
environment variable. Defaults to 2.
4242

4343
trace2.configParams::
4444
A comma-separated list of patterns of "important" config
4545
settings that should be recorded in the trace2 output.
4646
For example, `core.*,remote.*.url` would cause the trace2
4747
output to contain events listing each configured remote.
48-
May be overridden by the `GIT_TR2_CONFIG_PARAMS` environment
48+
May be overridden by the `GIT_TRACE2_CONFIG_PARAMS` environment
4949
variable. Unset by default.
5050

5151
trace2.destinationDebug::
5252
Boolean. When true Git will print error messages when a
5353
trace target destination cannot be opened for writing.
5454
By default, these errors are suppressed and tracing is
5555
silently disabled. May be overridden by the
56-
`GIT_TR2_DST_DEBUG` environment variable.
56+
`GIT_TRACE2_DST_DEBUG` environment variable.

Documentation/git.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -660,23 +660,23 @@ of clones and fetches.
660660
When a curl trace is enabled (see `GIT_TRACE_CURL` above), do not dump
661661
data (that is, only dump info lines and headers).
662662

663-
`GIT_TR2`::
663+
`GIT_TRACE2`::
664664
Enables more detailed trace messages from the "trace2" library.
665-
Output from `GIT_TR2` is a simple text-based format for human
665+
Output from `GIT_TRACE2` is a simple text-based format for human
666666
readability.
667667
+
668-
The `GIT_TR2` variables can take many values. Any value available to
669-
the `GIT_TRACE` variables is also available to `GIT_TR2`. The `GIT_TR2`
668+
The `GIT_TRACE2` variables can take many values. Any value available to
669+
the `GIT_TRACE` variables is also available to `GIT_TRACE2`. The `GIT_TRACE2`
670670
variables can also specify a Unix Domain Socket. See
671671
link:technical/api-trace2.html[Trace2 documentation] for full details.
672672

673-
`GIT_TR2_EVENT`::
673+
`GIT_TRACE2_EVENT`::
674674
This setting writes a JSON-based format that is suited for machine
675675
interpretation. See link:technical/api-trace2.html[Trace2 documentation]
676676
for full details.
677677

678-
`GIT_TR2_PERF`::
679-
In addition to the text-based messages available in `GIT_TR2`, this
678+
`GIT_TRACE2_PERF`::
679+
In addition to the text-based messages available in `GIT_TRACE2`, this
680680
setting writes a column-based format for understanding nesting
681681
regions. See link:technical/api-trace2.html[Trace2 documentation]
682682
for full details.

Documentation/technical/api-trace2.txt

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ formats in the future. This might be used to define a binary format,
2323
for example.
2424

2525
Trace2 is controlled using `trace2.*` config values in the system and
26-
global config files and `GIT_TR2*` environment variables. Trace2 does
26+
global config files and `GIT_TRACE2*` environment variables. Trace2 does
2727
not read from repo local or worktree config files or respect `-c`
2828
command line config settings.
2929

@@ -42,7 +42,7 @@ config setting.
4242
For example
4343

4444
------------
45-
$ export GIT_TR2=~/log.normal
45+
$ export GIT_TRACE2=~/log.normal
4646
$ git version
4747
git version 2.20.1.155.g426c96fcdb
4848
------------
@@ -71,13 +71,13 @@ $ cat ~/log.normal
7171
The performance format target (PERF) is a column-based format to
7272
replace GIT_TRACE_PERFORMANCE and is suitable for development and
7373
testing, possibly to complement tools like gprof. This format is
74-
enabled with the `GIT_TR2_PERF` environment variable or the
74+
enabled with the `GIT_TRACE2_PERF` environment variable or the
7575
`trace2.perfTarget` system or global config setting.
7676

7777
For example
7878

7979
------------
80-
$ export GIT_TR2_PERF=~/log.perf
80+
$ export GIT_TRACE2_PERF=~/log.perf
8181
$ git version
8282
git version 2.20.1.155.g426c96fcdb
8383
------------
@@ -104,14 +104,14 @@ $ cat ~/log.perf
104104
=== The Event Format Target
105105

106106
The event format target is a JSON-based format of event data suitable
107-
for telemetry analysis. This format is enabled with the `GIT_TR2_EVENT`
107+
for telemetry analysis. This format is enabled with the `GIT_TRACE2_EVENT`
108108
environment variable or the `trace2.eventTarget` system or global config
109109
setting.
110110

111111
For example
112112

113113
------------
114-
$ export GIT_TR2_EVENT=~/log.event
114+
$ export GIT_TRACE2_EVENT=~/log.event
115115
$ git version
116116
git version 2.20.1.155.g426c96fcdb
117117
------------
@@ -273,7 +273,7 @@ significantly affects program performance or behavior, such as
273273
Emits a "def_param" messages for "important" configuration
274274
settings.
275275
+
276-
The environment variable `GIT_TR2_CONFIG_PARAMS` or the `trace2.configParams`
276+
The environment variable `GIT_TRACE2_CONFIG_PARAMS` or the `trace2.configParams`
277277
config value can be set to a
278278
list of patterns of important configuration settings, for example:
279279
`core.*,remote.*.url`. This function will iterate over all config
@@ -465,7 +465,7 @@ Events are written as lines of the form:
465465
Note that this may contain embedded LF or CRLF characters that are
466466
not escaped, so the event may spill across multiple lines.
467467

468-
If `GIT_TR2_BRIEF` or `trace2.normalBrief` is true, the `time`, `filename`,
468+
If `GIT_TRACE2_BRIEF` or `trace2.normalBrief` is true, the `time`, `filename`,
469469
and `line` fields are omitted.
470470

471471
This target is intended to be more of a summary (like GIT_TRACE) and
@@ -533,7 +533,7 @@ This field is in anticipation of in-proc submodules in the future.
533533
15:33:33.532712 wt-status.c:2331 | d0 | main | region_leave | r1 | 0.127568 | 0.001504 | status | label:print
534534
------------
535535

536-
If `GIT_TR2_PERF_BRIEF` or `trace2.perfBrief` is true, the `time`, `file`,
536+
If `GIT_TRACE2_PERF_BRIEF` or `trace2.perfBrief` is true, the `time`, `file`,
537537
and `line` fields are omitted.
538538

539539
------------
@@ -598,7 +598,7 @@ The following key/value pairs are common to all events:
598598
`"repo":<repo-id>`::
599599
when present, is the integer repo-id as described previously.
600600

601-
If `GIT_TR2_EVENT_BRIEF` or `trace2.eventBrief` is true, the `file`
601+
If `GIT_TRACE2_EVENT_BRIEF` or `trace2.eventBrief` is true, the `file`
602602
and `line` fields are omitted from all events and the `time` field is
603603
only present on the "start" and "atexit" events.
604604

@@ -911,7 +911,7 @@ visited.
911911
The `category` field may be used in a future enhancement to
912912
do category-based filtering.
913913
+
914-
`GIT_TR2_EVENT_NESTING` or `trace2.eventNesting` can be used to
914+
`GIT_TRACE2_EVENT_NESTING` or `trace2.eventNesting` can be used to
915915
filter deeply nested regions and data events. It defaults to "2".
916916

917917
`"region_leave"`::
@@ -1039,8 +1039,8 @@ rev-list, and gc. This example also shows that fetch took
10391039
5.199 seconds and of that 4.932 was in ssh.
10401040
+
10411041
----------------
1042-
$ export GIT_TR2_BRIEF=1
1043-
$ export GIT_TR2=~/log.normal
1042+
$ export GIT_TRACE2_BRIEF=1
1043+
$ export GIT_TRACE2=~/log.normal
10441044
$ git fetch origin
10451045
...
10461046
----------------
@@ -1075,8 +1075,8 @@ its name as "gc", it also reports the hierarchy as "fetch/gc".
10751075
indented for clarity.)
10761076
+
10771077
----------------
1078-
$ export GIT_TR2_BRIEF=1
1079-
$ export GIT_TR2=~/log.normal
1078+
$ export GIT_TRACE2_BRIEF=1
1079+
$ export GIT_TRACE2=~/log.normal
10801080
$ git fetch origin
10811081
...
10821082
----------------
@@ -1134,8 +1134,8 @@ In this example, scanning for untracked files ran from +0.012568 to
11341134
+0.027149 (since the process started) and took 0.014581 seconds.
11351135
+
11361136
----------------
1137-
$ export GIT_TR2_PERF_BRIEF=1
1138-
$ export GIT_TR2_PERF=~/log.perf
1137+
$ export GIT_TRACE2_PERF_BRIEF=1
1138+
$ export GIT_TRACE2_PERF=~/log.perf
11391139
$ git status
11401140
...
11411141

@@ -1180,8 +1180,8 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
11801180
We can further investigate the time spent scanning for untracked files.
11811181
+
11821182
----------------
1183-
$ export GIT_TR2_PERF_BRIEF=1
1184-
$ export GIT_TR2_PERF=~/log.perf
1183+
$ export GIT_TRACE2_PERF_BRIEF=1
1184+
$ export GIT_TRACE2_PERF=~/log.perf
11851185
$ git status
11861186
...
11871187
$ cat ~/log.perf
@@ -1236,8 +1236,8 @@ int read_index_from(struct index_state *istate, const char *path,
12361236
This example shows that the index contained 3552 entries.
12371237
+
12381238
----------------
1239-
$ export GIT_TR2_PERF_BRIEF=1
1240-
$ export GIT_TR2_PERF=~/log.perf
1239+
$ export GIT_TRACE2_PERF_BRIEF=1
1240+
$ export GIT_TRACE2_PERF=~/log.perf
12411241
$ git status
12421242
...
12431243
$ cat ~/log.perf
@@ -1310,8 +1310,8 @@ Data events are tagged with the active thread name. They are used
13101310
to report the per-thread parameters.
13111311
+
13121312
----------------
1313-
$ export GIT_TR2_PERF_BRIEF=1
1314-
$ export GIT_TR2_PERF=~/log.perf
1313+
$ export GIT_TRACE2_PERF_BRIEF=1
1314+
$ export GIT_TRACE2_PERF=~/log.perf
13151315
$ git status
13161316
...
13171317
$ cat ~/log.perf

t/t0001-init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ test_expect_success 'No extra GIT_* on alias scripts' '
9393
sed -n \
9494
-e "/^GIT_PREFIX=/d" \
9595
-e "/^GIT_TEXTDOMAINDIR=/d" \
96-
-e "/^GIT_TR2_PARENT/d" \
96+
-e "/^GIT_TRACE2_PARENT/d" \
9797
-e "/^GIT_/s/=.*//p" |
9898
sort
9999
EOF

t/t0210-trace2-normal.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ test_description='test trace2 facility (normal target)'
44
. ./test-lib.sh
55

66
# Turn off any inherited trace2 settings for this test.
7-
sane_unset GIT_TR2 GIT_TR2_PERF GIT_TR2_EVENT
8-
sane_unset GIT_TR2_BRIEF
9-
sane_unset GIT_TR2_CONFIG_PARAMS
7+
sane_unset GIT_TRACE2 GIT_TRACE2_PERF GIT_TRACE2_EVENT
8+
sane_unset GIT_TRACE2_BRIEF
9+
sane_unset GIT_TRACE2_CONFIG_PARAMS
1010

1111
# Add t/helper directory to PATH so that we can use a relative
1212
# path to run nested instances of test-tool.exe (see 004child).
@@ -27,12 +27,12 @@ V=$(git version | sed -e 's/^git version //') && export V
2727
# to whatever filtering that target decides to do).
2828
# This script tests the normal target in isolation.
2929
#
30-
# Defer setting GIT_TR2 until the actual command line we want to test
30+
# Defer setting GIT_TRACE2 until the actual command line we want to test
3131
# because hidden git and test-tool commands run by the test harness
3232
# can contaminate our output.
3333

3434
# Enable "brief" feature which turns off "<clock> <file>:<line> " prefix.
35-
GIT_TR2_BRIEF=1 && export GIT_TR2_BRIEF
35+
GIT_TRACE2_BRIEF=1 && export GIT_TRACE2_BRIEF
3636

3737
# Basic tests of the trace2 normal stream. Since this stream is used
3838
# primarily with printf-style debugging/tracing, we do limited testing
@@ -54,7 +54,7 @@ GIT_TR2_BRIEF=1 && export GIT_TR2_BRIEF
5454

5555
test_expect_success 'normal stream, return code 0' '
5656
test_when_finished "rm trace.normal actual expect" &&
57-
GIT_TR2="$(pwd)/trace.normal" test-tool trace2 001return 0 &&
57+
GIT_TRACE2="$(pwd)/trace.normal" test-tool trace2 001return 0 &&
5858
perl "$TEST_DIRECTORY/t0210/scrub_normal.perl" <trace.normal >actual &&
5959
cat >expect <<-EOF &&
6060
version $V
@@ -68,7 +68,7 @@ test_expect_success 'normal stream, return code 0' '
6868

6969
test_expect_success 'normal stream, return code 1' '
7070
test_when_finished "rm trace.normal actual expect" &&
71-
test_must_fail env GIT_TR2="$(pwd)/trace.normal" test-tool trace2 001return 1 &&
71+
test_must_fail env GIT_TRACE2="$(pwd)/trace.normal" test-tool trace2 001return 1 &&
7272
perl "$TEST_DIRECTORY/t0210/scrub_normal.perl" <trace.normal >actual &&
7373
cat >expect <<-EOF &&
7474
version $V
@@ -83,7 +83,7 @@ test_expect_success 'normal stream, return code 1' '
8383
test_expect_success 'automatic filename' '
8484
test_when_finished "rm -r traces actual expect" &&
8585
mkdir traces &&
86-
GIT_TR2="$(pwd)/traces" test-tool trace2 001return 0 &&
86+
GIT_TRACE2="$(pwd)/traces" test-tool trace2 001return 0 &&
8787
perl "$TEST_DIRECTORY/t0210/scrub_normal.perl" <"$(ls traces/*)" >actual &&
8888
cat >expect <<-EOF &&
8989
version $V
@@ -101,7 +101,7 @@ test_expect_success 'automatic filename' '
101101

102102
test_expect_success 'normal stream, exit code 0' '
103103
test_when_finished "rm trace.normal actual expect" &&
104-
GIT_TR2="$(pwd)/trace.normal" test-tool trace2 002exit 0 &&
104+
GIT_TRACE2="$(pwd)/trace.normal" test-tool trace2 002exit 0 &&
105105
perl "$TEST_DIRECTORY/t0210/scrub_normal.perl" <trace.normal >actual &&
106106
cat >expect <<-EOF &&
107107
version $V
@@ -115,7 +115,7 @@ test_expect_success 'normal stream, exit code 0' '
115115

116116
test_expect_success 'normal stream, exit code 1' '
117117
test_when_finished "rm trace.normal actual expect" &&
118-
test_must_fail env GIT_TR2="$(pwd)/trace.normal" test-tool trace2 002exit 1 &&
118+
test_must_fail env GIT_TRACE2="$(pwd)/trace.normal" test-tool trace2 002exit 1 &&
119119
perl "$TEST_DIRECTORY/t0210/scrub_normal.perl" <trace.normal >actual &&
120120
cat >expect <<-EOF &&
121121
version $V
@@ -133,7 +133,7 @@ test_expect_success 'normal stream, exit code 1' '
133133

134134
test_expect_success 'normal stream, error event' '
135135
test_when_finished "rm trace.normal actual expect" &&
136-
GIT_TR2="$(pwd)/trace.normal" test-tool trace2 003error "hello world" "this is a test" &&
136+
GIT_TRACE2="$(pwd)/trace.normal" test-tool trace2 003error "hello world" "this is a test" &&
137137
perl "$TEST_DIRECTORY/t0210/scrub_normal.perl" <trace.normal >actual &&
138138
cat >expect <<-EOF &&
139139
version $V
@@ -147,7 +147,7 @@ test_expect_success 'normal stream, error event' '
147147
test_cmp expect actual
148148
'
149149

150-
sane_unset GIT_TR2_BRIEF
150+
sane_unset GIT_TRACE2_BRIEF
151151

152152
# Now test without environment variables and get all Trace2 settings
153153
# from the global config.

0 commit comments

Comments
 (0)