diff --git a/.gitignore b/.gitignore index 56bb310695..b9737dcea9 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,12 @@ edit-git-bash.exe /mingw-w64-git-credential-manager/*.src.tar.gz /mingw-w64-git-credential-manager/gcmw-*.zip /mingw-w64-git-credential-manager/v[1-9]*.zip +/mingw-w64-git-credential-manager-core/pkg/ +/mingw-w64-git-credential-manager-core/src/ +/mingw-w64-git-credential-manager-core/*.pkg.tar.* +/mingw-w64-git-credential-manager-core/*.src.tar.gz +/mingw-w64-git-credential-manager-core/gcmcore-*.zip +/mingw-w64-git-credential-manager-core/v[1-9]*.zip /mingw-w64-wintoast/mingw-w64-*-wintoast-*-any.pkg.tar.xz /mingw-w64-wintoast/pkg /mingw-w64-wintoast/src diff --git a/get-sources.sh b/get-sources.sh index 32e4b423c9..9d5f735569 100755 --- a/get-sources.sh +++ b/get-sources.sh @@ -211,7 +211,7 @@ do then case "$name" in - git-extra|mingw-w64-x86_64-git|mingw-w64-i686-git|msys2-runtime|mingw-w64-x86_64-git-credential-manager|mingw-w64-i686-git-credential-manager|mingw-w64-i686-git-lfs|mingw-w64-x86_64-git-lfs|curl|mingw-w64-i686-curl|mingw-w64-x86_64-curl|mingw-w64-i686-wintoast|mingw-w64-x86_64-wintoast|bash|heimdal|perl|openssh) + git-extra|mingw-w64-x86_64-git|mingw-w64-i686-git|msys2-runtime|mingw-w64-x86_64-git-credential-manager|mingw-w64-i686-git-credential-manager|mingw-w64-x86_64-git-credential-manager-core|mingw-w64-i686-git-credential-manager-core|mingw-w64-i686-git-lfs|mingw-w64-x86_64-git-lfs|curl|mingw-w64-i686-curl|mingw-w64-x86_64-curl|mingw-w64-i686-wintoast|mingw-w64-x86_64-wintoast|bash|heimdal|perl|openssh) url="$azure_blobs_source_url/$filename" sf1_url= sf2_url= diff --git a/git-extra/git-sdk.sh b/git-extra/git-sdk.sh index 5875388cca..bf1debb6c3 100755 --- a/git-extra/git-sdk.sh +++ b/git-extra/git-sdk.sh @@ -98,6 +98,7 @@ sdk () { mingw-w64-cv2pdb \ mingw-w64-git \ mingw-w64-git-credential-manager \ + mingw-w64-git-credential-manager-core \ mingw-w64-git-lfs \ mingw-w64-git-sizer \ mingw-w64-wintoast \ diff --git a/installer/install.iss b/installer/install.iss index 1aeefc591e..cf220c73e7 100644 --- a/installer/install.iss +++ b/installer/install.iss @@ -352,10 +352,14 @@ const GP_GitPullRebase = 2; GP_GitPullFFOnly = 3; + // Git Credential Manager settings. + GCM_None = 1; + GCM_Classic = 2; + GCM_Core = 3; + // Extra options GP_FSCache = 1; - GP_GCM = 2; - GP_Symlinks = 3; + GP_Symlinks = 2; #ifdef WITH_EXPERIMENTAL_BUILTIN_DIFFTOOL #define HAVE_EXPERIMENTAL_OPTIONS 1 @@ -447,6 +451,10 @@ var GitPullBehaviorPage:TWizardPage; RdbGitPullBehavior:array[GP_GitPullMerge..GP_GitPullFFOnly] of TRadioButton; + // Wizard page and variables for the credential manager options. + GitCredentialManagerPage:TWizardPage; + RdbGitCredentialManager:array[GCM_None..GCM_Core] of TRadioButton; + // Wizard page and variables for the extra options. ExtraOptionsPage:TWizardPage; RdbExtraOptions:array[GP_FSCache..GP_Symlinks] of TCheckBox; @@ -796,6 +804,7 @@ begin 'credential.helper': case Value of 'manager': RecordInferredDefault('Use Credential Manager','Enabled'); + 'manager-core': RecordInferredDefault('Use Credential Manager','Core'); else RecordInferredDefault('Use Credential Manager','Disabled'); end; 'core.symlinks': @@ -1127,13 +1136,6 @@ begin ShellExec('','https://stackoverflow.blog/2017/05/23/stack-overflow-helping-one-million-developers-exit-vim/','','',SW_SHOW,ewNoWait,ExitStatus); end; -procedure OpenGCMHomepage(Sender:TObject); -var - ExitStatus:Integer; -begin - ShellExec('','https://github.com/Microsoft/Git-Credential-Manager-for-Windows','','',SW_SHOW,ewNoWait,ExitStatus); -end; - procedure OpenSymlinksWikiPage(Sender:TObject); var ExitStatus:Integer; @@ -2060,30 +2062,50 @@ begin end; (* - * Create a custom page for extra options. + * Create a custom page for the choice of Git Credential Manager. *) - ExtraOptionsPage:=CreatePage(PrevPageID,'Configuring extra options','Which features would you like to enable?',TabOrder,Top,Left); + GitCredentialManagerPage:=CreatePage(PrevPageID,'Choose a credential helper','Which credential helper should be configured?',TabOrder,Top,Left); - // 1st option - RdbExtraOptions[GP_FSCache]:=CreateCheckBox(ExtraOptionsPage,'Enable file system caching','File system data will be read in bulk and cached in memory for certain'+#13+'operations ("core.fscache" is set to "true"). This provides a significant'+#13+'performance boost.',TabOrder,Top,Left); + // 1st choice + RdbGitCredentialManager[GCM_None]:=CreateRadioButton(GitCredentialManagerPage,'None','Do not use a credential helper.',TabOrder,Top,Left); - // Restore the settings chosen during a previous install. - RdbExtraOptions[GP_FSCache].Checked:=ReplayChoice('Performance Tweaks FSCache','Enabled')<>'Disabled'; + // 2nd choice + RdbGitCredentialManager[GCM_Classic]:=CreateRadioButton(GitCredentialManagerPage,'Git Credential Manager','The Git Credential Manager for Windows handles credentials e.g. for Azure'+#13+'DevOps and GitHub (requires .NET framework v4.5.1 or later).',TabOrder,Top,Left); - // 2nd option - RdbExtraOptions[GP_GCM]:=CreateCheckBox(ExtraOptionsPage,'Enable Git Credential Manager','The Git Credential Manager for Windows provides secure Git credential storage'+#13+'for Windows, most notably multi-factor authentication support for Visual Studio'+#13+'Team Services and GitHub. (requires .NET framework v4.5.1 or later).',TabOrder,Top,Left); + // 3rd choice + RdbGitCredentialManager[GCM_Core]:=CreateRadioButton(GitCredentialManagerPage,'Git Credential Manager Core','(NEW!) Use the new, cross-platform version of the Git Credential Manager.'+#13+'See more information about the future of Git Credential Manager here.',TabOrder,Top,Left); // Restore the settings chosen during a previous install, if .NET 4.5.1 // or later is available. if DetectNetFxVersion()<378675 then begin - RdbExtraOptions[GP_GCM].Checked:=False; - RdbExtraOptions[GP_GCM].Enabled:=False; + RdbGitCredentialManager[GCM_Classic].Checked:=False; + RdbGitCredentialManager[GCM_Classic].Enabled:=False; + RdbGitCredentialManager[GCM_Core].Checked:=False; + RdbGitCredentialManager[GCM_Core].Enabled:=False; end else begin - RdbExtraOptions[GP_GCM].Checked:=ReplayChoice('Use Credential Manager','Enabled')<>'Disabled'; + case ReplayChoice('Use Credential Manager','Enabled') of + 'Disabled': RdbGitCredentialManager[GCM_None].Checked:=True; + 'Enabled': RdbGitCredentialManager[GCM_Classic].Checked:=True; + 'Core': RdbGitCredentialManager[GCM_Core].Checked:=True; + else + RdbGitCredentialManager[GCM_Classic].Checked:=True; + end; end; - // 3rd option + (* + * Create a custom page for extra options. + *) + + ExtraOptionsPage:=CreatePage(PrevPageID,'Configuring extra options','Which features would you like to enable?',TabOrder,Top,Left); + + // 1st option + RdbExtraOptions[GP_FSCache]:=CreateCheckBox(ExtraOptionsPage,'Enable file system caching','File system data will be read in bulk and cached in memory for certain'+#13+'operations ("core.fscache" is set to "true"). This provides a significant'+#13+'performance boost.',TabOrder,Top,Left); + + // Restore the settings chosen during a previous install. + RdbExtraOptions[GP_FSCache].Checked:=ReplayChoice('Performance Tweaks FSCache','Enabled')<>'Disabled'; + + // 2nd option RdbExtraOptions[GP_Symlinks]:=CreateCheckBox(ExtraOptionsPage,'Enable symbolic links','Enable symbolic links (requires the SeCreateSymbolicLink permission).'+#13+'Please note that existing repositories are unaffected by this setting.',TabOrder,Top,Left); // Restore the settings chosen during a previous install, or auto-detect @@ -2788,6 +2810,21 @@ begin GitSystemConfigSet('pull.ff','only') end; + { + Configure credential helper + } + + if RdbGitCredentialManager[GCM_None].checked then begin + GitSystemConfigSet('credential.helper',#0); + GitSystemConfigSet('credential.https://dev.azure.com.useHttpPath',#0); + end else if RdbGitCredentialManager[GCM_Classic].checked then begin + GitSystemConfigSet('credential.helper','manager'); + GitSystemConfigSet('credential.https://dev.azure.com.useHttpPath',#0); + end else if RdbGitCredentialManager[GCM_Core].checked then begin + GitSystemConfigSet('credential.helper','manager-core'); + GitSystemConfigSet('credential.https://dev.azure.com.useHttpPath','true'); + end; + { Configure extra options } @@ -2795,9 +2832,6 @@ begin if RdbExtraOptions[GP_FSCache].checked then GitSystemConfigSet('core.fscache','true'); - if RdbExtraOptions[GP_GCM].checked then - GitSystemConfigSet('credential.helper','manager'); - if RdbExtraOptions[GP_Symlinks].checked then Cmd:='true' else @@ -3144,17 +3178,21 @@ begin end; RecordChoice(PreviousDataKey,'Git Pull Behavior Option',Data); - // Extra options. + // Credential helper. Data:='Disabled'; - if RdbExtraOptions[GP_FSCache].Checked then begin + if RdbGitCredentialManager[GCM_Classic].Checked then begin Data:='Enabled'; + end else if RdbGitCredentialManager[GCM_Core].Checked then begin; + Data:='Core'; end; - RecordChoice(PreviousDataKey,'Performance Tweaks FSCache',Data); + RecordChoice(PreviousDataKey,'Use Credential Manager',Data); + + // Extra options. Data:='Disabled'; - if RdbExtraOptions[GP_GCM].Checked then begin + if RdbExtraOptions[GP_FSCache].Checked then begin Data:='Enabled'; end; - RecordChoice(PreviousDataKey,'Use Credential Manager',Data); + RecordChoice(PreviousDataKey,'Performance Tweaks FSCache',Data); Data:='Disabled'; if RdbExtraOptions[GP_Symlinks].Checked then begin Data:='Enabled'; diff --git a/make-file-list.sh b/make-file-list.sh index 7b478ed073..c067c6a7b2 100755 --- a/make-file-list.sh +++ b/make-file-list.sh @@ -82,7 +82,7 @@ pacman_list () { # Packages that have been added after Git SDK 1.0.0 was released... required= -for req in mingw-w64-$ARCH-git-credential-manager $SH_FOR_REBASE \ +for req in mingw-w64-$ARCH-git-credential-manager mingw-w64-$ARCH-git-credential-manager-core $SH_FOR_REBASE \ $(test -n "$MINIMAL_GIT" || echo \ mingw-w64-$ARCH-connect git-flow unzip docx2txt \ mingw-w64-$ARCH-antiword mingw-w64-$ARCH-odt2txt \ @@ -97,7 +97,7 @@ test -z "$required" || pacman -Sy --noconfirm $required >&2 || die "Could not install required packages: $required" -packages="mingw-w64-$ARCH-git mingw-w64-$ARCH-git-credential-manager +packages="mingw-w64-$ARCH-git mingw-w64-$ARCH-git-credential-manager mingw-w64-$ARCH-git-credential-manager-core git-extra openssh $UTIL_PACKAGES" if test -z "$MINIMAL_GIT" then diff --git a/mingw-w64-git-credential-manager-core/PKGBUILD b/mingw-w64-git-credential-manager-core/PKGBUILD new file mode 100644 index 0000000000..434b270dbb --- /dev/null +++ b/mingw-w64-git-credential-manager-core/PKGBUILD @@ -0,0 +1,29 @@ +# Maintainer: Johannes Schindelin/Matthew J Cheetham + +_realname="git-credential-manager-core" +pkgbase="mingw-w64-${_realname}" +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") +pkgver=2.0.164.25618 +pkgrel=0 +_realver=$pkgver +_realtag=v${pkgver%.*}-beta +pkgdesc="Credential Manager for Git" +arch=('any') +project_url="https://github.com/microsoft/Git-Credential-Manager-Core" +zip_url="${project_url}/releases/download/${_realtag}/gcmcore-win-x86-${_realver}.zip" +src_zip_url="${project_url}/archive/${_realtag}.zip" +license=('MIT') +groups=('VCS') + +source=("${zip_url}" "$src_zip_url") + +sha256sums=('a9d424bb56e5571a9a80e195376aa7c7fcf5f890fe1029f45eb81be04eb9d264' + '7b07bf3317ae4e47446a93febe2b6fcde6f409bd3ab3b78358b6dfcc13ab5592') + +package() { + prefix="$pkgdir/${MINGW_PREFIX}" + srcdir2="${srcdir}/" + install -d -m755 "${prefix}"/libexec/git-core + install -m755 "$srcdir2"/*.{dll,exe} "${prefix}"/libexec/git-core + install -d -m755 "${prefix}"/doc/git-credential-manager-core +} diff --git a/please.sh b/please.sh index 09d8f68697..aef5a18fae 100755 --- a/please.sh +++ b/please.sh @@ -423,6 +423,15 @@ set_package () { type=MINGW pkgpath=/usr/src/build-extra/mingw-w64-git-credential-manager ;; + mingw-w64-git-credential-manager-core) + type=MINGW + pkgpath=/usr/src/build-extra/mingw-w64-git-credential-manager-core + ;; + gcm|credential-manager-core|git-credential-manager-core) + package=mingw-w64-git-credential-manager-core + type=MINGW + pkgpath=/usr/src/build-extra/mingw-w64-git-credential-manager-core + ;; lfs|git-lfs|mingw-w64-git-lfs) package=mingw-w64-git-lfs type=MINGW @@ -2927,6 +2936,41 @@ upgrade () { # [--directory=] [--only-mingw] [--no-build] [ url=https://github.com/$repo/releases/tag/$tag_name && release_notes_feature='Comes with [Git Credential Manager v'$version']('"$url"').' ;; + mingw-w64-git-credential-manager-core) + repo=microsoft/Git-Credential-Manager-Core + url=https://api.github.com/repos/$repo/releases/latest + release="$(curl --netrc -s $url)" + test -n "$release" || + die "Could not determine the latest version of %s\n" "$package" + tag_name="$(echo "$release" | + sed -n 's/^ "tag_name": "\(.*\)",\?$/\1/p')" + zip_name="$(echo "$release" | sed -n \ + 's/.*"browser_download_url":.*\/\(gcm.*\.zip\).*/\1/p')" + version=${tag_name#v} + zip_prefix=${zip_name%$version.zip} + if test "$zip_prefix" = "$zip_name" + then + # The version in the tag and the zip file name differ + zip_replace='s/^\(zip_url=.*\/\)gcm[^"]*/\1'$zip_name/ + else + zip_replace='s/^\(zip_url=.*\/\)gcm[^"]*/\1'$zip_prefix'${_realver}.zip/' + fi + src_zip_prefix=${tag_name%$version} + (cd "$sdk64$pkgpath" && + sed -i -e "s/^\\(pkgver=\\).*/\1$version/" -e "$zip_replace" \ + -e 's/^\(src_zip_url=.*\/\).*\(\$.*\)/\1'$src_zip_prefix'\2/' \ + -e 's/^pkgrel=.*/pkgrel=1/' PKGBUILD && + updpkgsums && + srcdir2="$(unzip -l $zip_prefix$version.zip | sed -n \ + 's/^.\{28\} *\(.*\/\)\?git-credential-manager-core.exe/\1/p')" && + sed -i -e 's/^\( srcdir2=\).*/\1"${srcdir}\/'$srcdir2'"/' \ + PKGBUILD && + maybe_force_pkgrel "$force_pkgrel" && + git commit -s -m "Upgrade $package to $version${force_pkgrel:+-$force_pkgrel}" PKGBUILD && + create_bundle_artifact) && + url=https://github.com/$repo/releases/tag/$tag_name && + release_notes_feature='Comes with [Git Credential Manager Core v'$version']('"$url"').' + ;; git-extra) (cd "$sdk64$pkgpath" && updpkgsums &&