Signed-Off-By: Martin Atukunda <redacted>
---
Makefile | 3 +++
init-db.c | 15 +++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
applies-to: ec55de586902d26b3f55c3d0aeabf94be1b82586
ec733719bfee2ade91416bd429eeefe6c4acb5a8
diff --git a/Makefile b/Makefile
index 74c6b9e..c167120 100644
--- a/Makefile
+++ b/Makefile
@@ -400,6 +400,9 @@ git-rev-list$X: LIBS += $(OPENSSL_LIBSSL
init-db.o: init-db.c
$(CC) -c $(ALL_CFLAGS) \
+ -DVERSION='"$(VERSION)"' \
+ -DPATCHLEVEL='"$(PATCHLEVEL)"' \
+ -DSUBLEVEL='"$(SUBLEVEL)"' \
-DDEFAULT_GIT_TEMPLATE_DIR=$(call shellquote,"$(template_dir)") $*.c
$(LIB_OBJS): $(LIB_H)
diff --git a/init-db.c b/init-db.c
index bd88291..6230e8e 100644
--- a/init-db.c
+++ b/init-db.c
@@ -19,6 +19,17 @@ static void safe_create_dir(const char *
}
}
+static void record_repo_version(const char *path)
+{
+ FILE *verfile = fopen(path, "w");
+ if (!verfile)
+ die ("Can not write to %s?", path);
+
+ fprintf(verfile, "%d.%d.%d\n", VERSION, PATCHLEVEL, SUBLEVEL);
+
+ fclose(verfile);
+}
+
static int copy_file(const char *dst, const char *src, int mode)
{
int fdi, fdo, status;@@ -212,6 +223,10 @@ static void create_default_files(const c
fprintf(stderr, "Ignoring file modes\n");
}
}
+
+ /* record the version of the git repo */
+ strcpy(path + len, "version");
+ record_repo_version(path);
}
static const char init_db_usage[] =
---
0.99.9.GIT