From 960f5ec009aec505d321fe0896552283b4874265 Mon Sep 17 00:00:00 2001 From: Tk-Glitch Date: Tue, 16 Feb 2021 11:37:17 +0100 Subject: [PATCH] install.sh: Handle initial releases git tags differenty (_sub=0) Fixes https://github.com/Frogging-Family/linux-tkg/issues/178 --- install.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index e0857cb..24fd4ab 100755 --- a/install.sh +++ b/install.sh @@ -108,14 +108,29 @@ _linux_git_branch_checkout() { msg2 "Checking out latest RC tag: v${_basekernel}-${_sub}" git fetch origin tag "v${_basekernel}-${_sub}" git checkout "v${_basekernel}-${_sub}" - + elif [ "$_sub" = "0" ]; then + msg2 "Switching to linux-${_basekernel}.y" + if ! git branch --list | grep "linux-${_basekernel}.y" ; then + msg2 "${_basekernel}.y branch doesn't locally exist, shallow cloning..." + git remote set-branches --add origin linux-${_basekernel}.y + git fetch origin linux-${_basekernel}.y --shallow-since=$_clone_start_date + git checkout -b linux-${_basekernel}.y origin/linux-${_basekernel}.y + else + msg2 "${_basekernel}.y branch exists locally, updating..." + git checkout linux-${_basekernel}.y + git fetch origin linux-${_basekernel}.y --shallow-since=$_clone_start_date + git reset --hard origin/linux-${_basekernel}.y + fi + msg2 "Checking out latest release: v${_basekernel}" + git fetch origin tag "v${_basekernel}" + git checkout "v${_basekernel}" else msg2 "Switching to linux-${_basekernel}.y" if ! git branch --list | grep "linux-${_basekernel}.y" ; then msg2 "${_basekernel}.y branch doesn't locally exist, shallow cloning..." - git remote set-branches --add origin linux-${_basekernel}.y + git remote set-branches --add origin linux-${_basekernel}.y git fetch origin linux-${_basekernel}.y --shallow-since=$_clone_start_date - git checkout -b linux-${_basekernel}.y origin/linux-${_basekernel}.y + git checkout -b linux-${_basekernel}.y origin/linux-${_basekernel}.y else msg2 "${_basekernel}.y branch exists locally, updating..." git checkout linux-${_basekernel}.y