From patchwork Thu Jul 11 08:30:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13730198 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88DE574416 for ; Thu, 11 Jul 2024 08:30:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686651; cv=none; b=tpx3qoUEK9ywUpPIwaijWbHIxIQO++dAKHCuws7/Lh3Rksba2uz+62aC1ZCxyX5HkKMWgtSBNamNebhuNpI+vDIdhnm5i9UOZTDjYYLDDFZ3geajzSIiwye6hB+cMlIVgbG5V1o1CD2saGjC88ENHokfbzsnlctpOqs6tH2Y8vg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686651; c=relaxed/simple; bh=Gqs0VQwsfgRA2lK8SCn/i68gVXoNG+1qWEpW07/D61k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PTmOBCDfeKQm+LeJB9eCcG25lvyDstvfqPPa2r/MwrEtQGWIzD9QHooQPUCfBFrtd9FyEDvv+6+5mtfyHIRPnFnZLu6jeBICbB52L3dlen52kLKxrxfmLn8ok3i1c+ic3uJzL3lJcfAHhNVLQPy3a/OQTyl7xwRMeHBQwvxpCTE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=W9c/QJi6; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W9c/QJi6" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4266ea6a488so4548835e9.1 for ; Thu, 11 Jul 2024 01:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720686648; x=1721291448; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dGcMb6BAXpBImfiOAFXGemoJ0A4QULj+Nih/JoSKkps=; b=W9c/QJi6wlccehNrj2f/4xL5sc4jn+6upVph/QL/u/IYrvmMs2sZsiwwlkjmN8mnYX k3XlxsjQgIdsG33nz/nShNPWmXvuuApXBI65XYo/jktCp9MmjQFkRirTG06aWIgk8g8y 9W+Q7v58IbpzaZX/FlJglQVdKtYidCHqy+fBT5Sm9L2ugHEHgnGVSVlkRtqZYs6mPEeg fZGUzDgIXO+njn0my45+YlJXt2dYi8ZqyKL6fqugJByZ8IohUowtsuoLxvIHvH1xv/j1 9YWTC862UbcpExKPFdr/T8W72jYFXglZkg7etPaOZ8Q1obmIq0klbqACdz+N71eQ9x6i 9VfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720686648; x=1721291448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dGcMb6BAXpBImfiOAFXGemoJ0A4QULj+Nih/JoSKkps=; b=T43AeFFWQmJ9rQZWFXoNKkdhddOgTCyDpMq0r/uIIEJpT504Nc8ukuBkh0Ej9uaI6G 9w2dV/jmh761224asu4SA/84559BDmMhFXBG1idaIjUi6eNZsdcRbZbTOSZ8Q4qWvGLu ZUew/u7AaKDu/DW6tfguHGSn0ohhqEtGbDSYmc6RrWvtqeAZsCxegS4Z2mOnFnVSdUiN +U85hlVbmrV+2CdnPrIfct0o7ccnxA9aiVuLeoOpEDFD12UyVQgP32oxJX45t4Vnn4h/ a4p6SqMEE5qqsbhsM9+CU84R/6nX72w0r1KfWFfanJXwdAQPofKuODKRBRFQ+MDc3khn UQDQ== X-Forwarded-Encrypted: i=1; AJvYcCVlaGuzFXWIN8q+P9sFK41a+yKSyRQ6fYnFNRHG7nZpzQbJiav67cIsrAGyo2Y2fP5LvsYlJd/KLiaMz9Ekgx9XK5Lc X-Gm-Message-State: AOJu0YyTgkgmQCzQ7LP3aeVDsJ0I9fNx/Vzfva0YruyYpWRvrxKbNcsu Vl63qTXjep+h/VDUitfbUvwRrOmUKm3Hwk2vqw8Igsp/qFctEqUEEe4DyRKu X-Google-Smtp-Source: AGHT+IFcLiJENFQ/t/zps34IehlC72Hd8PGY8YqGnTYI9zxpGdw+mufbDO5WjbLaigfJKrKdLSg3AQ== X-Received: by 2002:a05:600c:2d84:b0:426:5e8e:aa48 with SMTP id 5b1f17b1804b1-426707db6d5mr68396525e9.22.1720686647827; Thu, 11 Jul 2024 01:30:47 -0700 (PDT) Received: from laptop.fritz.box ([2a02:2455:826e:4900:8da7:30a3:c67a:daf8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d5101ffsm263674305e9.16.2024.07.11.01.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 01:30:47 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: chriscool@tuxfamily.org, git@vger.kernel.org, jltobler@gmail.com Subject: [PATCH v2 1/8] clang-format: indent preprocessor directives after hash Date: Thu, 11 Jul 2024 10:30:36 +0200 Message-ID: <20240711083043.1732288-2-karthik.188@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240711083043.1732288-1-karthik.188@gmail.com> References: <20240708092317.267915-1-karthik.188@gmail.com> <20240711083043.1732288-1-karthik.188@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We do not have a rule around the indentation of preprocessor directives. This was also discussed on the list [1], noting how there is often inconsistency in the styling. While there was discussion, there was no conclusion around what is the preferred style here. One style being indenting after the hash: #if FOO # if BAR # include # endif #endif The other being before the hash: #if FOO #if BAR #include #endif #endif Let's pick the former and add 'IndentPPDirectives: AfterHash' value to our '.clang-format'. There is no clear reason to pick one over the other, but it would definitely be nicer to be consistent. [1]: https://lore.kernel.org/r/xmqqwmmm1bw6.fsf@gitster.g Signed-off-by: Karthik Nayak --- .clang-format | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.clang-format b/.clang-format index 3ed4fac753..5e128519bf 100644 --- a/.clang-format +++ b/.clang-format @@ -96,6 +96,12 @@ BreakStringLiterals: false # Switch statement body is always indented one level more than case labels. IndentCaseLabels: false +# Indents directives before the hash. +# #if FOO +# # include +# #endif +IndentPPDirectives: AfterHash + # Don't indent a function definition or declaration if it is wrapped after the # type IndentWrappedFunctionNames: false From patchwork Thu Jul 11 08:30:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13730199 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD00D156F46 for ; Thu, 11 Jul 2024 08:30:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686652; cv=none; b=rpadRE7vuB3Rz95KRSEopc7KirIxBd+fqqnSIwzWyBz5h2oqYT9ZCJOIWUn7cpdN34Lfg9fqb+Tjenrn2m0Gr6V8P9AZdGfWrQizq/0wslWrGOsLj7UPOd8AbbFfgJRvbc4FlPH+QeIvekRgJI0I7sU5tKiw4Jbxb5BGce3O6X4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686652; c=relaxed/simple; bh=rYLSmW92LWpGMgOgvTXGMYv9BXgMYJjw8OEXTDbrCZA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pLUEeg85imFN59RwuUUST67RwTT+wN7ekUeTTwTukrNp53v+Bhd5vzeyja41VvdktlOZXkUnRZnlzc/2bkM8Y9dKXoLQ4m4tWPb5envdRittSSHIf1OQ94+9Xxti5244w0cL8Cj+pS5iuuPw43GnWpA6NsZ7PqkieLuwRK0lgwY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M00YYXR+; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M00YYXR+" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3679e9bfb08so333363f8f.1 for ; Thu, 11 Jul 2024 01:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720686649; x=1721291449; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KgCNkYwb6YHIDARQWCtaR6yrWUTjYfwaSb3ScX0X54Y=; b=M00YYXR+4kCJJQq8fMFa8gRppxfMLsFQgPN7LRL1hwRvm1BKSlH7p/zXcPT6X+Xx9B bC1ni2SxD7yGW5S2jSHda2V7WFJh9RdheiZ9fVAH++aQOM/2XQ+oHV3aAFdKx40yyoZT dpRqoCe0MaWsIOzUfD0O8LcCx/gY5teqjPApbuk+ZJ2A8Uye2k8apjFMg8DUSkBVE5c2 XIkfusK4q7Ui94MnxqXgUJX7OWGBr9LSj+zoyzKMJD2fAW3yzUaAhMfUQWWlnRUjWVJo RN1vnYNmm+GjZdzGn268WHT8Hqd2lU9LjNrCO1GeTP79VjKwOr9x/Xh40uti5fxfHEW9 Y+JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720686649; x=1721291449; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KgCNkYwb6YHIDARQWCtaR6yrWUTjYfwaSb3ScX0X54Y=; b=H0+B+vHLsxHxKvQDVvCBVUpgUGX3gm8717D3BKYqkgOtaI9e0bquQln+jLLeO7SKzm 2H5n9DU01BsQu7E9PWS+EQ+Zsmvlp//cIGuj3oJ71wguiUv0/tyT2K+XbinxXfw8AKx3 7tqVBIwwXVjE1v+8Zx8D5AG2WDNAfw1EuEXH/tqIkfr5Unaw/lE4ryPjLELQvcxjwyGT 04IxRGcHml4MKq4Na+v+xeySN4VWKxOebninXiaFd3kI8jHQOzIvp1EnrY9lA6mMO+tm FbPUKFKLbZ0xuNHd7/anciszHDvfXGXFADF7ldciZ3Y92S232qZ0384aP7uDI9Sgr5XN pl/A== X-Forwarded-Encrypted: i=1; AJvYcCUCAd/tPKa6vL7T9LyYjtkmFbN7O8pm2CxDqLdENFEuYTKbeHgVSaOJrQFuPDlPz7ymHQApv/8Rr0YkLrXYDYU05+Oy X-Gm-Message-State: AOJu0Yyt+JnCAQzO69Dc8prA/60/huXwaq3x7JEb3k+crVARL06sj6+w O0bg1D8A1eS/Gxa5OSUnYbY7xSFMNxaOuV+ikcdPXMeaecmyP55NYG90WpcR X-Google-Smtp-Source: AGHT+IHBzACZGeug1Ofyf1aRTDFrqoKOZUEd27BeUTreUikOdX3aFlzXnED/ygkVEAiGLfj/viNeNA== X-Received: by 2002:a05:6000:1f0d:b0:367:8fe2:7d8b with SMTP id ffacd0b85a97d-367f05051ffmr1571801f8f.31.1720686648906; Thu, 11 Jul 2024 01:30:48 -0700 (PDT) Received: from laptop.fritz.box ([2a02:2455:826e:4900:8da7:30a3:c67a:daf8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d5101ffsm263674305e9.16.2024.07.11.01.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 01:30:48 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: chriscool@tuxfamily.org, git@vger.kernel.org, jltobler@gmail.com Subject: [PATCH v2 2/8] clang-format: avoid spacing around bitfield colon Date: Thu, 11 Jul 2024 10:30:37 +0200 Message-ID: <20240711083043.1732288-3-karthik.188@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240711083043.1732288-1-karthik.188@gmail.com> References: <20240708092317.267915-1-karthik.188@gmail.com> <20240711083043.1732288-1-karthik.188@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The spacing around colons is currently not standardized and as such we have the following practices in our code base: - Spacing around the colon `int bf : 1`: 146 instances - No spacing around the colon `int bf:1`: 148 instances - Spacing before the colon `int bf :1`: 6 instances - Spacing after the colon `int bf: 1`: 12 instances Let's formalize this by picking the most followed pattern and add the corresponding style to '.clang-format'. Signed-off-by: Karthik Nayak --- .clang-format | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.clang-format b/.clang-format index 5e128519bf..803b274dd5 100644 --- a/.clang-format +++ b/.clang-format @@ -72,6 +72,10 @@ AlwaysBreakAfterReturnType: None BinPackArguments: true BinPackParameters: true +# Add no space around the bit field +# unsigned bf:2; +BitFieldColonSpacing: None + # Attach braces to surrounding context except break before braces on function # definitions. # void foo() From patchwork Thu Jul 11 08:30:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13730200 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9459B15748C for ; Thu, 11 Jul 2024 08:30:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686653; cv=none; b=oCQIravfP6J64hV/Txut3AqRWdnoqO8BmZZeqZc5Kin1CSrr01YejQa8xfI8O6pszYT47fOZ0lV2OYElnq4a7iwedEJa1GpqhTVqEWnoDWxPHSPEqCXBFgLaGd+Wgi+X/ytG3pinjwReO2wQHQpzxHnajBUvTOCaq63ebP50GBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686653; c=relaxed/simple; bh=d0q9Hxhdhih/ajxSMaLCUPyuyuLRA2BTAnO2lFVa1tQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F2eWuE4ni6iE+3fCg1ZlD3hFJ8413o2ADgLXXM+n3zy5xExe3+SWt+pmzZm0yVfUWnFzzoQQ+8LNV/BHMkBIApWnzi2TueA9BNhOonLKEipTXy800A157kkbKBjeQxKYb0On8R+gf6Ipnw9jnfGkL+XdANSy40HLrT+488YrsGU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CFuvEjRC; arc=none smtp.client-ip=209.85.208.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CFuvEjRC" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2ebe40673e8so7754211fa.3 for ; Thu, 11 Jul 2024 01:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720686650; x=1721291450; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0t/ESDNXetP4dVwGA6sk7uZ9qVhzzo6pAPar0bUuRKE=; b=CFuvEjRCYK3KYQBtcMnmHXi5qilOD6OA+ypxNvBk8A75r4QgVD070xFo0KFHLHzVrz c8F4Bo25fjEtlXW+fOIYU9mJqO2i+WAwN3Mhn9W7DFKVT64frJB/qp6dj3MxDMmTQt9F KuSZE7tevAQ2B/ThKKHS/zL2Xh7SOO9r7cL6bvbl9AxTdZ5nASxKIGcwNzcJJYyG+i1O Z8IVakSQlc77hkDS69u6Pm2CHlw5rrwz2O+j3+p0d0oEhuPWZeQuVXhS9veH8TVglEo0 y/rh+vO2MIU+k2dq+2zbmI9qELgGBcduNdAjuB+Py2uuabkLyIhxaQsx56avXoPE+zuR b7tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720686650; x=1721291450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0t/ESDNXetP4dVwGA6sk7uZ9qVhzzo6pAPar0bUuRKE=; b=Kl50ju3R1tU8KN/2gJCpCLQRnZfxgCGXKAnV0KnBXrol8pKvcnAHRg1emL4eXlVk/y ewggUGH7qC4GVdW+cKM64A8q29xxDkpV88lHXyxBvYx2xQu5iBLMtwe74prx+2Lsq8UF ul0qhDDQfo3dMXxnQN8kbiuSZggeR+6CVn3xJFH/NBDuap0gmCbFcGvWTLhOXRqa6+kH r1oOLhDY+ITHSTEgtlxYe0XCR3jHjmxrmaREQ+IdvF44EDC9MCOg6FUdZpZ846qUyvWY Uqe+vWPfeyWy1zmba8L5qepcKhUhUsjwb7Vd8Tv/Ccq0XNBv8BJd4D6kOcKCjQ/IGImi qmaA== X-Forwarded-Encrypted: i=1; AJvYcCUJpa97IV6Gh8RceAmswL9C/6vXuAJO8pIrDYlhtLH+u0zQrkbQS3P0Jod8FXt9x93J9U3M7bHVYQMbzrVBDy6e7+hH X-Gm-Message-State: AOJu0Yzj8XXMU38p1isU7yO5dgvG+tr4kfBlznVeIjoP2DcxwCfsLZeP xS4so26XBu5RLiX6eFB+MAcW8hvvo2FmaRRMZhJCW7iPz5NZdYRc X-Google-Smtp-Source: AGHT+IHGfp70fidAIQ0mAWrbmp94Ru1S7Z2ksNUk4sANKoKVf9WB39/qfipEeIY5vlQlLpfLps2x6g== X-Received: by 2002:a05:6512:3e0a:b0:52c:e1cd:39be with SMTP id 2adb3069b0e04-52eb9990eb3mr6270432e87.8.1720686649727; Thu, 11 Jul 2024 01:30:49 -0700 (PDT) Received: from laptop.fritz.box ([2a02:2455:826e:4900:8da7:30a3:c67a:daf8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d5101ffsm263674305e9.16.2024.07.11.01.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 01:30:49 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: chriscool@tuxfamily.org, git@vger.kernel.org, jltobler@gmail.com Subject: [PATCH v2 3/8] clang-format: ensure files end with newlines Date: Thu, 11 Jul 2024 10:30:38 +0200 Message-ID: <20240711083043.1732288-4-karthik.188@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240711083043.1732288-1-karthik.188@gmail.com> References: <20240708092317.267915-1-karthik.188@gmail.com> <20240711083043.1732288-1-karthik.188@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All our source files end with a newline, let's formalize in '.clang-format'. Signed-off-by: Karthik Nayak --- .clang-format | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.clang-format b/.clang-format index 803b274dd5..4c9751a9db 100644 --- a/.clang-format +++ b/.clang-format @@ -106,6 +106,9 @@ IndentCaseLabels: false # #endif IndentPPDirectives: AfterHash +# Insert a newline at end of file if missing +InsertNewlineAtEOF: true + # Don't indent a function definition or declaration if it is wrapped after the # type IndentWrappedFunctionNames: false From patchwork Thu Jul 11 08:30:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13730201 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9C8C15958A for ; Thu, 11 Jul 2024 08:30:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686654; cv=none; b=BuTZgkswWGM7ixI1avd2bIlCToZaiO7/2hXCfw+TfJ6BFLmIt+ItUWBbql4QSIaxCzUv5lgz1sIrl+l+xdG2E4mRxNfhPFiLbYoOfRjOkYEtc/UpUUGblOVWLzYeUAYnl3oP1CQNcN+Fzw+f1n/uoTgdmpFXw2CmZI6QnU8kzWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686654; c=relaxed/simple; bh=dsalWAx03TwmHNKuDDxxXM6DZF3G7lGrB7wXLyX6BuA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pjGs3oPluZz4B2fXe8QCAvRdrojpifBulrvRoX809FLrNDb4Pl94RujR1Il7ZZQeaOaPgikGT/mwbKgaMgX3xsb2P84WznhFmmQiL23Ri7bMDYwTnHsSzojiyjbcSqbdWChAWL9AR3dItqaTXXX0BG5ekorMFHXIRN94JNEAB5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VmzUDd+R; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VmzUDd+R" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-52ccc40e72eso624065e87.3 for ; Thu, 11 Jul 2024 01:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720686651; x=1721291451; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8JHGziRgakNVZ5DwXy91iJK9uggV/+EZQns1CJL4VNw=; b=VmzUDd+R+CmJvltfM/O7AaV61sT64QQuNuK363RyaCRbUwwuthavn0lH97ARb5GPYv /sa+ZR6xQhaMSpMHvHnYNfB4ud/14+Hvpw7gd/xa7XrvfaDGxc2o7dQE9uuLESFujkC7 CV5TONrjiXGIXscFpvxijTQU5s9woZqyMizQdmLvl8l9otgxjTZmm6RlsxOMccvdpg8w mJ6B7cG9YvVJWdF1W8kLEhrdmxCLfwAXtaGG88BbqfabkEfdN7CExOxR9genhPZkZbtp hprFH43FjrbcpcVj7gZ5fZQvag+05SjUSozLZj4O22NlGlZQ5E61MSf/w5CrOTiosKW2 uBxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720686651; x=1721291451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8JHGziRgakNVZ5DwXy91iJK9uggV/+EZQns1CJL4VNw=; b=bUfCh0jJ+vlwq4la1F+jnIf9B2OXDJbxb/vdPGk0qa7U5qldXTYnNqoh5Y9PrIAnvg 1aS+7PKxrwTBkCr7pQ4nbwYVR0xvBqz95hQpI5Ic3AFMot5410T3/XQ/Agd5D2b0ixYa Mj3UlBgViexgd7DTuR493t0+4VmEG/FKWLdaWBBETdnjGI5CFB+GEbZ+bW8uRlSSxWae Rlp1f0kDRNqRGNVGR73YT0i4wRlaqY2/4Tk8EbAA6vOYu1vlREROQ6EMMjYfITjD1FWc 0cE36HUF/yZjUd8vjM3bQPbWfKEux5H3wJYMtmmRHOEnrdF7hA2sZL/c7RgNvDmCWzAv uKZA== X-Forwarded-Encrypted: i=1; AJvYcCXre/wVgwQNoICYGVZ3mzWJEt2zWovi8SH7XSHrsR5l7c5CISk8dSFNSMSodOEvQDkNZVVLRrytC91nIKtMKFBFFdQl X-Gm-Message-State: AOJu0YxYFIDafohPD4iq+5d4N5WssHk4GmntuYXJBI5b6E1J6UplNKic KscenRzs9simhxiQ/k1chkqw5SJsxN1LG2y8qJsQ12RCvFyAkwix X-Google-Smtp-Source: AGHT+IEipRBLBbBPAPaSRkGUZgPBXcZsTL3hjd4VmZUJie00718QNJNQyb0XUAa+8F+6oVf7/RHdTA== X-Received: by 2002:a05:6512:3f14:b0:52c:df55:e11a with SMTP id 2adb3069b0e04-52eb9990a43mr6197014e87.9.1720686650820; Thu, 11 Jul 2024 01:30:50 -0700 (PDT) Received: from laptop.fritz.box ([2a02:2455:826e:4900:8da7:30a3:c67a:daf8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d5101ffsm263674305e9.16.2024.07.11.01.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 01:30:50 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: chriscool@tuxfamily.org, git@vger.kernel.org, jltobler@gmail.com Subject: [PATCH v2 4/8] clang-format: replace deprecated option with 'SpacesInParens' Date: Thu, 11 Jul 2024 10:30:39 +0200 Message-ID: <20240711083043.1732288-5-karthik.188@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240711083043.1732288-1-karthik.188@gmail.com> References: <20240708092317.267915-1-karthik.188@gmail.com> <20240711083043.1732288-1-karthik.188@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace the deprecated options 'SpacesInParentheses' and 'SpaceInEmptyParentheses' with the newer 'SpacesInParens' option. The usage is the same. Signed-off-by: Karthik Nayak --- .clang-format | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.clang-format b/.clang-format index 4c9751a9db..914254a29b 100644 --- a/.clang-format +++ b/.clang-format @@ -134,8 +134,6 @@ SpaceBeforeAssignmentOperators: true # } SpaceBeforeParens: ControlStatements -# Don't insert spaces inside empty '()' -SpaceInEmptyParentheses: false # The number of spaces before trailing line comments (// - comments). # This does not affect trailing block comments (/* - comments). @@ -149,9 +147,10 @@ SpacesInCStyleCastParentheses: false # var arr = [1, 2, 3]; not var arr = [ 1, 2, 3 ]; SpacesInContainerLiterals: false -# Don't insert spaces after '(' or before ')' -# f(arg); not f( arg ); -SpacesInParentheses: false +SpacesInParens: Custom +SpacesInParensOptions: + # Don't insert spaces inside empty '()' + InEmptyParentheses: false # Don't insert spaces after '[' or before ']' # int a[5]; not int a[ 5 ]; From patchwork Thu Jul 11 08:30:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13730202 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DF3A15A85A for ; Thu, 11 Jul 2024 08:30:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686655; cv=none; b=RV6eD5GX0i+uxSFtZJ0LpwLiSONWrJ3xoOlX4cxMDYHcTbakNzskk8fRRdtgA5Pg1Mi+fxcVJM6KZcEYuFGbPMon4s9bzS7x+QDC9ShtirGV4GCEYGUkZ0AjaexPAJwHjALyw+xFhAWRoJDLLB74zr1ypjtZDJZyr0JiXDoB6V0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686655; c=relaxed/simple; bh=l/bCZ2nQCD51Vyf7/ppVO0qTgHjKql4gqWdHIKsfGBw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=erutsLQUTCcIcsaIotpsaL1cRzqEF8p6v//rX/bAbMPdNo8yFwzKkn4oeMf530U1eqoQDQMFjI4XuDrq3ABkd5vtvfA43NkF8BvXM++EAqeSbA48e3TpDhQIb0gjE/IuLnVd9GP37dqjtJIeVCQbKESHDS6N0JqXFVfifwWt1vE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UzI8NQJq; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UzI8NQJq" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4267300145eso4474825e9.3 for ; Thu, 11 Jul 2024 01:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720686652; x=1721291452; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EhPRA31PDZWjbSgGlA4xgt4ufhqIBBG2ud74E0XLVhg=; b=UzI8NQJq7jsiUi+mlBr/yFWxFOjQ17CAIFd1QDKbCV24NUH1blYRGXAbyi0xVOvVa1 ZHEZbFKbPi+quKz+41ReRfRISGU2gfKnCLb/u0R5LO64sgth/Ae4tAuuJWNYSNztD9E1 o6sGMSQL+mI7SXVf7DrYUZoElHlK9qknc3z1cCJ5RKUqjuVcAVSydygQRwLAvn/4F0wn gIxuoGIEzxhPQtaJtK9R/VBscqUe9eSy6E3N30ZoB6vTHvaqx5M5ZVW85/U6NwGgEgTy jMNHF+jomIVvFUTQgGT5wETzqeTjttkiCzvD+Mcm18XtPuhdjq0G6p3RjNyOtrhLjc3w feKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720686652; x=1721291452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EhPRA31PDZWjbSgGlA4xgt4ufhqIBBG2ud74E0XLVhg=; b=JsZU8plFKTs5T6UcXAUAagjPnU9pOhn0CQr1JCD+2ZaQtoKZxJXW4vg4WQz7w0hm6x Xa3x/hnthuc7JPca70fmc6IpvAGhOxl32rWuvGX/gN0ELiJEOAkKgj7DIFoD+thyEaKv X/AzWyowohsJv/5hf/RHMmgV4nj1pDxraJgqXWfqiBIDhZA+FvRqol/4vXZWTnrhmqoD Gi+ZZEedUbh8Hlbm2fkHhnTJMCO5ENos8FMKrbRpT/7GBKTuK9HmwSuJTlTFs4gDbM/f 515DVIPBKsQjbiIfK8xPzI5sqDzCzsI6xqVoqu4+0ucsPj27p94mDL+Dmk55eiIvsbWp MMSA== X-Forwarded-Encrypted: i=1; AJvYcCVcpuUr3FqPLNM5URVc28mqrrjVlqAROF5PU4U7MNKdZIVTUhSRTEDJ+xcLT9OogBq0GQ+99Nt607fnYU/e4+gCvIdS X-Gm-Message-State: AOJu0YwkXRpm3iuv6C3YDauAt1ij6kiaOVMWFS742bRXd+G+vmbxXJSF vJTt5FIQau5TNfULE1IF4GmQMOGY4LGq2FbQA4eSYKy6wVb69QYW X-Google-Smtp-Source: AGHT+IFzYQHLJsF7+bOoafb9E/M4Te3wPxgqPzAXGHZAOBPxoZko2v5Pv8UlQ+8He1I81TaZko323g== X-Received: by 2002:a05:600c:4baa:b0:426:5e1c:1ac2 with SMTP id 5b1f17b1804b1-426706c656bmr73012895e9.8.1720686651668; Thu, 11 Jul 2024 01:30:51 -0700 (PDT) Received: from laptop.fritz.box ([2a02:2455:826e:4900:8da7:30a3:c67a:daf8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d5101ffsm263674305e9.16.2024.07.11.01.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 01:30:51 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: chriscool@tuxfamily.org, git@vger.kernel.org, jltobler@gmail.com Subject: [PATCH v2 5/8] clang-format: avoid braces on simple single-statement bodies Date: Thu, 11 Jul 2024 10:30:40 +0200 Message-ID: <20240711083043.1732288-6-karthik.188@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240711083043.1732288-1-karthik.188@gmail.com> References: <20240708092317.267915-1-karthik.188@gmail.com> <20240711083043.1732288-1-karthik.188@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Set the 'RemoveBracesLLVM' to 'true' which ensures that we avoid curly braces for single-statement bodies in conditional blocks. This option does come with two warnings: This option will be renamed and expanded to support other styles. and Setting this option to true could lead to incorrect code formatting due to clang-format’s lack of complete semantic information. As such, extra care should be taken to review code changes made by this option. The latter seems to be of concern. But since we only use clang-format to verify the format and not to apply formatting, we should be okay here. Signed-off-by: Karthik Nayak --- .clang-format | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.clang-format b/.clang-format index 914254a29b..8b75dece80 100644 --- a/.clang-format +++ b/.clang-format @@ -117,6 +117,12 @@ IndentWrappedFunctionNames: false # int *a; PointerAlignment: Right +# Remove optional braces of control statements (if, else, for, and while) +# according to the LLVM coding style. This avoids braces on simple +# single-statement bodies of statements but keeps braces if one side of +# if/else if/.../else cascade has multi-statement body. +RemoveBracesLLVM: true + # Don't insert a space after a cast # x = (int32)y; not x = (int32) y; SpaceAfterCStyleCast: false From patchwork Thu Jul 11 08:30:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13730203 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5719153BE3 for ; Thu, 11 Jul 2024 08:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686656; cv=none; b=VMQrxa1HiY9E9Ag9j4O62gM8KuMDnxTWGaYvPexUmygHuyAvXIDS2PHrVweFFCcLmeV/1XDQAtLCHVDSSdwHQollnC6FavQpNA3Ok5GC3hr30jERWLQcMSile+IAuiJKiaBr/A+8fZHDYmjiSXN5AnARqHrQ2gfK7pkH29TOG5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686656; c=relaxed/simple; bh=u25MHxFbUMXfobTAGFyum73U1eoSzRc74Yujbm8b2l0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FnB9HK0ud70h6At3ntZM1Q9Ze+iICTRNnHhGbwpvqqS4/QU+QOA+30p883+fvbS6vJLfHEN8iCtl1kUGtsiV2t/tiIUoQ/roE6v+9wBisg+AVZAc0DURW0EU+PuZmxtf5WBRnKcD7uXMG7JhThqDc0zHJeiU1EUbayOIagIwuAQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZJoVRK5r; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZJoVRK5r" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-52ea1a69624so658174e87.1 for ; Thu, 11 Jul 2024 01:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720686653; x=1721291453; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X1u1o+N5vSVgFYhRMq+X3dfA7azT3SjflSgKv/BgltM=; b=ZJoVRK5rZr22C3rOLlOU+o83/W+P4mt/pIWTpOvLQpKaeBzs+IV4IglnssJaESEIJF W79t/eGddvufKd51bGGFu67l4r9iPL7jQf2QRnLQHBM9CoXkv+p0iPqt8jBV08HWVwmu PwB4OcvSYI63Yz8l6WFxKuvDD8cd/50SJ68frZ0Krl80XpZQsbilrKiDzqA0WjsmUW1+ FqQRAHv37+x00iuEXuI/KPHFLnxLWIDWTnq4J4nEgZHaaDBJrOa12qIAYIDFt6ccZOOQ 7/YsB30sLBdIDlbny3FkvIt167Q2SPHdYuMlcrq/Vn7DpqotkxQgVNwxXoBHKHXU4jGE rh3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720686653; x=1721291453; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X1u1o+N5vSVgFYhRMq+X3dfA7azT3SjflSgKv/BgltM=; b=taz9nqSt+8TAS48HP3sRolJAIjRj/14EQ0At8B9M6ktdPtxXPW7KEUYmabKUqUT1go Z5DkzV9FvlIGgO4PNacepwJb8qsbNMw7QPtRlXtYiA/wVKacCi1pT3RhSE2XzHkOy072 XREOT/USc9iUWF55fnHdso/hvNvTA1kldXEc+/3ENGmm3rBafpyIh8WQoZ+3luEo1pcM EHcizqGQjN8zpMuaLel2Hjs0GeixpYCcoFNhZs44nbkF6cgZVqYDNGpQu7Ta/GSF7T69 6oJ4QsxGUSCg19CTJiAoGk4itipTmV6wCD7X/qHKtkd8LaCMux/zZ1sA2T1Yz481DYBO MRkg== X-Forwarded-Encrypted: i=1; AJvYcCWcLjqC0nQWwBVShzC3EAGE40Yyr9R1HpZX3QOEe0xfZiH/+UfkltkqWxvmRXVFLHEGQBAxxoL79fI6+clj2ZE0TS7u X-Gm-Message-State: AOJu0YwarNClNq//rOxHGycj+q86gXcdvBvlXsjKg/FOP0zYQpv+9x9j UnnzhHQV0ybZ3hEsQa7vZ7/N/O+s8jgquGkkqM7hC7UwvSlRgDbL X-Google-Smtp-Source: AGHT+IEznOPg/60ATREFuds5h5EKUladpoqpa9I3PNZ3ONMiWYvMeSyeKZ6XvDz0Uk+LpZMfWzK3HQ== X-Received: by 2002:a05:6512:ac9:b0:52e:a008:8f55 with SMTP id 2adb3069b0e04-52eb99a0983mr4860222e87.41.1720686652559; Thu, 11 Jul 2024 01:30:52 -0700 (PDT) Received: from laptop.fritz.box ([2a02:2455:826e:4900:8da7:30a3:c67a:daf8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d5101ffsm263674305e9.16.2024.07.11.01.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 01:30:52 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: chriscool@tuxfamily.org, git@vger.kernel.org, jltobler@gmail.com Subject: [PATCH v2 6/8] clang-format: formalize some of the spacing rules Date: Thu, 11 Jul 2024 10:30:41 +0200 Message-ID: <20240711083043.1732288-7-karthik.188@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240711083043.1732288-1-karthik.188@gmail.com> References: <20240708092317.267915-1-karthik.188@gmail.com> <20240711083043.1732288-1-karthik.188@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are some spacing rules that we follow in the project and it makes sense to formalize them: * Ensure there is no space inserted after the logical not '!' operator. * Ensure there is no space before the case statement's colon. * Ensure there is no space before the first bracket '[' of an array. * Ensure there is no space in empty blocks. Signed-off-by: Karthik Nayak --- .clang-format | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.clang-format b/.clang-format index 8b75dece80..68c10f03da 100644 --- a/.clang-format +++ b/.clang-format @@ -127,11 +127,18 @@ RemoveBracesLLVM: true # x = (int32)y; not x = (int32) y; SpaceAfterCStyleCast: false +# No space is inserted after the logical not operator +SpaceAfterLogicalNot: false + # Insert spaces before and after assignment operators # int a = 5; not int a=5; # a += 42; a+=42; SpaceBeforeAssignmentOperators: true +# Spaces will be removed before case colon. +# case 1: break; not case 1 : break; +SpaceBeforeCaseColon: false + # Put a space before opening parentheses only after control statement keywords. # void f() { # if (true) { @@ -140,6 +147,13 @@ SpaceBeforeAssignmentOperators: true # } SpaceBeforeParens: ControlStatements +# No space before first '[' in arrays +# int a[5][5]; not int a [5][5]; +SpaceBeforeSquareBrackets: false + +# No space will be inserted into {} +# while (true) {} not while (true) { } +SpaceInEmptyBlock: false # The number of spaces before trailing line comments (// - comments). # This does not affect trailing block comments (/* - comments). From patchwork Thu Jul 11 08:30:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13730205 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92B1015AADE for ; Thu, 11 Jul 2024 08:30:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686658; cv=none; b=NtVtpIx1gudUmIxEQB2DXNVY2/lc54LD2es7TFC3+FKHorekYC0dK1pcmBjMJMhvHoKYkbidd/i7rndeYO+5Wbj6T4Hqot58sc+oHZvsmqqfBXdVwq1qbOI64M8booJTQRnVIvifAs7avV1Qux48+frkySXEbivnK4Ov/PUaFBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686658; c=relaxed/simple; bh=FY7iq+o9Jdlvx6uO13rMRxAKbPkrnBgYppJ6U9yNyfA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jh5veXd/i4jfAUUNjl4icvzzT3TDxOgKHUizzVLJzmXrBDkAsqVy4AWjSUKrhr6TF2lGS2+fuxGrIah/nmaz3nuydNTe1bsO755bHNJEhAVuivfXwEymbHu+EgUVs3ksh7nEglE0uAmgvLUukaybeczhS1sHZy2AVW6+pojbI9w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mMa+KVRC; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mMa+KVRC" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2eebc76119aso6835781fa.2 for ; Thu, 11 Jul 2024 01:30:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720686654; x=1721291454; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=L5SUSF9m7+RPYWOPd0jRlpGmlM9LjgaKphpw+G8CHMY=; b=mMa+KVRCoGcL13Sw0FlctGSNVdXyGXBH0T674jIQaUckq5stlBBj4ridUnl5yzZacn JUQzs2Ejj3CisSNJaemUopIsKU88Awg5CTTyi7Y/2+Lhdso0rixg3/KkT1db31vmMW0B Iv0xpucMKiRUigBXhr/w5tKlZ1XoidFGUMNZfkC+kKLM3oGsMltTQZUH3blA7+eMj26/ Nt5Fmzs7sKv/tGNL9ViUGY7BScsqH3dlY0u36Atmv/wvm17r+Tp3Y9b72w//+aU4X17s piWLB1HxrwYOxHUgXUDH1/ed1h/gb/YZt0AfydZSEAoBjOVMgP70WnmxdKqJuA8cGYCj unqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720686654; x=1721291454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L5SUSF9m7+RPYWOPd0jRlpGmlM9LjgaKphpw+G8CHMY=; b=jbTJbntc7xGkDxH60ZHwaixVtHsPtE6GT1QE+5a9RouSUaRLTL9GYmnfOv+ULWnXou OlwTqMSOA4VJz8/ewRp+tKT84ewjweeNAcD5Zeah0/BwU8PyXpTzITZkSNs8xQHWw9tS jcJBWDDSyDaYvXDNb7hEO2p6/CZGPNaggnZmGDNSmK91naNpRVQDDkjnS1yDnbIEgA0h 0ElFSh+tF3PXNIqifr+nbXGR9abQodnC4ZVEuK1q3zFjNriNKT/T+ag4w7ogQWa5Hv9/ r4+kgUeX2CjFE2LACmuHjnUD18fPLAnYWCaBxXShdrjfUFleKi4jwT77DFIxJf8lk4vJ NLVA== X-Forwarded-Encrypted: i=1; AJvYcCWkAWWUMTsM3RewFj7IbDx4Cg0thfbc7pxF56+30NuL19McaN84zp3+Cy2arEmi8tXt9iqFdCxX2yPYOuSTJSxJSD7d X-Gm-Message-State: AOJu0YxCitojn2krHqnBe26TgcFVZi6J59/4RgYKO4GAEGddAnfZ2N6P KG2OA2jhwkvjjoDo3ZTFFEgkRCPhrSoQjIvwo4WdQZ+O2Y3SfV20 X-Google-Smtp-Source: AGHT+IHUafPQiBQzkXT5erPC6+td211BpeZrNG9XGXqIikQVEkY02ZjrnYjj09JcUxZ8QDYpFkvx3Q== X-Received: by 2002:a05:651c:1a0f:b0:2ec:5ff1:2274 with SMTP id 38308e7fff4ca-2eeb31027acmr72220461fa.25.1720686653454; Thu, 11 Jul 2024 01:30:53 -0700 (PDT) Received: from laptop.fritz.box ([2a02:2455:826e:4900:8da7:30a3:c67a:daf8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d5101ffsm263674305e9.16.2024.07.11.01.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 01:30:53 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: chriscool@tuxfamily.org, git@vger.kernel.org, jltobler@gmail.com Subject: [PATCH v2 7/8] ci: run style check on GitHub and GitLab Date: Thu, 11 Jul 2024 10:30:42 +0200 Message-ID: <20240711083043.1732288-8-karthik.188@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240711083043.1732288-1-karthik.188@gmail.com> References: <20240708092317.267915-1-karthik.188@gmail.com> <20240711083043.1732288-1-karthik.188@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We don't run style checks on our CI, even though we have a '.clang-format' setup in the repository. Let's add one, the job will validate only against the new commits added and will only run on merge requests. Since we're introducing it for the first time, let's allow this job to fail, so we can validate if this is useful and eventually enforce it. For GitLab, we use the 'CI_MERGE_REQUEST_TARGET_BRANCH_SHA' variable by default to obtain the base SHA of the merged pipeline (which is only available for merged pipelines [1]). Otherwise we use the 'CI_MERGE_REQUEST_DIFF_BASE_SHA' variable. [1]: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#predefined-variables-for-merge-request-pipelines Signed-off-by: Karthik Nayak --- .github/workflows/check-style.yml | 29 +++++++++++++++++++++++++++++ .gitlab-ci.yml | 17 +++++++++++++++++ ci/install-dependencies.sh | 2 +- ci/run-style-check.sh | 8 ++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/check-style.yml create mode 100755 ci/run-style-check.sh diff --git a/.github/workflows/check-style.yml b/.github/workflows/check-style.yml new file mode 100644 index 0000000000..27276dfe5e --- /dev/null +++ b/.github/workflows/check-style.yml @@ -0,0 +1,29 @@ +name: check-style + +# Get the repository with all commits to ensure that we can analyze +# all of the commits contributed via the Pull Request. + +on: + pull_request: + types: [opened, synchronize] + +# Avoid unnecessary builds. Unlike the main CI jobs, these are not +# ci-configurable (but could be). +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check-style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: git clang-format + continue-on-error: true + id: check_out + run: | + ./ci/run-style-check.sh \ + "${{github.event.pull_request.base.sha}}" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 37b991e080..dc43fc8ba8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -123,6 +123,23 @@ check-whitespace: rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' +check-style: + image: ubuntu:latest + allow_failure: true + variables: + CC: clang + before_script: + - ./ci/install-dependencies.sh + script: + - | + if [ -z ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA} ]; then + ./ci/run-style-check.sh "$CI_MERGE_REQUEST_DIFF_BASE_SHA" + else + ./ci/run-style-check.sh "$CI_MERGE_REQUEST_TARGET_BRANCH_SHA" + fi + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + documentation: image: ubuntu:latest variables: diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh index 6ec0f85972..46fe12a690 100755 --- a/ci/install-dependencies.sh +++ b/ci/install-dependencies.sh @@ -43,7 +43,7 @@ ubuntu-*) make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \ tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \ libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \ - ${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE + ${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE clang-format mkdir --parents "$CUSTOM_PATH" wget --quiet --directory-prefix="$CUSTOM_PATH" \ diff --git a/ci/run-style-check.sh b/ci/run-style-check.sh new file mode 100755 index 0000000000..76dd37d22b --- /dev/null +++ b/ci/run-style-check.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# Perform style check +# + +baseCommit=$1 + +git clang-format --style file --diff --extensions c,h "$baseCommit" From patchwork Thu Jul 11 08:30:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: karthik nayak X-Patchwork-Id: 13730204 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3F9515574D for ; Thu, 11 Jul 2024 08:30:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686658; cv=none; b=ZBXAcCsvtzz9HQH00sK80+cAhPm3JnbpCbP+AW0dYgR9AJ60KqJVUpMrGT5zRFdgOl1mgyOZXim8aQA4zk38oG9iasY/ic4L4IIcNac5TWieoUv+g2QGkUCMgZu/lWoTeB192MTbeaV0W0wUvvPFWKoSKY5276uUEBPGryn2KgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686658; c=relaxed/simple; bh=CSQ0u7etAcdVs017iyF3YWM1rAywySyLUZsB6v92Cwc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GFi6IMC5WjXiIVy2Bjn38GjyliANc/24t9MtsnSp+BrFSVgmK05cKUcKmtFABOFR1Lw9cqzQfyF2Ock8YTiGN2o9vYWwoZ6EC1iQIPkapRG9lLVc0oQP0BDMcdxojDzCouiHr6AkTfLKSJ7W60eN59SLV/2JPrH2nMikunBCjmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZRZfUwvM; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZRZfUwvM" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4266ea6a488so4549535e9.1 for ; Thu, 11 Jul 2024 01:30:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720686654; x=1721291454; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o55qjhraTQAh5EzcD56XmIAzotfofXcwPCRhRDMUfZo=; b=ZRZfUwvMmDIeh5fqrhF7dDDQDlTgQHpHMqIuovgABdtb30bbIuYIWdNzbFmYGly+X/ bBv2wjDXvXAtwPCnsNGXe19JaeaFh9RrvCqHT2cNuyhK5vpZJ/i/fA5sdwLSBNZmv6CN z0NIrE2eCF11l2XW//5X2XaB7ijxsAc2+TKj8biR0Qnk2v9WEOxqy9BnC4CfidScMGP2 3G3OfNTFcLOM1JoW21RoCEfwnS110zMWQsNyKM7lRMxb5EXhSRa97xiHXhi+PKMxOe6h OQuEHMOsfpjz7uP65QHqP6cSDzBRPi0MXRXI8rQ0Tu2uQjAiBd2/zjyJt8rqtwI75sP6 7UvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720686654; x=1721291454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o55qjhraTQAh5EzcD56XmIAzotfofXcwPCRhRDMUfZo=; b=JTELF691jFFZAvxAe6Ku+m8u0VyNe/1Wt9dp3eKP+Dc2puVtXbKsFPCFqtY0SuD7kn 6WjnBL6xPqyAMp1nTYPPOPMrmmm49Q/JXB+MfrCxpymfW2RIjoTUr2KgTRGjBqyY8KSi Stvv7PMoZWgCcMrEpCXRRz03CX6YvdmtqvIgGQeQYpR+fdKNmExW7EitkRHfOwog5JmO YWPj5PgzgfTupKy8e6CXwbAY7vsBbbgpwgUPytTlkVg/AjwP1QCE1/OHG0KKliDHN2nK mhnsKFHOdSuE40zux0EozSVleeokb/fu+MCb7NPftVssmUS2iyFWVlKcA3uDSzaqs+a5 bx0A== X-Forwarded-Encrypted: i=1; AJvYcCXwfNVQQloepZaVWhh2sH7Xw9W6OvoCp4IBT1M71iX1muhc67uLPrefoZdoDCfWguAsXFgmHdFmursprvzY3nj2bpnQ X-Gm-Message-State: AOJu0YwMH/IigDeVca2G13EEF9O0CG0SWE2r82ok1L3WsivV+oTjE9iL G0+srPqUPyIdsIBwS70em24rJT3OSAfOCfiAKQ6sViV6URSVWITPtWceSXKX X-Google-Smtp-Source: AGHT+IHu+SfzZElOEbhaAXWPuUReVG3DXH7nUropGkij6ASfhuksMcZPdXli9qKN9I7jLO2Py9Cc/A== X-Received: by 2002:a5d:47a7:0:b0:360:75b1:77fb with SMTP id ffacd0b85a97d-367cea46438mr8266750f8f.8.1720686654332; Thu, 11 Jul 2024 01:30:54 -0700 (PDT) Received: from laptop.fritz.box ([2a02:2455:826e:4900:8da7:30a3:c67a:daf8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d5101ffsm263674305e9.16.2024.07.11.01.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 01:30:53 -0700 (PDT) From: Karthik Nayak To: karthik.188@gmail.com Cc: chriscool@tuxfamily.org, git@vger.kernel.org, jltobler@gmail.com Subject: [PATCH v2 8/8] check-whitespace: detect if no base_commit is provided Date: Thu, 11 Jul 2024 10:30:43 +0200 Message-ID: <20240711083043.1732288-9-karthik.188@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240711083043.1732288-1-karthik.188@gmail.com> References: <20240708092317.267915-1-karthik.188@gmail.com> <20240711083043.1732288-1-karthik.188@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The 'check-whitespace' CI script exits gracefully if no base commit is provided or if an invalid revision is provided. This is not good because if a particular CI provides an incorrect base_commit, it would fail successfully. This is exactly the case with the GitLab CI. The CI is using the "$CI_MERGE_REQUEST_TARGET_BRANCH_SHA" variable to get the base commit SHA, but variable is only defined for _merged_ pipelines. So it is empty for regular pipelines [1]. This should've failed the check-whitespace job. Let's fallback to 'CI_MERGE_REQUEST_DIFF_BASE_SHA' if "CI_MERGE_REQUEST_TARGET_BRANCH_SHA" isn't available in GitLab CI, similar to the previous commit. Let's also add a check for incorrect base_commit in the 'check-whitespace.sh' script. While here, fix a small typo too. [1]: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#predefined-variables-for-merge-request-pipelines Signed-off-by: Karthik Nayak --- .gitlab-ci.yml | 7 ++++++- ci/check-whitespace.sh | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc43fc8ba8..c5a18f655a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -119,7 +119,12 @@ check-whitespace: before_script: - ./ci/install-dependencies.sh script: - - ./ci/check-whitespace.sh "$CI_MERGE_REQUEST_TARGET_BRANCH_SHA" + - | + if [ -z ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA} ]; then + ./ci/check-whitespace.sh "$CI_MERGE_REQUEST_DIFF_BASE_SHA" + else + ./ci/check-whitespace.sh "$CI_MERGE_REQUEST_TARGET_BRANCH_SHA" + fi rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' diff --git a/ci/check-whitespace.sh b/ci/check-whitespace.sh index db399097a5..c40804394c 100755 --- a/ci/check-whitespace.sh +++ b/ci/check-whitespace.sh @@ -9,7 +9,7 @@ baseCommit=$1 outputFile=$2 url=$3 -if test "$#" -ne 1 && test "$#" -ne 3 +if test "$#" -ne 1 && test "$#" -ne 3 || test -z "$1" then echo "USAGE: $0 [ ]" exit 1 @@ -21,6 +21,12 @@ commitText= commitTextmd= goodParent= +if ! git rev-parse --quiet --verify "${baseCommit}" +then + echo "Invalid '${baseCommit}'" + exit 1 +fi + while read dash sha etc do case "${dash}" in @@ -67,7 +73,7 @@ then goodParent=${baseCommit: 0:7} fi - echo "A whitespace issue was found in onen of more of the commits." + echo "A whitespace issue was found in one or more of the commits." echo "Run the following command to resolve whitespace issues:" echo "git rebase --whitespace=fix ${goodParent}"