git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Atukunda <matlads@dsmagic.com>
To: git@vger.kernel.org
Cc: Martin Atukunda <matlads@dsmagic.com>
Subject: [PATCH 2/2] Make init-db record the version in $GIT_DIR/version when creating repo.
Date: Thu, 17 Nov 2005 16:25:37 +0300	[thread overview]
Message-ID: <11322339372336-git-send-email-matlads@dsmagic.com> (raw)
In-Reply-To: <11322339373013-git-send-email-matlads@dsmagic.com>

Signed-Off-By: Martin Atukunda <matlads@dsmagic.com>

---

 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

  reply	other threads:[~2005-11-17 13:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 13:25 [PATCH] Add .git/version Martin Atukunda
2005-11-17 13:25 ` [PATCH 1/2] Build GIT_VERSION from VERSION, PATCHLEVEL, and SUBLEVEL variables Martin Atukunda
2005-11-17 13:25   ` Martin Atukunda [this message]
2005-11-17 13:39 ` [PATCH] Add .git/version Johannes Schindelin
2005-11-17 15:16   ` Martin Atukunda
2005-11-17 15:38     ` Johannes Schindelin
2005-11-17 16:04       ` Josef Weidendorfer
2005-11-17 15:44 ` Josef Weidendorfer
2005-11-17 16:33   ` Andreas Ericsson
2005-11-17 16:41     ` Josef Weidendorfer
2005-11-17 19:08       ` Martin Atukunda
2005-11-17 19:18         ` [PATCH] Add .git/version (Take 2) Martin Atukunda
2005-11-17 19:25   ` [PATCH] Add .git/version Junio C Hamano
2005-11-17 19:35     ` Linus Torvalds
2005-11-17 23:41       ` Johannes Schindelin
2005-11-18  0:49       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11322339372336-git-send-email-matlads@dsmagic.com \
    --to=matlads@dsmagic.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).