From da74fcafc4f0b5fbdc501825d9601adac948b42d Mon Sep 17 00:00:00 2001 From: Beat Bolli Date: Tue, 27 Feb 2018 23:51:32 +0100 Subject: [PATCH 1/7] git-extra: provide an "sdk" development helper function Let our developers-to-be get started in a less intimidating way. See the built-in help (`sdk help`) for its subcommands. This addresses https://github.com/git-for-windows/git/issues/1357. Signed-off-by: Beat Bolli Signed-off-by: Johannes Schindelin --- git-extra/git-sdk.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/git-extra/git-sdk.sh b/git-extra/git-sdk.sh index f1e6590e08..84e8e5f3eb 100644 --- a/git-extra/git-sdk.sh +++ b/git-extra/git-sdk.sh @@ -20,3 +20,54 @@ case "$rootdir" in fi ;; esac + +sdk () { + case "$1" in + help|--help|-h) + cat >&2 <<-EOF + The 'sdk' shell function helps you to get up and running + with the Git for Windows SDK. The available subcommands are: + + create-desktop-icon: install a desktop icon that starts the GfW SDK shell. + + init : initialize and/or update a development repo. Known repos + are: build-extra, git, MINGW-packages, MSYS2-packages. + + build-git: initializes the Git repo and builds Git. + EOF + ;; + create-desktop-icon) + create-shortcut.exe --icon-file /msys2.ico --work-dir / /git-bash.exe \ + "$HOME/Desktop/Git SDK$(case "$(uname -m)" in i686) echo " 32-bit";; x86_64) echo " 64-bit";; esac).lnk" + ;; + die) + shift + echo "$*" >&2 + return 1 + ;; + init) + case "$2" in + build-extra|git|MINGW-packages|MSYS2-packages) + dest="/usr/src/$2" + if test ! -d "$dest"/.git + then + mkdir -p "$dest" && + git init "$dest" && + git -C "$dest" remote add origin https://github.com/git-for-windows/$2 + fi && + git -C "$dest" pull origin master + ;; + *) + sdk die "Unhandled repository: $2" >&2 + ;; + esac + ;; + build-git) + sdk init git && + make -C /usr/src/git -j$(nproc) DEVELOPER=1 + ;; + *) + sdk die "Usage: sdk ( build-git | init | create-desktop-icon | help )" + ;; + esac +} From 0da842f160d57e45b124ccf613674af5bf214665 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 12 Mar 2018 15:43:45 +0100 Subject: [PATCH 2/7] git-extra: in Git for Windows SDKs, initialize /usr/src/* by default The git/, build-extra/, MINGW-packages/ and MSYS2-packages/ worktrees are pretty important in the Git for Windows SDKs. Let's initialize them by default so that they are there (but do not fetch them just yet, just set up core.autoCRLF=false and the `origin` remote). This is in line with the way the SDK installer worked so far: the idea of this commit & friends is to replace the SDK installer by a simple git clone https://github.com/git-for-windows/git-sdk-64 && git-sdk-64/git-bash.exe For historical reasons, we do *not* initalize those worktrees in the SDK installer if the environment variable `JENKINS_URL` is set. Signed-off-by: Johannes Schindelin --- git-extra/git-sdk.sh | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/git-extra/git-sdk.sh b/git-extra/git-sdk.sh index 84e8e5f3eb..57c9bd277d 100644 --- a/git-extra/git-sdk.sh +++ b/git-extra/git-sdk.sh @@ -45,23 +45,25 @@ sdk () { echo "$*" >&2 return 1 ;; - init) + init-lazy) case "$2" in build-extra|git|MINGW-packages|MSYS2-packages) - dest="/usr/src/$2" - if test ! -d "$dest"/.git - then - mkdir -p "$dest" && - git init "$dest" && - git -C "$dest" remote add origin https://github.com/git-for-windows/$2 - fi && - git -C "$dest" pull origin master + mkdir -p /usr/src/"$2" && + git -C /usr/src/"$2" init && + git -C /usr/src/"$2" config core.autocrlf false && + git -C /usr/src/"$2" remote add origin \ + https://github.com/git-for-windows/"$2" || + sdk die "Could not initialize /usr/src/$2" ;; *) sdk die "Unhandled repository: $2" >&2 ;; esac ;; + init) + sdk init-lazy "$2" && + git -C "/usr/src/$2" pull origin master + ;; build-git) sdk init git && make -C /usr/src/git -j$(nproc) DEVELOPER=1 @@ -71,3 +73,12 @@ sdk () { ;; esac } + +# initialize (but do not fetch) worktrees in /usr/src +test -n "$JENKINS_URL" || { + for project in git build-extra MINGW-packages MSYS2-packages + do + test -d /usr/src/$project/.git || + sdk init-lazy $project + done +} From a280d4bd3a8d283f5c57796cf3bb30fccb97d137 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 12 Mar 2018 16:14:45 +0100 Subject: [PATCH 3/7] git-extra: create Git SDK shortcut in the SDK, unless it exists This is another step toward replacing the SDK installer by a simple clone of https://github.com/git-for-windows/git-sdk-64. Signed-off-by: Johannes Schindelin --- git-extra/git-sdk.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/git-extra/git-sdk.sh b/git-extra/git-sdk.sh index 57c9bd277d..ba6a43d9ad 100644 --- a/git-extra/git-sdk.sh +++ b/git-extra/git-sdk.sh @@ -37,8 +37,24 @@ sdk () { EOF ;; create-desktop-icon) - create-shortcut.exe --icon-file /msys2.ico --work-dir / /git-bash.exe \ - "$HOME/Desktop/Git SDK$(case "$(uname -m)" in i686) echo " 32-bit";; x86_64) echo " 64-bit";; esac).lnk" + force=t && + while case "$1" in + --gentle) force=;; + '') break;; + -*) sdk die "Unknown option: %s\n" "$1"; return 1;; + esac; do shift; done && + + case "$(uname -m)" in + i686) bitness=" 32-bit";; + x86_64) bitness=" 64-bit";; + *) bitness=;; + esac && + desktop_icon_path="$HOME/Desktop/Git SDK$bitness.lnk" && + if test -n "$force" || test ! -f "$desktop_icon_path" + then + create-shortcut.exe --icon-file /msys2.ico --work-dir \ + / /git-bash.exe "$desktop_icon_path" + fi ;; die) shift @@ -74,11 +90,14 @@ sdk () { esac } -# initialize (but do not fetch) worktrees in /usr/src +# initialize (but do not fetch) worktrees in /usr/src, and also create the +# Git SDK shortcut on the Desktop (unless it already exists). test -n "$JENKINS_URL" || { for project in git build-extra MINGW-packages MSYS2-packages do test -d /usr/src/$project/.git || sdk init-lazy $project done + + sdk create-desktop-icon --gentle } From 5b85d5935ba64d800d1094d146edc8e2d04d9017 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 12 Mar 2018 16:16:33 +0100 Subject: [PATCH 4/7] git-extra: welcome Git for Windows SDK users with a nice message It makes sense to tell the user a few things or two... Signed-off-by: Johannes Schindelin --- git-extra/git-sdk.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/git-extra/git-sdk.sh b/git-extra/git-sdk.sh index ba6a43d9ad..2a8e8e10c7 100644 --- a/git-extra/git-sdk.sh +++ b/git-extra/git-sdk.sh @@ -36,6 +36,14 @@ sdk () { build-git: initializes the Git repo and builds Git. EOF ;; + welcome) + cat >&2 <<-EOF + Welcome to the Git for Windows SDK! + + The common tasks are automated via the \`sdk\` function; + See \`sdk help\` for details. + EOF + ;; create-desktop-icon) force=t && while case "$1" in @@ -101,3 +109,5 @@ test -n "$JENKINS_URL" || { sdk create-desktop-icon --gentle } + +sdk welcome From c13f346be445b356d97eb92bbbcfb64079097475 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 12 Mar 2018 16:24:08 +0100 Subject: [PATCH 5/7] git-extra: rename `sdk build-git` to `sdk build`, build more One of the most important things users will want to do is to build a custom installer. Let's offer an easy way to do that, too. Signed-off-by: Johannes Schindelin --- git-extra/git-sdk.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/git-extra/git-sdk.sh b/git-extra/git-sdk.sh index 2a8e8e10c7..782a985596 100644 --- a/git-extra/git-sdk.sh +++ b/git-extra/git-sdk.sh @@ -33,7 +33,7 @@ sdk () { init : initialize and/or update a development repo. Known repos are: build-extra, git, MINGW-packages, MSYS2-packages. - build-git: initializes the Git repo and builds Git. + build: builds one of the following: git, git-and-installer. EOF ;; welcome) @@ -88,9 +88,23 @@ sdk () { sdk init-lazy "$2" && git -C "/usr/src/$2" pull origin master ;; - build-git) - sdk init git && - make -C /usr/src/git -j$(nproc) DEVELOPER=1 + build) + case "$2" in + git) + sdk init git && + make -C /usr/src/git -j$(nproc) DEVELOPER=1 + ;; + git-and-installer) + sdk build git && + make -C /usr/src/git strip install && + pacman -Syyu git-extra && + sdk init build-extra && + /usr/src/build-extra/installer/release.sh "${3:-0-test}" + ;; + *) + sdk die "Unknown project: $2" + ;; + esac ;; *) sdk die "Usage: sdk ( build-git | init | create-desktop-icon | help )" From d16ba01972e2722eeb0201ebbd5cba9d9eeb3ab0 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 14 Mar 2018 17:48:06 +0100 Subject: [PATCH 6/7] git-extra: let `sdk build` print something helpful by default When the user did not specify anything to build, or something we do not know about, let's just print a list of supported build targets and error out. Signed-off-by: Johannes Schindelin --- git-extra/git-sdk.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/git-extra/git-sdk.sh b/git-extra/git-sdk.sh index 782a985596..abca40aa66 100644 --- a/git-extra/git-sdk.sh +++ b/git-extra/git-sdk.sh @@ -102,7 +102,14 @@ sdk () { /usr/src/build-extra/installer/release.sh "${3:-0-test}" ;; *) - sdk die "Unknown project: $2" + cat >&2 < + +Supported projects: + git + git-and-installer +EOF + return 1 ;; esac ;; From 819813f54195abea8346fd4f09714cfe9fdc112f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 14 Mar 2018 17:51:33 +0100 Subject: [PATCH 7/7] git-extra: offer to build the installer very easily in the SDK Many feature requests involve improvements to the installer. Let's make that easy by letting the user build it with sdk build installer Signed-off-by: Johannes Schindelin --- git-extra/git-sdk.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git-extra/git-sdk.sh b/git-extra/git-sdk.sh index abca40aa66..f54797ce56 100644 --- a/git-extra/git-sdk.sh +++ b/git-extra/git-sdk.sh @@ -94,6 +94,10 @@ sdk () { sdk init git && make -C /usr/src/git -j$(nproc) DEVELOPER=1 ;; + installer) + sdk init build-extra && + /usr/src/build-extra/installer/release.sh "${3:-0-test}" + ;; git-and-installer) sdk build git && make -C /usr/src/git strip install && @@ -107,7 +111,8 @@ sdk build Supported projects: git - git-and-installer + installer [] + git-and-installer [] EOF return 1 ;;