Skip to content

Commit 8d2c262

Browse files
committed
Copyedit gix_path::env::git comments
This fixes typos and minor wrong wording, clarifies formatting, and occasionally rewords substantially or expands something for clarity, in some comments and docstrings in `gix_path::env::git`. (Affected docstrings are on nonpublic items and tests, so this change is not user-facing.)
1 parent 00901af commit 8d2c262

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

gix-path/src/env/git/mod.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@ where
2727
let varname_x86 = "ProgramFiles(x86)";
2828

2929
// Should give a 32-bit program files path on a 32-bit system. We also check this on a 64-bit
30-
// system, even though it *should* equal the process's architecture specific variable, so that
30+
// system, even though it *should* equal the process's architecture-specific variable, so that
3131
// we cover the case of a parent process that passes down an overly sanitized environment that
3232
// lacks the architecture-specific variable. On a 64-bit system, because parent and child
33-
// processes' architectures can be different, Windows sets the child's ProgramFiles variable
34-
// from the ProgramW6432 or ProgramFiles(x86) variable applicable to the child's architecture.
35-
// Only if the parent does not pass that down is the passed-down ProgramFiles variable even
36-
// used. But this behavior is not well known, so that situation does sometimes happen.
33+
// processes' architectures can be different, Windows sets the child's `ProgramFiles` variable
34+
// from whichever of the `ProgramW6432` or `ProgramFiles(x86)` variable corresponds to the
35+
// child's architecture. Only if the parent does not pass down the architecture-specific
36+
// variable corresponding to the child's architecture does the child receive its `ProgramFiles`
37+
// variable from `ProgramFiles` as passed down by the parent. But this behavior is not well
38+
// known. So the situation where a process only passes down `ProgramFiles` sometimes happens.
3739
let varname_current = "ProgramFiles";
3840

39-
// 64-bit relative bin dir. So far, this is always mingw64, not ucrt64, clang64, or clangarm64.
41+
// 64-bit relative bin dir. So far, this is always `mingw64`, not `ucrt64`, `clang64`, or `clangarm64`.
4042
let suffix_64 = Path::new(r"Git\mingw64\bin");
4143

42-
// 32-bit relative bin dir. So far, this is always mingw32, not clang32.
44+
// 32-bit relative bin dir. So far, this is always `mingw32`, not `clang32`.
4345
let suffix_32 = Path::new(r"Git\mingw32\bin");
4446

4547
// Whichever of the 64-bit or 32-bit relative bin better matches this process's architecture.
@@ -81,7 +83,7 @@ pub(super) const EXE_NAME: &str = "git";
8183

8284
/// Invoke the git executable to obtain the origin configuration, which is cached and returned.
8385
///
84-
/// The git executable is the one found in PATH or an alternative location.
86+
/// The git executable is the one found in `PATH` or an alternative location.
8587
pub(super) static GIT_HIGHEST_SCOPE_CONFIG_PATH: Lazy<Option<BString>> = Lazy::new(exe_info);
8688

8789
// There are a number of ways to refer to the null device on Windows, but they are not all equally
@@ -134,17 +136,17 @@ fn git_cmd(executable: PathBuf) -> Command {
134136
} else {
135137
"/".into()
136138
};
137-
// Git 2.8.0 and higher support --show-origin. The -l, -z, and --name-only options were
138-
// supported even before that. In contrast, --show-scope was introduced later, in Git 2.26.0.
139+
// Git 2.8.0 and higher support `--show-origin`. The `-l`, `-z`, and `--name-only` options were
140+
// supported even before that. In contrast, `--show-scope` was introduced later, in Git 2.26.0.
139141
// Low versions of Git are still sometimes used, and this is sometimes reasonable because
140142
// downstream distributions often backport security patches without adding most new features.
141-
// So for now, we forgo the convenience of --show-scope for greater backward compatibility.
143+
// So for now, we forgo the convenience of `--show-scope` for greater backward compatibility.
142144
//
143-
// Separately from that, we can't use --system here, because scopes treated higher than the
145+
// Separately from that, we can't use `--system` here, because scopes treated higher than the
144146
// system scope are possible. This commonly happens on macOS with Apple Git, where the config
145147
// file under `/Library` or `/Applications` is shown as an "unknown" scope but takes precedence
146148
// over the system scope. Although `GIT_CONFIG_NOSYSTEM` suppresses this scope along with the
147-
// system scope, passing --system selects only the system scope and omit this "unknown" scope.
149+
// system scope, passing `--system` selects only the system scope and not this "unknown" scope.
148150
cmd.args(["config", "-lz", "--show-origin", "--name-only"])
149151
.current_dir(cwd)
150152
.env_remove("GIT_CONFIG")
@@ -165,7 +167,7 @@ fn first_file_from_config_with_origin(source: &BStr) -> Option<&BStr> {
165167
file[..end_pos].as_bstr().into()
166168
}
167169

168-
/// Try to find the file that contains git configuration coming with the git installation.
170+
/// Try to find the file that contains Git configuration coming with the Git installation.
169171
///
170172
/// This returns the configuration associated with the `git` executable found in the current `PATH`
171173
/// or an alternative location, or `None` if no `git` executable was found or there were other

gix-path/src/env/git/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ mod locations {
180180
///
181181
/// This is present on x64 and also ARM64 systems. On an ARM64 system, ARM64 and AMD64
182182
/// programs use the same program files directory while 32-bit x86 and ARM programs use
183-
/// two others. Only a 32-bit has no 64-bit program files directory.
183+
/// two others. Only a 32-bit system has no 64-bit program files directory.
184184
maybe_64bit: Option<PathBuf>,
185185
}
186186

187187
impl ProgramFilesPaths {
188-
/// Gets the three common kinds of global program files paths without environment variables.
188+
/// Get the three common kinds of global program files paths without environment variables.
189189
///
190190
/// The idea here is to obtain this information, which the `alternative_locations()` unit
191191
/// test uses to learn the expected alternative locations, without duplicating *any* of the
@@ -227,7 +227,7 @@ mod locations {
227227
}
228228
}
229229

230-
/// Checks that the paths we got for testing are reasonable.
230+
/// Check that the paths we got for testing are reasonable.
231231
///
232232
/// This checks that `obtain_envlessly()` returned paths that are likely to be correct and
233233
/// that satisfy the most important properties based on the current system and process.

0 commit comments

Comments
 (0)