From 16ad8c0159383b0ecee7c97119e3d61f1038f56a Mon Sep 17 00:00:00 2001
From: Adrian Fleiszer <39962275+adrian-fleiszer@users.noreply.github.com>
Date: Wed, 2 Feb 2022 05:31:05 +0100
Subject: [PATCH 1/2] [Keyboard] Add YMDK sp64 VIA support (#16152)

---
 keyboards/ymdk/sp64/keymaps/via/keymap.c | 78 ++++++++++++++++++++++++
 keyboards/ymdk/sp64/keymaps/via/rules.mk |  2 +
 2 files changed, 80 insertions(+)
 create mode 100644 keyboards/ymdk/sp64/keymaps/via/keymap.c
 create mode 100644 keyboards/ymdk/sp64/keymaps/via/rules.mk

diff --git a/keyboards/ymdk/sp64/keymaps/via/keymap.c b/keyboards/ymdk/sp64/keymaps/via/keymap.c
new file mode 100644
index 0000000000..14a0e5f1f8
--- /dev/null
+++ b/keyboards/ymdk/sp64/keymaps/via/keymap.c
@@ -0,0 +1,78 @@
+/* Copyright 2021 Adrian Fleiszer (@adrian-fleiszer)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include QMK_KEYBOARD_H
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Keymap 0: Basic layer
+ *
+ * ┌-----┬-----┬-----┬-----┬-----┬-----┬-----┐    ┌-----┬-----┬-----┬-----┬-----┬-----┬----------┐
+ * │ Esc │  1  │  2  │  3  │  4  │  5  │  6  │    │  7  │  8  │  9  │  0  │  -  │  =  │ BkSp     │
+ * ├-----┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┘ ┌--┴-----┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┴--┬-------┤
+ * │ Tab    │  Q  │  W  │  E  │  R  │  T  │    │  Y  │  U  │  I  │  O  │  P  │  [  │  ]  │ \     │
+ * ├--------┴┬----┴┬----┴┬----┴┬----┴┬----┴┐   └┬----┴┬----┴┬----┴┬----┴┬----┴┬----┴┬----┴-------┤
+ * │ Caps    │  A  │  S  │  D  │  F  │  G  │    │  H  │  J  │  K  │  L  │  ;  │  '  │ Enter      │
+ * ├---------┴┬----┴┬----┴┬----┴┬----┴┬----┴┐   └┬----┴┬----┴┬----┴┬----┴┬----┴┬----┴┬-----┬-----┤
+ * │ LShift   │  Z  │  X  │  C  │  V  │  B  │    │  N  │  M  │  <  │  >  │  ?  │ Sft │ Up  │ Del │
+ * ├------┬---┴-┬---┴--┬--┴-----┴----┬┴----┬┘   ┌┴-----┴-----┴--┬--┴----┬┴-----┼-----┼-----┼-----┤
+ * │ Ctrl │ Win │ Alt  │             │ Fn  │    │               │ Alt   │ Win  │ Lft │ Dwn │ Rgt │
+ * └------┴-----┴------┴-------------┴-----┘    └---------------┴-------┴------┴-----┴-----┴-----┘
+ */
+[0] = LAYOUT(
+  KC_ESC,  KC_1,    KC_2,    KC_3,     KC_4,    KC_5,     KC_6,               KC_7, KC_8,    KC_9,    KC_0,      KC_MINUS,    KC_EQUAL,    KC_BSPACE,
+  KC_TAB,  KC_Q,    KC_W,    KC_E,     KC_R,    KC_T,               KC_Y,     KC_U, KC_I,    KC_O,    KC_P,      KC_LBRACKET, KC_RBRACKET, KC_BSLS,
+  KC_CAPS, KC_A,    KC_S,    KC_D,     KC_F,    KC_G,               KC_H,     KC_J, KC_K,    KC_L,    KC_SCOLON, KC_QUOTE,                 KC_ENTER,
+  KC_LSFT, KC_Z,    KC_X,    KC_C,     KC_V,    KC_B,               KC_N,     KC_M, KC_COMM, KC_DOT,  KC_SLSH,   KC_RSFT,     KC_UP,       KC_DEL,
+  KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE,          MO(1),            KC_SPACE,         KC_RALT, KC_RGUI,            KC_LEFT,     KC_DOWN,     KC_RIGHT
+  ),
+/* Function
+ *
+ * ┌-----┬-----┬-----┬-----┬-----┬-----┬-----┐    ┌-----┬-----┬-----┬-----┬-----┬-----┬----------┐
+ * │  `  │ F1  │  F2 │ F3  │ F4  │ F5  │ F6  │    │ F7  │ F8  │ F9  │ F10 │ F11 │ F12 │          │
+ * ├-----┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┘ ┌--┴-----┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┴--┬-------┤
+ * │        │     │     │     │     │     │    │     │     │     │     │     │     │     │       │
+ * ├--------┴┬----┴┬----┴┬----┴┬----┴┬----┴┐   └┬----┴┬----┴┬----┴┬----┴┬----┴┬----┴┬----┴-------┤
+ * │         │     │     │     │     │     │    │     │     │     │     │     │     │            │
+ * ├---------┴┬----┴┬----┴┬----┴┬----┴┬----┴┐   └┬----┴┬----┴┬----┴┬----┴┬----┴┬----┴┬-----┬-----┤
+ * │          │     │     │     │     │     │    │     │     │     │     │     │     │     │     │
+ * ├------┬---┴-┬---┴--┬--┴-----┴----┬┴----┬┘   ┌┴-----┴-----┴--┬--┴----┬┴-----┼-----┼-----┼-----┤
+ * │      │     │      │             │     │    │               │       │      │     │     │     │
+ * └------┴-----┴------┴-------------┴-----┘    └---------------┴-------┴------┴-----┴-----┴-----┘
+ */
+[1] = LAYOUT(
+  KC_GRAVE, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,         KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  _______,
+  _______, _______, _______, _______, _______, _______,        _______, _______, _______, _______, _______, _______, _______, _______,
+  _______, _______, _______, _______, _______, _______,        _______, _______, _______, _______, _______, _______,          _______,
+  _______, _______, _______, _______, _______, _______,        _______, _______, _______, _______, _______, _______, _______, _______,
+  _______, _______, _______, _______,          _______,        _______,          _______, _______,          _______, _______, _______
+  ),
+[2] = LAYOUT(
+  _______, _______, _______, _______, _______, _______, _______,         _______, _______, _______, _______, _______, _______, _______,
+  _______, _______, _______, _______, _______, _______,         _______, _______, _______, _______, _______, _______, _______, _______,
+  _______, _______, _______, _______, _______, _______,         _______, _______, _______, _______, _______, _______,          _______,
+  _______, _______, _______, _______, _______, _______,         _______, _______, _______, _______, _______, _______, _______, _______,
+  _______, _______, _______, _______,          _______,         _______,          _______, _______,          _______, _______, _______
+  ),
+[3] = LAYOUT(
+  _______, _______, _______, _______, _______, _______, _______,         _______, _______, _______, _______, _______, _______, _______,
+  _______, _______, _______, _______, _______, _______,         _______, _______, _______, _______, _______, _______, _______, _______,
+  _______, _______, _______, _______, _______, _______,         _______, _______, _______, _______, _______, _______,          _______,
+  _______, _______, _______, _______, _______, _______,         _______, _______, _______, _______, _______, _______, _______, _______,
+  _______, _______, _______, _______,          _______,         _______,          _______, _______,          _______, _______, _______
+  ),
+};
+
diff --git a/keyboards/ymdk/sp64/keymaps/via/rules.mk b/keyboards/ymdk/sp64/keymaps/via/rules.mk
new file mode 100644
index 0000000000..36b7ba9cbc
--- /dev/null
+++ b/keyboards/ymdk/sp64/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
+VIA_ENABLE = yes
+LTO_ENABLE = yes

From c9f88d7c67e00b3689fd4afd7630bc7fcd5b7ed4 Mon Sep 17 00:00:00 2001
From: Ryan <fauxpark@gmail.com>
Date: Wed, 2 Feb 2022 15:31:42 +1100
Subject: [PATCH 2/2] `qmk doctor`: display qmk_firmware version tag (#16155)

---
 lib/python/qmk/cli/doctor/main.py | 7 ++++++-
 lib/python/qmk/commands.py        | 8 ++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/python/qmk/cli/doctor/main.py b/lib/python/qmk/cli/doctor/main.py
index ed20f46d3f..2e5e221e8f 100755
--- a/lib/python/qmk/cli/doctor/main.py
+++ b/lib/python/qmk/cli/doctor/main.py
@@ -11,7 +11,7 @@ from milc.questions import yesno
 from qmk import submodules
 from qmk.constants import QMK_FIRMWARE, QMK_FIRMWARE_UPSTREAM
 from .check import CheckStatus, check_binaries, check_binary_versions, check_submodules
-from qmk.commands import git_check_repo, git_get_branch, git_is_dirty, git_get_remotes, git_check_deviation, in_virtualenv
+from qmk.commands import git_check_repo, git_get_branch, git_get_tag, git_is_dirty, git_get_remotes, git_check_deviation, in_virtualenv
 
 
 def os_tests():
@@ -47,6 +47,11 @@ def git_tests():
         git_branch = git_get_branch()
         if git_branch:
             cli.log.info('Git branch: %s', git_branch)
+
+            repo_version = git_get_tag()
+            if repo_version:
+                cli.log.info('Repo version: %s', repo_version)
+
             git_dirty = git_is_dirty()
             if git_dirty:
                 cli.log.warning('{fg_yellow}Git has unstashed/uncommitted changes.')
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index 5a01943773..90a68ca3cd 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -295,6 +295,14 @@ def git_get_branch():
         return git_branch.stdout.strip()
 
 
+def git_get_tag():
+    """Returns the current tag for a repo, or None.
+    """
+    git_tag = cli.run(['git', 'describe', '--abbrev=0', '--tags'])
+    if git_tag.returncode == 0:
+        return git_tag.stdout.strip()
+
+
 def git_is_dirty():
     """Returns 1 if repo is dirty, or 0 if clean
     """