Jeremy Huddleston Sequoia <jeremyhu@xxxxxxxxx> writes: > Because the default Git version string looks like "git version > 2.10.0-1-g480871e09e", this was mostly OK, but people can change this > version string to arbitrary thing while compiling, which can break the > assumption if they had SP in it. Notably, Apple ships modified Git with > " (Apple Git-xx)" appended to its version number. I am not sure if that customization is a sensible thing to do in the first place, but ... > > -git_version="$(git --version | sed "s/.* //")" > +git_version="$(git --version | sed "s/git version //")" > ... this is good, simply because in help.c::cmd_version() we see int cmd_version(int argc, const char **argv, const char *prefix) { ... printf("git version %s\n", git_version_string); i.e. no matter how heavily modified git_version_string[] is, we will always show "git version" at the beginning (unless a builder goes one step further to customize the version string by modifying the source, at which point all bets are off). To save reviewers and readers from wasting time wondering what happens when a company, which is even less reasonable than Apple, modifies the version number to include "git version" in it, the updated sed expression probably should anchor the pattern to the left edge to clarify the intention, even though it would not make any difference in practice, i.e. sed 's/^git version //'