Skip to content

Commit

Permalink
Merge branch 'builtin-difftool'
Browse files Browse the repository at this point in the history
This feature branch lets the user opt-in to use the new, experimental
builtin difftool. It is faster than the Perl version, but only lightly
tested.

This feature flag will give it a lot more testing, without compromising
Git for Windows' functionality.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Nov 24, 2016
2 parents 93f2efa + 0f1aba2 commit 74339bd
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion installer/install.iss
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ Type: dirifempty; Name: {app}\etc
; Delete recorded install options
Type: files; Name: {app}\etc\install-options.txt
Type: dirifempty; Name: {app}\etc
Type: dirifempty; Name: {app}\{#MINGW_BITNESS}\libexec\git-core
Type: dirifempty; Name: {app}\{#MINGW_BITNESS}\libexec
Type: dirifempty; Name: {app}\{#MINGW_BITNESS}
Type: dirifempty; Name: {app}

Expand Down Expand Up @@ -314,6 +316,9 @@ const
GP_GCM = 2;
GP_Symlinks = 3;
// Experimental options
GP_BuiltinDifftool = 1;
// BindImageEx API constants.
BIND_NO_BOUND_IMPORTS = $00000001;
BIND_NO_UPDATE = $00000002;
Expand Down Expand Up @@ -345,6 +350,10 @@ var
ExtraOptionsPage:TWizardPage;
RdbExtraOptions:array[GP_FSCache..GP_Symlinks] of TCheckBox;
// Wizard page and variables for the experimental options.
ExperimentalOptionsPage:TWizardPage;
RdbExperimentalOptions:array[GP_BuiltinDifftool..GP_BuiltinDifftool] of TCheckBox;
// Wizard page and variables for the processes page.
SessionHandle:DWORD;
Processes:ProcessList;
Expand Down Expand Up @@ -735,6 +744,7 @@ var
LblLFOnly,LblCRLFAlways,LblCRLFCommitAsIs:TLabel;
LblMinTTY,LblConHost:TLabel;
LblFSCache,LblGCM,LblGCMLink,LblSymlinks,LblSymlinksLink:TLabel;
LblBuiltinDifftool:TLabel;
BtnPlink:TButton;
Data:String;
begin
Expand Down Expand Up @@ -1273,6 +1283,47 @@ begin
RdbExtraOptions[GP_Symlinks].Checked:=Data='Enabled';
(*
* Create a custom page for experimental options.
*)
ExperimentalOptionsPage:=CreateCustomPage(
PrevPageID
, 'Configuring experimental options'
, 'Which bleeding-edge features would you like to enable?'
);
PrevPageID:=ExperimentalOptionsPage.ID;
// 1st option
RdbExperimentalOptions[GP_BuiltinDifftool]:=TCheckBox.Create(ExperimentalOptionsPage);
with RdbExperimentalOptions[GP_BuiltinDifftool] do begin
Parent:=ExperimentalOptionsPage.Surface;
Caption:='Enable experimental, builtin difftool';
Left:=ScaleX(4);
Top:=ScaleY(8);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=1;
end;
LblBuiltinDifftool:=TLabel.Create(ExperimentalOptionsPage);
with LblBuiltinDifftool do begin
Parent:=ExperimentalOptionsPage.Surface;
Caption:=
'Use the experimental builtin difftool (fast, but only lightly tested).';
Left:=ScaleX(28);
Top:=ScaleY(32);
Width:=ScaleX(405);
Height:=ScaleY(13);
end;
// Restore the settings chosen during a previous install
Data:=ReplayChoice('Enable Builtin Difftool','Auto');
if Data='Auto' then
RdbExperimentalOptions[GP_BuiltinDifftool].Checked:=False
else
RdbExperimentalOptions[GP_BuiltinDifftool].Checked:=Data='Enabled';
(*
* Create a custom page for finding the processes that lock a module.
Expand Down Expand Up @@ -1305,7 +1356,7 @@ begin
// This button is only used by the uninstaller.
ContinueButton:=NIL;
PageIDBeforeInstall:=ExtraOptionsPage.ID;
PageIDBeforeInstall:=ExperimentalOptionsPage.ID;
#ifdef DEBUG_WIZARD_PAGE
DebugWizardPage:={#DEBUG_WIZARD_PAGE}.ID;
Expand Down Expand Up @@ -1739,6 +1790,18 @@ begin
ProgramData + '\Git', SW_HIDE, ewWaitUntilTerminated, i) then
LogError('Unable to enable the extra option: ' + Cmd);
{
Configure experimental options
}
if RdbExperimentalOptions[GP_BuiltinDifftool].checked then begin
if not Exec(AppDir + '\{#MINGW_BITNESS}\bin\git.exe','config --system difftool.useBuiltin true','',SW_HIDE,ewWaitUntilTerminated, i) then
LogError('Could not configure difftool.useBuiltin')
end else begin
if not Exec(AppDir + '\{#MINGW_BITNESS}\bin\git.exe','config --system --unset difftool.useBuiltin','',SW_HIDE,ewWaitUntilTerminated, i) then
LogError('Could not configure difftool.useBuiltin')
end;
{
Modify the environment
Expand Down Expand Up @@ -1941,6 +2004,13 @@ begin
end;
RecordChoice(PreviousDataKey,'Enable Symlinks',Data);
// Experimental options.
Data:='Disabled';
if RdbExperimentalOptions[GP_BuiltinDifftool].Checked then begin
Data:='Enabled';
end;
RecordChoice(PreviousDataKey,'Enable Builtin Difftool',Data);
Path:=ExpandConstant('{app}\etc\install-options.txt');
if not SaveStringToFile(Path,ChosenOptions,False) then
LogError('Could not write to '+Path);
Expand Down

5 comments on commit 74339bd

@FallenGameR
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For end-user - how to test the new build-in difftool?
I've tried this, but it didn't work:

» git config --bool difftool.useBuiltin true
» git difftool

Viewing (1/1): 'someFile.exe.config'
Launch 'kdiff3' [Y/n]? n

@dscho
Copy link
Member Author

@dscho dscho commented on 74339bd Dec 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not open a proper bug report?

Viewing (1/1): 'someFile.exe.config' Launch 'kdiff3' [Y/n]? n

That looks like it works alright...

@FallenGameR
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where should I create a bug report? This GitHub repository doesn't show 'Issues' tab for me.
Also, I was not sure if I did the setup properly

@dscho
Copy link
Member Author

@dscho dscho commented on 74339bd Dec 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where should I create a bug report?

As suggested on https://git-for-windows.github.io/ (i.e. Git for Windows' home page), here: https://github.com/git-for-windows/git/issues/

You could also go to the mailing list.

Commenting on individual commits only creates more work for me.

@FallenGameR
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.