Re: [PATCH v2 6/6] version: introduce osversion.command config for os-version output
From: Eric Sunshine <hidden>
Date: 2025-01-17 21:44:12
On Fri, Jan 17, 2025 at 5:47 AM Usman Akinyemi [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Currently by default, the new `os-version` capability only exchange the operating system name between servers and clients i.e "Linux" or "Windows". Let's introduce a new configuration option, `osversion.command`, to handle the string exchange between servers and clients. This option allows customization of the exchanged string by leveraging the output of the specified command. This customization might be especially useful on some quite uncommon platforms like NonStop where interesting OS information is available from other means than uname(2). If this new configuration option is not set, the `os-version` capability exchanges just the operating system name. Signed-off-by: Usman Akinyemi <redacted> ---diff --git a/t/t5555-http-smart-common.sh b/t/t5555-http-smart-common.sh@@ -150,6 +150,34 @@ test_expect_success 'git upload-pack --advertise-refs: v2' ' +test_expect_success 'git upload-pack --advertise-refs: v2 with osVersion.command config set' ' + test_config osVersion.command "uname -srvm" && + printf "agent=FAKE" >agent_and_long_osversion && + + if test_have_prereq !WINDOWS + then + printf "\nos-version=%s\n" $(uname -srvm | test_redact_non_printables) >>agent_and_long_osversion + fi &&
As an aid to future readers, please add an explanation either in the commit message or as a comment here in the code explaining why Windows is being singled out as special.
quoted hunk ↗ jump to hunk
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh@@ -53,6 +53,35 @@ test_expect_success 'test capability advertisement' ' +test_expect_success 'test capability advertisement with osVersion.command config set' ' + test_config osVersion.command "uname -srvm" && + printf "agent=git/$(git version | cut -d" " -f3)" >agent_and_long_osversion && + + if test_have_prereq !WINDOWS + then + printf "\nos-version=%s\n" $(uname -srvm | test_redact_non_printables) >>agent_and_long_osversion + fi &&
Ditto.