On Mon, Aug 06, 2018 at 09:39:55AM -0400, Jeff King wrote:
> 3. Default to number of CPUs, which is what a lot of other threading
> in Git does. Unfortunately getting that from the shell is
> non-trivial. I'm OK with $(grep -c ^processor /proc/cpuinfo), but
> people on non-Linux platforms would have to fill in their own
> implementation.
Is this too horrible to contemplate?
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 0f09bbbf65..fa8caeec0c 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -635,6 +635,11 @@ int cmd_rev_parse(int argc, const char **argv, const char
*prefix)
continue;
}
+ if (!strcmp(arg, "--online-cpus")) {
+ printf("%d", online_cpus());
+ continue;
+ }
+
/* The rest of the options require a git repository. */
if (!did_repo_setup) {
prefix = setup_git_directory();
-Peff