-
Notifications
You must be signed in to change notification settings - Fork 612
/
install.iss
3832 lines (3385 loc) · 162 KB
/
install.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; Uncomment the line below to be able to compile the script from within the IDE.
;#define COMPILE_FROM_IDE
; vim: sw=4 expandtab:
#include "config.iss"
#if !defined(APP_VERSION) || !defined(BITNESS) || !defined(MINGW_BITNESS)
#error "config.iss should define APP_VERSION, BITNESS and MINGW_BITNESS"
#endif
#define APP_NAME 'Git'
#ifdef COMPILE_FROM_IDE
#undef APP_VERSION
#define APP_VERSION 'Snapshot'
#endif
#define APP_CONTACT_URL 'https://github.com/git-for-windows/git/wiki/Contact'
#define APP_URL 'https://gitforwindows.org/'
#define APP_BUILTINS 'share\git\builtins.txt'
#define PLINK_PATH_ERROR_MSG 'Please enter a valid path to a Plink executable.'
#define DROP_HANDLER_GUID '{{60254CA5-953B-11CF-8C96-00AA00B8708C}'
#ifndef DEFAULT_BRANCH_NAME
#define DEFAULT_BRANCH_NAME 'master'
#endif
#ifndef INSTALLER_FILENAME_SUFFIX
#define INSTALLER_FILENAME_SUFFIX ''
#endif
[Setup]
; Compiler-related
Compression=lzma2/ultra64
LZMAUseSeparateProcess=yes
#ifdef OUTPUT_TO_TEMP
OutputBaseFilename={#FILENAME_VERSION}
OutputDir={#GetEnv('TEMP')}
#else
#if INSTALLER_FILENAME_SUFFIX!=''
OutputBaseFilename={#APP_NAME+'-'+FILENAME_VERSION+'-'+INSTALLER_FILENAME_SUFFIX}
#else
OutputBaseFilename={#APP_NAME+'-'+FILENAME_VERSION}-{#BITNESS}-bit
#endif
#ifdef OUTPUT_DIRECTORY
OutputDir={#OUTPUT_DIRECTORY}
#else
OutputDir={#GetEnv('USERPROFILE')}
#endif
#endif
SolidCompression=yes
#ifndef SOURCE_DIR
#define SOURCE_DIR SourcePath+'\..\..\..\..'
#endif
SourceDir={#SOURCE_DIR}
#if BITNESS=='64' || INSTALLER_FILENAME_SUFFIX=='arm64'
ArchitecturesInstallIn64BitMode=x64 arm64
#endif
#ifdef SIGNTOOL
SignTool=signtool
#endif
#define FILE_VERSION GetFileVersion(SOURCE_DIR+'\'+MINGW_BITNESS+'\bin\git.exe')
; Installer-related
AllowNoIcons=yes
AppName={#APP_NAME}
AppPublisher=The Git Development Community
AppPublisherURL={#APP_URL}
AppSupportURL={#APP_CONTACT_URL}
AppVersion={#APP_VERSION}
ChangesAssociations=yes
ChangesEnvironment=yes
CloseApplications=no
DefaultDirName={pf}\{#APP_NAME}
DisableDirPage=auto
DefaultGroupName={#APP_NAME}
DisableProgramGroupPage=auto
DisableReadyPage=yes
InfoBeforeFile={#SourcePath}\..\gpl-2.0.rtf
#ifdef OUTPUT_TO_TEMP
PrivilegesRequired=lowest
#else
PrivilegesRequired=none
#endif
UninstallDisplayName={#APP_NAME}
UninstallDisplayIcon={app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
#ifndef COMPILE_FROM_IDE
VersionInfoVersion={#FILE_VERSION}
#endif
; Cosmetic
SetupIconFile={#SourcePath}\..\git.ico
WizardImageBackColor=clWhite
WizardImageStretch=no
WizardImageFile={#SourcePath}\git.bmp
WizardSmallImageFile={#SourcePath}\gitsmall.bmp
[Types]
; Define a custom type to avoid getting the three default types.
Name: default; Description: Default installation; Flags: iscustom
[Components]
Name: icons; Description: Additional icons
Name: icons\quicklaunch; Description: In the Quick Launch; Check: not IsAdminLoggedOn
Name: icons\desktop; Description: On the Desktop
Name: ext; Description: Windows Explorer integration; Types: default
Name: ext\shellhere; Description: Git Bash Here; Types: default
Name: ext\guihere; Description: Git GUI Here; Types: default
Name: gitlfs; Description: Git LFS (Large File Support); Types: default; Flags: disablenouninstallwarning
Name: assoc; Description: Associate .git* configuration files with the default text editor; Types: default
Name: assoc_sh; Description: Associate .sh files to be run with Bash; Types: default
Name: consolefont; Description: Use a TrueType font in all console windows; OnlyBelowVersion: 10.0
Name: autoupdate; Description: Check daily for Git for Windows updates
Name: windowsterminal; Description: "(NEW!) Add a Git Bash Profile to Windows Terminal"; MinVersion: 10.0.18362
#ifdef WITH_SCALAR
Name: scalar; Description: "(NEW!) Scalar (Git add-on to manage large-scale repositories)"; Types: default
#endif
[Run]
Filename: {app}\git-bash.exe; Parameters: --cd-to-home; Description: Launch Git Bash; Flags: nowait postinstall skipifsilent runasoriginaluser unchecked
Filename: {app}\ReleaseNotes.html; Description: View Release Notes; Flags: shellexec skipifdoesntexist postinstall skipifsilent
[Files]
; Install files that might be in use during setup under a different name.
#include "file-list.iss"
Source: {#SourcePath}\ReleaseNotes.html; DestDir: {app}; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore
Source: {#SourcePath}\..\LICENSE.txt; DestDir: {app}; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore
Source: {#SourcePath}\NOTICE.txt; DestDir: {app}; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore; Check: ParamIsSet('VSNOTICE')
#ifdef INCLUDE_EDIT_GIT_BASH
Source: {#SourcePath}\..\edit-git-bash.exe; Flags: dontcopy
#endif
[Dirs]
Name: "{app}\dev"
Name: "{app}\dev\mqueue"
Name: "{app}\dev\shm"
Name: "{app}\tmp"
Name: "{commonappdata}\Microsoft\Windows Terminal\Fragments\Git"; Components: windowsterminal; Check: IsAdminLoggedOn
Name: "{localappdata}\Microsoft\Windows Terminal\Fragments\Git"; Components: windowsterminal; Check: not IsAdminLoggedOn
[Icons]
Name: {group}\Git GUI; Filename: {app}\cmd\git-gui.exe; Parameters: ""; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
Name: {group}\Git Bash; Filename: {app}\git-bash.exe; Parameters: "--cd-to-home"; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
Name: {group}\Git CMD; Filename: {app}\git-cmd.exe; Parameters: "--cd-to-home"; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
Name: {group}\Git Release Notes; Filename: {app}\ReleaseNotes.html; Parameters: ""; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
Name: {group}\Git FAQs (Frequently Asked Questions); Filename: https://github.com/git-for-windows/git/wiki/FAQ; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
[Messages]
BeveledLabel={#APP_URL}
#ifdef WINDOW_TITLE_VERSION
SetupAppTitle={#APP_NAME} {#WINDOW_TITLE_VERSION} Setup
SetupWindowTitle={#APP_NAME} {#WINDOW_TITLE_VERSION} Setup
#else
SetupAppTitle={#APP_NAME} {#APP_VERSION} Setup
SetupWindowTitle={#APP_NAME} {#APP_VERSION} Setup
#endif
[Registry]
; Aides installing third-party (credential, remote, etc) helpers
Root: HKLM; Subkey: Software\GitForWindows; ValueType: string; ValueName: CurrentVersion; ValueData: {#APP_VERSION}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn
Root: HKLM; Subkey: Software\GitForWindows; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn
Root: HKLM; Subkey: Software\GitForWindows; ValueType: string; ValueName: LibexecPath; ValueData: {app}\{#MINGW_BITNESS}\libexec\git-core; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn
Root: HKCU; Subkey: Software\GitForWindows; ValueType: string; ValueName: CurrentVersion; ValueData: {#APP_VERSION}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: Software\GitForWindows; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: Software\GitForWindows; ValueType: string; ValueName: LibexecPath; ValueData: {app}\{#MINGW_BITNESS}\libexec\git-core; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn
; There is no "Console" key in HKLM.
Root: HKCU; Subkey: Console; ValueType: string; ValueName: FaceName; ValueData: Lucida Console; Flags: uninsclearvalue; Components: consolefont
Root: HKCU; Subkey: Console; ValueType: dword; ValueName: FontFamily; ValueData: $00000036; Components: consolefont
Root: HKCU; Subkey: Console; ValueType: dword; ValueName: FontSize; ValueData: $000e0000; Components: consolefont
Root: HKCU; Subkey: Console; ValueType: dword; ValueName: FontWeight; ValueData: $00000190; Components: consolefont
Root: HKCU; Subkey: Console\Git Bash; ValueType: string; ValueName: FaceName; ValueData: Lucida Console; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git Bash; ValueType: dword; ValueName: FontFamily; ValueData: $00000036; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git Bash; ValueType: dword; ValueName: FontSize; ValueData: $000e0000; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git Bash; ValueType: dword; ValueName: FontWeight; ValueData: $00000190; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: string; ValueName: FaceName; ValueData: Lucida Console; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: dword; ValueName: FontFamily; ValueData: $00000036; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: dword; ValueName: FontSize; ValueData: $000e0000; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: dword; ValueName: FontWeight; ValueData: $00000190; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
; Note that we write the Registry values below either to HKLM or to HKCU depending on whether the user running the installer
; is a member of the local Administrators group or not (see the "Check" argument).
; File associations for configuration files that may be contained in a repository (so this does not include ".gitconfig").
Root: HKLM; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitignore; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitignore; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
; Associate .sh extension with sh.exe so those files are double-clickable,
; startable from cmd.exe, and when files are dropped on them they are passed
; as arguments to the script.
; Install under HKEY_LOCAL_MACHINE if an administrator is installing.
Root: HKLM; Subkey: Software\Classes\.sh; ValueType: string; ValueData: sh_auto_file; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file; ValueType: string; ValueData: "Shell Script"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file\shell\open\command; ValueType: string; ValueData: """{app}\git-bash.exe"" --no-cd ""%L"" %*"; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file\DefaultIcon; ValueType: string; ValueData: "%SystemRoot%\System32\shell32.dll,-153"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file\ShellEx\DropHandler; ValueType: string; ValueData: {#DROP_HANDLER_GUID}; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
; Install under HKEY_CURRENT_USER if a non-administrator is installing.
Root: HKCU; Subkey: Software\Classes\.sh; ValueType: string; ValueData: sh_auto_file; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file; ValueType: string; ValueData: "Shell Script"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file\shell\open\command; ValueType: string; ValueData: """{app}\git-bash.exe"" --no-cd ""%L"" %*"; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file\DefaultIcon; ValueType: string; ValueData: "%SystemRoot%\System32\shell32.dll,-153"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file\ShellEx\DropHandler; ValueType: string; ValueData: {#DROP_HANDLER_GUID}; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
[UninstallDelete]
; Delete the built-ins.
Type: files; Name: {app}\{#MINGW_BITNESS}\bin\git-*.exe
Type: files; Name: {app}\{#MINGW_BITNESS}\libexec\git-core\git-*.exe
Type: files; Name: {app}\{#MINGW_BITNESS}\libexec\git-core\git.exe
; Delete git-lfs wrapper
Type: files; Name: {app}\cmd\git-lfs.exe
; Delete copied *.dll files
Type: files; Name: {app}\{#MINGW_BITNESS}\libexec\git-core\*.dll
; Delete the dynamical generated MSYS2 files
Type: files; Name: {app}\etc\hosts
Type: files; Name: {app}\etc\mtab
Type: files; Name: {app}\etc\networks
Type: files; Name: {app}\etc\protocols
Type: files; Name: {app}\etc\services
Type: files; Name: {app}\dev\fd
Type: files; Name: {app}\dev\stderr
Type: files; Name: {app}\dev\stdin
Type: files; Name: {app}\dev\stdout
Type: dirifempty; Name: {app}\dev\mqueue
Type: dirifempty; Name: {app}\dev\shm
Type: dirifempty; Name: {app}\dev
; Delete any manually created shortcuts.
Type: files; Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\Git Bash.lnk
Type: files; Name: {code:GetShellFolder|desktop}\Git Bash.lnk
Type: files; Name: {app}\Git Bash.lnk
; Delete a home directory inside the Git for Windows directory.
Type: dirifempty; Name: {app}\home\{username}
Type: dirifempty; Name: {app}\home
#if BITNESS=='32'
; Delete the files required for rebaseall
Type: files; Name: {app}\bin\msys-2.0.dll
Type: files; Name: {app}\bin\rebase.exe
Type: dirifempty; Name: {app}\bin
Type: files; Name: {app}\etc\rebase.db.i386
Type: dirifempty; Name: {app}\etc
#endif
; 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}
; Delete Git Bash options
Type: files; Name: {app}\etc\git-bash.config
; Delete Windows Terminal profile fragments
Type: files; Name: {commonappdata}\Microsoft\Windows Terminal\Fragments\Git\git-bash.json
Type: files; Name: {localappdata}\Microsoft\Windows Terminal\Fragments\Git\git-bash.json
[Code]
#include "helpers.inc.iss"
#include "environment.inc.iss"
#include "putty.inc.iss"
#include "modules.inc.iss"
#include "exec-with-capture.inc.iss"
function ParamIsSet(Key:String):Boolean;
begin
Result:=CompareStr('0',ExpandConstant('{param:'+Key+'|0}'))<>0;
end;
function CreateHardLink(lpFileName,lpExistingFileName:String;lpSecurityAttributes:Integer):Boolean;
#ifdef UNICODE
external '[email protected] stdcall delayload setuponly';
#else
external '[email protected] stdcall delayload setuponly';
#endif
function OverrideGitBashCommandLine(GitBashPath:String;CommandLine:String):Integer;
var
Msg:String;
begin
#ifdef INCLUDE_EDIT_GIT_BASH
if not FileExists(ExpandConstant('{tmp}\edit-git-bash.exe')) then
ExtractTemporaryFile('edit-git-bash.exe');
#endif
StringChangeEx(GitBashPath,'"','\"',True);
StringChangeEx(CommandLine,'"','\"',True);
CommandLine:='"'+GitBashPath+'" "'+CommandLine+'"';
#ifdef INCLUDE_EDIT_GIT_BASH
Exec(ExpandConstant('{tmp}\edit-git-bash.exe'),CommandLine,'',SW_HIDE,ewWaitUntilTerminated,Result);
#else
Exec(ExpandConstant('{app}\{#MINGW_BITNESS}\share\git\edit-git-bash.exe'),CommandLine,'',SW_HIDE,ewWaitUntilTerminated,Result);
#endif
if Result<>0 then begin
if Result=1 then begin
Msg:='Unable to edit '+GitBashPath+' (out of memory).';
end else if Result=2 then begin
Msg:='Unable to open '+GitBashPath+' for editing.';
end else if Result=3 then begin
Msg:='Unable to edit the command-line of '+GitBashPath+'.';
end else if Result=4 then begin
Msg:='Unable to close '+GitBashPath+' after editing.';
end;
LogError(Msg);
end;
end;
const
// Git Editor options.
GE_Nano = 0;
GE_VIM = 1;
GE_NotepadPlusPlus = 2;
GE_VisualStudioCode = 3;
GE_VisualStudioCodeInsiders = 4;
GE_SublimeText = 5;
GE_Atom = 6;
GE_VSCodium = 7;
GE_Notepad = 8;
GE_Wordpad = 9;
GE_CustomEditor = 10;
// Git Path options.
GP_BashOnly = 1;
GP_Cmd = 2;
GP_CmdTools = 3;
// Default Branch options.
DB_Unspecified = 1;
DB_Manual = 2;
// Git SSH options.
GS_OpenSSH = 1;
GS_Plink = 2;
GS_ExternalOpenSSH = 3;
// Git HTTPS (cURL) options.
GC_OpenSSL = 1;
GC_WinSSL = 2;
// Git line ending conversion options.
GC_LFOnly = 1;
GC_CRLFAlways = 2;
GC_CRLFCommitAsIs = 3;
// Git Bash terminal settings.
GB_MinTTY = 1;
GB_ConHost = 2;
// `git pull` behavior settings.
GP_GitPullMerge = 1;
GP_GitPullRebase = 2;
GP_GitPullFFOnly = 3;
// Git Credential Manager settings.
GCM_None = 1;
GCM = 2;
// Extra options
GP_FSCache = 1;
GP_Symlinks = 2;
#ifdef WITH_EXPERIMENTAL_BUILTIN_DIFFTOOL
#define HAVE_EXPERIMENTAL_OPTIONS 1
#endif
#ifdef WITH_EXPERIMENTAL_BUILTIN_REBASE
#define HAVE_EXPERIMENTAL_OPTIONS 1
#endif
#ifdef WITH_EXPERIMENTAL_BUILTIN_STASH
#define HAVE_EXPERIMENTAL_OPTIONS 1
#endif
#ifdef WITH_EXPERIMENTAL_BUILTIN_ADD_I
#define HAVE_EXPERIMENTAL_OPTIONS 1
#endif
#ifdef WITH_EXPERIMENTAL_PCON
#define HAVE_EXPERIMENTAL_OPTIONS 1
#endif
#ifdef WITH_EXPERIMENTAL_BUILTIN_FSMONITOR
#define HAVE_EXPERIMENTAL_OPTIONS 1
#endif
#ifdef HAVE_EXPERIMENTAL_OPTIONS
// Experimental options
GP_BuiltinDifftool = 1;
GP_BuiltinRebase = 2;
GP_BuiltinStash = 3;
GP_BuiltinAddI = 4;
GP_EnablePCon = 5;
GP_EnableFSMonitor = 6;
#endif
var
AppDir,UninstallAppPath,UninstallString:String;
InferredDefaultKeys,InferredDefaultValues:TStringList;
// The options chosen at install time, to be written to /etc/install-options.txt
ChosenOptions:String;
// Accumulated set of custom pages that have options, and those that have 'new' parameters on them
CurrentCustomPageID,FirstCustomPageID:Integer;
AllCustomPages,CustomPagesWithUnseenOptions:String;
HasUnseenComponents:Boolean;
// Previous Git for Windows version (if upgrading)
PreviousGitForWindowsVersion:String;
// Wizard page and variables for the Editor options.
EditorPage:TInputFileWizardPage;
CbbEditor:TNewComboBox;
LblEditor:array[GE_Nano..GE_CustomEditor] of array of TLabel;
EditorAvailable:array[GE_Nano..GE_CustomEditor] of Boolean;
SelectedEditor:Integer;
VisualStudioCodeUserInstallation:Boolean;
VisualStudioCodeInsidersUserInstallation:Boolean;
SublimeTextUserInstallation:Boolean;
VSCodiumUserInstallation:Boolean;
NotepadPlusPlusPath:String;
VisualStudioCodePath:String;
VisualStudioCodeInsidersPath:String;
SublimeTextPath:String;
AtomPath:String;
VSCodiumPath:String;
CustomEditorPath:String;
CustomEditorOptions:String;
// Wizard page and variables for the Default Branch options.
DefaultBranchPage:TWizardPage;
RdbDefaultBranch:array[DB_Unspecified..DB_Manual] of TRadioButton;
EdtDefaultBranch:TEdit;
// Wizard page and variables for the Path options.
PathPage:TWizardPage;
RdbPath:array[GP_BashOnly..GP_CmdTools] of TRadioButton;
// Wizard page and variables for the SSH options.
SSHChoicePage:TWizardPage;
RdbSSH:array[GS_OpenSSH..GS_ExternalOpenSSH] of TRadioButton;
EdtPlink:TEdit;
TortoisePlink:TCheckBox;
// Wizard page and variables for the HTTPS implementation (cURL) settings.
CurlVariantPage:TWizardPage;
RdbCurlVariant:array[GC_OpenSSL..GC_WinSSL] of TRadioButton;
// Wizard page and variables for the line ending conversion options.
CRLFPage:TWizardPage;
RdbCRLF:array[GC_LFOnly..GC_CRLFCommitAsIs] of TRadioButton;
// Wizard page and variables for the terminal emulator settings.
BashTerminalPage:TWizardPage;
RdbBashTerminal:array[GB_MinTTY..GB_ConHost] of TRadioButton;
// Wizard page and variables for the `git pull` options.
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] of TRadioButton;
// Wizard page and variables for the extra options.
ExtraOptionsPage:TWizardPage;
RdbExtraOptions:array[GP_FSCache..GP_Symlinks] of TCheckBox;
#ifdef HAVE_EXPERIMENTAL_OPTIONS
// Wizard page and variables for the experimental options.
ExperimentalOptionsPage:TWizardPage;
RdbExperimentalOptions:array[GP_BuiltinDifftool..GP_EnableFSMonitor] of TCheckBox;
#endif
// Mapping controls to hyperlinks
HyperlinkSource:array of TObject;
HyperlinkTarget:array of String;
HyperlinkCount:Integer;
// Wizard page and variables for the processes page.
SessionHandle:DWORD;
Processes:ProcessList;
ProcessesPage:TWizardPage;
ProcessesListBox:TListBox;
ProcessesRefresh,ContinueButton,TestCustomEditorButton:TButton;
OnlyShowNewOptions:TCheckBox;
PageIDBeforeInstall:Integer;
#ifdef DEBUG_WIZARD_PAGE
DebugWizardPage:Integer;
#endif
{
Specific helper functions
}
procedure BrowseForPuTTYFolder(Sender:TObject);
var
Name:String;
begin
if GetOpenFileName(
'Please select a Plink executable'
, Name
, ExtractFilePath(EdtPlink.Text)
, 'Executable Files|*.exe'
, 'exe'
)
then begin
if IsPlinkExecutable(Name) then begin
EdtPlink.Text:=Name;
RdbSSH[GS_Plink].Checked:=True;
end else begin
// This message box only gets triggered on interactive use, so it
// does not need to be suppressible for silent installations.
MsgBox('{#PLINK_PATH_ERROR_MSG}',mbError,MB_OK);
end;
end;
end;
procedure DeleteContextMenuEntries;
var
Command:String;
RootKey,i:Integer;
Keys:TArrayOfString;
begin
if IsAdminLoggedOn then begin
RootKey:=HKEY_LOCAL_MACHINE;
end else begin
RootKey:=HKEY_CURRENT_USER;
end;
SetArrayLength(Keys,4);
Keys[0]:='SOFTWARE\Classes\Directory\shell\git_shell';
Keys[1]:='SOFTWARE\Classes\Directory\Background\shell\git_shell';
Keys[2]:='SOFTWARE\Classes\Directory\shell\git_gui';
Keys[3]:='SOFTWARE\Classes\Directory\Background\shell\git_gui';
for i:=0 to Length(Keys)-1 do begin
Command:='';
RegQueryStringValue(RootKey,Keys[i]+'\command','',Command);
if Pos(AppDir,Command)>0 then begin
if not RegDeleteKeyIncludingSubkeys(RootKey,Keys[i]) then begin
LogError('Line {#__LINE__}: Unable to remove "Git Bash / GUI Here" shell extension.');
end;
end;
end;
end;
var
BuiltinFSMonitorStopOption,AlreadyHandledFSMonitorPaths:String;
// Returns true if at least one FSMonitor daemon was shut down successfully
function ShutdownFSMonitorDaemons():Boolean;
var
FindRec:TFindRec;
ExitCode:DWORD;
Path,Str:String;
Len,i:Integer;
begin
Result:=False;
#ifdef WITH_EXPERIMENTAL_BUILTIN_FSMONITOR
if (BuiltinFSMonitorStopOption='(huh?)') then
Exit;
if not FindFirst('\\.\pipe\*',FindRec) then
Exit;
if (AlreadyHandledFSMonitorPaths='') then
AlreadyHandledFSMonitorPaths:=#0;
repeat
if WildcardMatch(FindRec.Name,'*\fsmonitor--daemon.ipc') or WildcardMatch(FindRec.Name,'*\.git\fsmonitor') then begin
if (Pos(#0+FindRec.Name+#0,AlreadyHandledFSMonitorPaths)>0) then
Continue;
AlreadyHandledFSMonitorPaths:=AlreadyHandledFSMonitorPaths+FindRec.Name+#0;
// An earlier `fsmonitor--daemon` iteration called it `--stop`, not `stop`;
// Find out which form to use.
if (BuiltinFSMonitorStopOption='') then begin
BuiltinFSMonitorStopOption:='(huh?)';
if not ExecWithCapture('"'+AppDir+'\cmd\git.exe" fsmonitor--daemon -h',Str,Str,ExitCode) or (ExitCode<>129) then begin
if (i<>1) and (i<>127) then // Suppress message if `git.exe` was not found, or if it does not know about the built-in FSMonitor
LogError('Could not get FSMonitor help (exit code '+IntToStr(ExitCode)+'):'+#13+Str);
Exit;
end else begin
i:=Pos('stop'+#10,Str);
if (i=0) then begin
LogError('Could not determine stop option from:'+#13+Str);
Exit;
end;
if (i>2) and (Str[i-1]='-') and (Str[i-2]='-') then
BuiltinFSMonitorStopOption:='--stop'
else
BuiltinFSMonitorStopOption:='stop';
end;
Str:='';
end;
// The colon was replaced with an underscore by the FSMonitor daemon
Len:=Length(FindRec.Name);
if WildcardMatch(FindRec.Name,'*\fsmonitor--daemon.ipc') then
Len:=Len-22
else
Len:=Len-10;
Path:=Copy(FindRec.Name,1,Len);
if (Length(Path)>2) and (Path[2]='_') then
Path[2]:=':';
// Now we have the gitdir, but we need to get to the worktree
if FileExists(Path+'\gitdir') then begin
Path:=ReadFileAsString(Path+'\gitdir');
StringChangeEx(Path,'/','\',True);
end;
if WildcardMatch(Path,'*\.git') then
Path:=Copy(Path,1,Length(Path)-5);
if ExecSilently('"'+AppDir+'\cmd\git.exe" -C "'+Path+'" fsmonitor--daemon '+BuiltinFSMonitorStopOption,'fsmonitor-stop','Could not stop FSMonitor daemon in '+Path) then
Result:=True;
end;
until not FindNext(FindRec);
#endif
end;
procedure RefreshProcessList(Sender:TObject);
var
Version:TWindowsVersion;
Modules:TArrayOfString;
ProcsCloseRequired,ProcsCloseOptional:ProcessList;
i:Longint;
Caption:String;
ManualClosingRequired:Boolean;
begin
if (AppDir='') then begin
SetArrayLength(Processes,0);
Exit;
end;
// Use the Restart Manager API when installing the shell extension.
AppendToArray(Modules,AppDir+'\usr\bin\msys-2.0.dll');
AppendToArray(Modules,AppDir+'\{#MINGW_BITNESS}\bin\tcl85.dll');
AppendToArray(Modules,AppDir+'\{#MINGW_BITNESS}\bin\tk85.dll');
AppendToArray(Modules,AppDir+'\{#MINGW_BITNESS}\bin\tcl86.dll');
AppendToArray(Modules,AppDir+'\{#MINGW_BITNESS}\bin\tk86.dll');
AppendToArray(Modules,AppDir+'\{#MINGW_BITNESS}\bin\zlib1.dll');
AppendToArray(Modules,AppDir+'\{#MINGW_BITNESS}\libexec\git-core\zlib1.dll');
SessionHandle:=FindProcessesUsingModules(Modules,Processes);
if (GetArrayLength(Processes)>0) and ShutdownFSMonitorDaemons() then begin
// We potentially shut down at least one process, refresh again
RmEndSession(SessionHandle);
SessionHandle:=FindProcessesUsingModules(Modules,Processes);
end;
ManualClosingRequired:=False;
ProcessesListBox.Items.Clear;
if (Sender=NIL) or (SessionHandle>0) then begin
for i:=0 to GetArrayLength(Processes)-1 do begin
Caption:=Processes[i].Name+' (PID '+IntToStr(Processes[i].ID);
if Processes[i].Restartable then begin
Caption:=Caption+', closing is optional';
end else if Processes[i].ToTerminate then begin
Caption:=Caption+', will be terminated';
end else begin
Caption:=Caption+', closing is required';
ManualClosingRequired:=True;
end;
Caption:=Caption+')';
ProcessesListBox.Items.Append(Caption);
end;
end;
if ContinueButton<>NIL then begin
ContinueButton.Enabled:=not ManualClosingRequired;
end;
end;
procedure SetAndMarkEnvString(Name,Value:String;Expandable:Boolean);
var
Env:TArrayOfString;
FileName:String;
begin
SetArrayLength(Env,1);
Env[0]:=Value;
// Try to set the variable as specified by the user.
if not SetEnvStrings(Name,Env,Expandable,IsAdminLoggedOn,True) then
LogError('Line {#__LINE__}: Unable to set the '+Name+' environment variable.')
else begin
// Mark that we have changed the variable by writing its value to a file.
FileName:=ExpandConstant('{app}')+'\setup.ini';
if not SetIniString('Environment',Name,Value,FileName) then
LogError('Line {#__LINE__}: Unable to write to file "'+FileName+'".');
end;
end;
procedure DeleteMarkedEnvString(Name:String);
var
Env:TArrayOfString;
FileName:String;
begin
Env:=GetEnvStrings(Name,IsAdminLoggedOn);
FileName:=ExpandConstant('{app}')+'\setup.ini';
if (GetArrayLength(Env)=1) and
(CompareStr(RemoveQuotes(Env[0]),GetIniString('Environment',Name,'',FileName))=0) then begin
if not SetEnvStrings(Name,[],False,IsAdminLoggedOn,True) then
LogError('Line {#__LINE__}: Unable to delete the '+Name+' environment variable.');
end;
end;
function ShellQuote(Value:String):String;
begin
// Sadly, we cannot use the '\'' trick used throughout Git's
// source code, as InnoSetup quotes those in a way that
// git.exe does not understand them.
//
// So we try to imitate quote_arg_msvc() in Git's
// compat/mingw.c instead: \ => \\, followed by " => \",
// then surround with double quotes.
StringChangeEx(Value,#92,#92+#92,True);
StringChangeEx(Value,#34,#92+#34,True);
Result:=#34+Value+#34;
end;
function GitSystemConfigSet(Key,Value:String):Boolean;
var
ExitCode:DWORD;
StdOut,StdErr:String;
begin
if (Value=#0) then begin
if ExecWithCapture('"'+AppDir+'\{#MINGW_BITNESS}\bin\git.exe" config --system --unset-all '+Key,StdOut,StdErr,ExitCode) And ((ExitCode=0) Or (ExitCode=5)) then
// exit code 5 means it was already unset, so that's okay
Result:=True
else begin
LogError('Unable to unset system config "'+Key+'": exit code '+IntToStr(ExitCode)+#13+#10+StdOut+#13+#10+'stderr:'+#13+#10+StdErr);
Result:=False
end
end else if ExecWithCapture('"'+AppDir+'\{#MINGW_BITNESS}\bin\git.exe" config --system --replace-all '+ShellQuote(Key)+' '+ShellQuote(Value),StdOut,StdErr,ExitCode) And (ExitCode=0) then
Result:=True
else begin
LogError('Unable to set system config "'+Key+'":="'+Value+'": exit code '+IntToStr(ExitCode)+#13+#10+StdOut+#13+#10+'stderr:'+#13+#10+StdErr);
Result:=False;
end;
end;
procedure RecordInferredDefault(Key,Value:String);
var
i:Integer;
begin
i:=InferredDefaultKeys.IndexOf(Key); // cannot use .Find because the list is not sorted
if (i>=0) then
InferredDefaultValues[i]:=Value
else begin
i:=InferredDefaultKeys.Add(Key);
InferredDefaultValues.Add(Value)
end;
end;
function EndsWith(S:String;T:String):Boolean;
begin
if (Length(S)>Length(T)) then
Delete(S,1,Length(S)-Length(T));
Result:=(CompareText(S,T)=0)
end;
function GetDefaultsFromGitConfig(WhichOne:String):Boolean;
var
ExtraOptions,StdOut,StdErr,Key,Value:String;
ExitCode:DWORD;
Values:TArrayOfString;
c,i,j,k:Integer;
begin
if AppDir='' then begin
// No previous installation detected, therefore we cannot execute `git config`
Result:=True;
Exit;
end;
case WhichOne of
'ProgramData': ExtraOptions:='-f "'+ExpandConstant('{commonappdata}\Git\config')+'"';
'system': ExtraOptions:='--system';
else
begin
LogError('Invalid config type: '+WhichOne);
Result:=False;
Exit
end
end;
if not ExecWithCapture('"'+AppDir+'\{#MINGW_BITNESS}\bin\git.exe" config -l -z '+ExtraOptions,StdOut,StdErr,ExitCode) then begin
if FileExists(AppDir+'\{#MINGW_BITNESS}\bin\git.exe') then
LogError('Unable to get system config (exit code '+IntToStr(ExitCode)+'):'+#13+#10+StdErr);
end;
// Split NUL-delimited key/value pairs, extract LF that denotes end of key
Value:=StdOut;
i:=1; j:=i; k:=i;
while (j<=Length(StdOut)) do begin
c:=Ord(StdOut[j]);
if (c=10) then
k:=j
else if (c=0) then begin
if (i<>k) then begin // Ignore keys without values
Key:=Copy(StdOut,i,k-i);
Value:=Copy(StdOut,k+1,j-k-1);
case Key of
'http.sslbackend':
case Value of
'schannel': RecordInferredDefault('CURL Option','WinSSL');
'openssl': RecordInferredDefault('CURL Option','OpenSSL');
end;
'core.autocrlf':
case Value of
'true': RecordInferredDefault('CRLF Option','CRLFAlways');
'false': RecordInferredDefault('CRLF Option','CRLFCommitAsIs');
'input': RecordInferredDefault('CRLF Option','LFOnly');
end;
'core.fscache':
case Value of
'true': RecordInferredDefault('Performance Tweaks FSCache','Enabled');
'false': RecordInferredDefault('Performance Tweaks FSCache','Disabled');
end;
'credential.helper':
case Value of
'manager': RecordInferredDefault('Use Credential Manager','Enabled');
'manager-core': RecordInferredDefault('Use Credential Manager','Enabled');
else
begin
if EndsWith(Value,'manager-core') or EndsWith(Value,'manager') then
RecordInferredDefault('Use Credential Manager','Enabled')
else
RecordInferredDefault('Use Credential Manager','Disabled');
end;
end;
'core.symlinks':
case Value of
'true': RecordInferredDefault('Enable Symlinks','Enabled');
'false': RecordInferredDefault('Enable Symlinks','Disabled');
end;
'pull.ff':
case Value of
'only': RecordInferredDefault('Git Pull Behavior Option','FFOnly');
end;
'pull.rebase':
case Value of
'true': RecordInferredDefault('Git Pull Behavior Option','Rebase');
'false': RecordInferredDefault('Git Pull Behavior Option','Merge');
end;
end;
end;
i:=j+1;
j:=i;
k:=i;
end;
j:=j+1;
end;
Result:=True;
end;
{
Setup event functions
}
function NextNumber(Str:String;var Pos:Integer):Integer;
var
From:Integer;
begin
From:=Pos;
while (Pos<=Length(Str)) and (Str[Pos]>=#48) and (Str[Pos]<=#57) do
Pos:=Pos+1;
if Pos>From then
Result:=StrToInt(Copy(Str,From,Pos-From))
else
Result:=-1;
end;
function VersionCompare(CurrentVersion,PreviousVersion:String):Integer;
var
i,j,Current,Previous:Integer;
begin
Result:=0;
i:=1;
j:=1;
while True do begin
if j>Length(PreviousVersion) then begin
Result:=+1;
Exit;
end;
if i>Length(CurrentVersion) then begin
Result:=-1;
Exit;
end;
Previous:=NextNumber(PreviousVersion,j);
Current:=NextNumber(CurrentVersion,i);
if Previous<0 then begin
if Current>=0 then
Result:=+1;
Result:=Ord(CurrentVersion[i])-Ord(PreviousVersion[j]);
if (Result=0) then begin
// skip identical non-numerical characters
i:=i+1;
j:=j+1;
Continue;
end;
Exit;
end;
if Current<0 then begin
Result:=-1;
Exit;
end;
if Current>Previous then begin
Result:=+1;
Exit;
end;
if Current<Previous then begin
Result:=-1;
Exit;
end;
if j>Length(PreviousVersion) then begin
if i<=Length(CurrentVersion) then
Result:=+1;
Exit;
end;
if i>Length(CurrentVersion) then begin
Result:=-1;
Exit;
end;
if CurrentVersion[i]<>PreviousVersion[j] then begin
if PreviousVersion[j]='.' then
Result:=-1
else
Result:=+1;
Exit;
end;
if CurrentVersion[i]<>'.' then
Exit;
i:=i+1;
j:=j+1;
end;
end;
procedure ExitProcess(uExitCode:Integer);
external '[email protected] stdcall';
procedure ExitEarlyWithSuccess();
begin
DelTree(ExpandConstant('{tmp}'),True,True,True);
ExitProcess(0);
end;
function CountDots(S:String):Integer;
var
i:Integer;
begin
Result:=0;
for i:=1 to Length(S) do
if (S[i]=#46) then
Result:=Result+1;
end;
var
PreviousGitVersion:String;
PreviousGitVersionInitialized:Boolean;
function GetPreviousGitVersion():String;
var
Path,StdOut,StdErr:String;
ExitCode:DWORD;
begin
if not PreviousGitVersionInitialized then begin
PreviousGitVersionInitialized:=True;