Skip to content

Commit

Permalink
installer: install the system-wide config again
Browse files Browse the repository at this point in the history
... but not completely. Parts of it should go into
C:\ProgramData\Git\config, after all. So let's split the SDK's
system-wide gitconfig as appropriate.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Apr 4, 2017
1 parent 72ad198 commit 115b9f5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ edit-git-bash.exe
/installer/ReleaseNotes.html
/installer/bindimage.txt
/installer/config.iss
/installer/gitconfig.system
/installer/install.log
/installer/is-unicode.exe
/installer/file-list.iss
/installer/package-versions.txt
/installer/programdata-config.template
/mingit/exclude-list
/mingit/root/
/mingit/sorted-all
Expand Down
9 changes: 4 additions & 5 deletions installer/install.iss
Original file line number Diff line number Diff line change
Expand Up @@ -1839,8 +1839,10 @@ begin
Log('Line {#__LINE__}: Creating directory "' + ProgramData + '\Git" failed.');
end;
end;
if not FileCopy(AppDir + '\{#MINGW_BITNESS}\etc\gitconfig', ProgramData + '\Git\config', True) then begin
Log('Line {#__LINE__}: Creating copy "' + ProgramData + '\Git\config" failed.');
if not FileExists(ExpandConstant('{tmp}\programdata-config.template')) then
ExtractTemporaryFile('programdata-config.template');
if not FileCopy(ExpandConstant('{tmp}\programdata-config.template'), ProgramData + '\Git\config', True) then begin
Log('Line {#__LINE__}: Creating initial "' + ProgramData + '\Git\config" failed.');
end;
end;
if FileExists(ProgramData+'\Git\config') then begin
Expand All @@ -1853,9 +1855,6 @@ begin
if not Exec(AppDir+'\{#MINGW_BITNESS}\bin\git.exe','config -f config '+Cmd,
ProgramData+'\Git',SW_HIDE,ewWaitUntilTerminated,i) then
LogError('Unable to configure SSL CA info: ' + Cmd);
if not DeleteFile(AppDir+'\{#MINGW_BITNESS}\etc\gitconfig') then begin
Log('Line {#__LINE__}: Deleting template config "' + AppDir + '\{#MINGW_BITNESS}\etc\gitconfig" failed.');
end;
end;
{
Expand Down
44 changes: 44 additions & 0 deletions installer/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,50 @@ case "$LIST" in
;;
esac

GITCONFIG_PATH="$(echo "$LIST" | grep "^mingw$BITNESS/etc/gitconfig\$")"
printf '' >programdata-config.template
test -z "$GITCONFIG_PATH" || {
cp "/$GITCONFIG_PATH" gitconfig.system &&
cp "/$GITCONFIG_PATH" programdata-config.template &&
keys="$(git config -f gitconfig.system -l --name-only)" &&
for key in $keys
do
case "$key" in
pack.packsizelimit)
# remove from both, will be configured by installer
git config -f programdata-config.template \
--unset "$key" &&
git config -f gitconfig.system --unset "$key" ||
break
;;
diff.astextplain.*|filter.lfs.*|http.sslcainfo)
# keep in the system-wide config
git config -f programdata-config.template \
--unset "$key" ||
break
;;
*)
# move to the ProgramData template
git config -f gitconfig.system --unset "$key" ||
break
;;
esac || break
done &&
sed -i '/^\[/{:1;$d;N;/^.[^[]*$/b;s/^.*\[/[/;b1}' gitconfig.system &&
sed -i '/^\[/{:1;$d;N;/^.[^[]*$/b;s/^.*\[/[/;b1}' \
programdata-config.template ||
die "Could not split gitconfig"
LIST="$(echo "$LIST" | grep -v "^$GITCONFIG_PATH\$")"
}

printf '%s%s%s\n%s\n' \
'Source: {#SourcePath}\gitconfig.system; DestName: gitconfig; ' \
"DestDir: {app}\\mingw$BITNESS\\etc; Flags: replacesameversion; " \
'AfterInstall: DeleteFromVirtualStore' \
'Source: {#SourcePath}\programdata-config.template; Flags: dontcopy' \
>>file-list.iss ||
die "Could not append gitconfig to file list"

test -z "$LIST" ||
echo "$LIST" |
sed -e 's|/|\\|g' \
Expand Down

0 comments on commit 115b9f5

Please sign in to comment.