Skip to content

Commit aaf37e9

Browse files
committed
Provide a Windows version resource for the git executables.
Embeds the git version and description into the git executable thus implementing the request in issue #5. Acked-by: Heiko Voigt <[email protected]> Acked-by: Sebastian Schuberth <[email protected]> Acked-by: Johannes Schindelin <[email protected]> Signed-off-by: Pat Thoyts <[email protected]>
1 parent 2d38020 commit aaf37e9

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
/cscope*
223223
*.obj
224224
*.lib
225+
*.res
225226
*.sln
226227
*.suo
227228
*.ncb

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,9 @@ ifneq (,$(findstring MINGW,$(uname_S)))
13401340
compat/win32/pthread.o compat/win32/syslog.o \
13411341
compat/win32/poll.o compat/win32/dirent.o
13421342
EXTLIBS += -lws2_32
1343+
GITLIBS += git.res
13431344
PTHREAD_LIBS =
1345+
RC = windres -O coff
13441346
X = .exe
13451347
SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
13461348
ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
@@ -1831,6 +1833,7 @@ ifndef V
18311833
QUIET_MSGFMT = @echo ' ' MSGFMT $@;
18321834
QUIET_GCOV = @echo ' ' GCOV $@;
18331835
QUIET_SP = @echo ' ' SP $<;
1836+
QUIET_RC = @echo ' ' RC $@;
18341837
QUIET_SUBDIR0 = +@subdir=
18351838
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
18361839
$(MAKE) $(PRINT_DIR) -C $$subdir
@@ -2018,6 +2021,11 @@ $(SCRIPT_LIB) : % : %.sh
20182021
$(QUIET_GEN)$(cmd_munge_script) && \
20192022
mv $@+ $@
20202023

2024+
git.res: git.rc
2025+
$(QUIET_RC)$(RC) \
2026+
$(join -DMAJOR= -DMINOR= -DPATCH=, $(wordlist 1,3,$(subst ., ,$(GIT_VERSION)))) \
2027+
-DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@
2028+
20212029
ifndef NO_PERL
20222030
$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
20232031

@@ -2705,7 +2713,7 @@ profile-clean:
27052713
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
27062714

27072715
clean: profile-clean
2708-
$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
2716+
$(RM) *.o *.res block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
27092717
builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
27102718
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
27112719
$(RM) $(TEST_PROGRAMS)

git.rc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1 VERSIONINFO
2+
FILEVERSION MAJOR,MINOR,PATCH,0
3+
PRODUCTVERSION MAJOR,MINOR,PATCH,0
4+
BEGIN
5+
BLOCK "StringFileInfo"
6+
BEGIN
7+
BLOCK "040904b0" /* LANG_ENGLISH/SUBLANG_ENGLISH_US, Unicode CP */
8+
BEGIN
9+
VALUE "CompanyName", "The Git Development Community\0"
10+
VALUE "FileDescription", "Git for Windows\0"
11+
VALUE "InternalName", "git\0"
12+
VALUE "OriginalFilename", "git.exe\0"
13+
VALUE "ProductName", "Git\0"
14+
VALUE "ProductVersion", GIT_VERSION "\0"
15+
END
16+
END
17+
18+
BLOCK "VarFileInfo"
19+
BEGIN
20+
VALUE "Translation", 0x409, 1200
21+
END
22+
END

0 commit comments

Comments
 (0)