From 0083e7ac051a3bf4728bed890ce98a2dfe443a97 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Thu, 28 Nov 2024 17:07:21 +0100 Subject: [PATCH] sync: push: use direct api version comparison in compatibility checks Use the trait implementations of `ApiVersion` to perform operator based version comparisons. This makes the comparison more readable and reduces the risk for errors. No functional change intended. Signed-off-by: Christian Ebner --- src/server/push.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/server/push.rs b/src/server/push.rs index b2639526..6498f316 100644 --- a/src/server/push.rs +++ b/src/server/push.rs @@ -127,13 +127,11 @@ impl PushParameters { let api_version = ApiVersion::try_from(version_info)?; // push assumes namespace support on the remote side, fail early if missing - if api_version.major < 2 || (api_version.major == 2 && api_version.minor < 2) { + if api_version < ApiVersion::new(2, 2, 0) { bail!("Unsupported remote api version, minimum v2.2 required"); } - let supports_prune_delete_stats = api_version.major > 3 - || (api_version.major == 3 && api_version.minor >= 3) - || (api_version.major == 3 && api_version.minor == 2 && api_version.release >= 11); + let supports_prune_delete_stats = api_version >= ApiVersion::new(3, 2, 11); let target = PushTarget { remote,