From 7fca3c9b1f301673c70071e64e8f13eea6692074 Mon Sep 17 00:00:00 2001
From: florian <florian@freepascal.org>
Date: Sat, 21 Aug 2021 20:36:29 +0200
Subject: [PATCH]   * check if git executable really exists

(cherry picked from commit a77f5221f341b32bb964c03dc61c1e80b71714dd)
---
 compiler/Makefile     | 4 +++-
 compiler/Makefile.fpc | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/compiler/Makefile b/compiler/Makefile
index 22ee2f3924..cfb14a481a 100644
--- a/compiler/Makefile
+++ b/compiler/Makefile
@@ -413,7 +413,9 @@ ifdef SOURCE_DATE_EPOCH
 else
    GIT_DIR = $(wildcard ../.git)
    ifneq ($(GIT_DIR),)
-      COMPDATESTR:=$(shell $(GIT) log -1 --pretty=%cd --date=format:'%Y/%m/%d')
+      ifneq ($(GIT),)
+	COMPDATESTR:=$(shell $(GIT) log -1 --pretty=%cd --date=format:'%Y/%m/%d')
+      endif
    endif
 endif
 ifdef COMPDATESTR
diff --git a/compiler/Makefile.fpc b/compiler/Makefile.fpc
index a349a120df..86d150eca6 100644
--- a/compiler/Makefile.fpc
+++ b/compiler/Makefile.fpc
@@ -143,7 +143,9 @@ else
    GIT_DIR = $(wildcard ../.git)
    ifneq ($(GIT_DIR),)
       # ... then take date from head
-      COMPDATESTR:=$(shell $(GIT) log -1 --pretty=%cd --date=format:'%Y/%m/%d')
+      ifneq ($(GIT),)
+        COMPDATESTR:=$(shell $(GIT) log -1 --pretty=%cd --date=format:'%Y/%m/%d')
+      endif
    endif
 endif