Commit ca7b9f1
fixup! run-command: be helpful with Git LFS fails on Windows 7
This commit refines the Git LFS check on Windows 7.
In commit 46d14a6 of
PR #5042 the wait_or_whine() function in run-command.c
was revised to call a new function in the case where an executable fails
to run, to check whether this was caused by a Git LFS binary compiled
with a version of the Go language that no longer supports Windows 7.
This change was made to address the issue reported in
#4996.
The new function, win32_warn_about_git_lfs_on_windows7(), performs
several initial checks to test whether the failed executable returned
the exit code 0x0b00 and is named "git-lfs", and whether we are
running Windows 7 or not. Only if all these conditions are met does
it then proceed to try to extract the Go language version from the
binary file and check whether it is 1.21.0 or higher.
However, these initial checks may not cover all possible use and
failure cases.
First, when running in Git Bash, the exit code seen from a recent Git
LFS executable was 0x02. It would therefore appear that the exact exit
code value is not reliable, so we want to check for a non-zero exit code
instead.
Second, the name of the executable may not always be entirely lowercase,
since it is possible to invoke Git LFS through Git by running, for
example, "git LFS ls-files" (at least, on Windows, and with a
case-insensitive filesystem). We therefore need to ignore case when
checking the executable's name.
And third, the name of the executable may not have a trailing space
character, so we also need to check for the case where the name in
argv0 is simply "git-lfs".
With these changes, we can more reliably detect a failure of the Git LFS
executable in a wider range of circumstances.
Signed-off-by: Chris Darroch <chrisd8088@github.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent b105301 commit ca7b9f1
1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
225 | 227 | | |
226 | | - | |
| 228 | + | |
227 | 229 | | |
228 | 230 | | |
229 | 231 | | |
230 | | - | |
231 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
232 | 236 | | |
233 | 237 | | |
234 | 238 | | |
| |||
0 commit comments