git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Atukunda <matlads@dsmagic.com>
To: git@vger.kernel.org
Subject: [PATCH] Add .git/version (Take 2)
Date: Thu, 17 Nov 2005 22:18:21 +0300	[thread overview]
Message-ID: <20051117191821.GC5745@igloo.ds.co.ug> (raw)
In-Reply-To: <20051117190848.GA5745@igloo.ds.co.ug>


Currently the version number can be considered version 1, so this patch
just sets it to that. This patch supercedes my earlier attempt that
erroneously used the git version number as the repo format version.

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

---

 init-db.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

applies-to: d1bb16b919a119cca6ee001f755f83251a2c2964
31e78e387d708da5e09f40436d5fdc9e9ec5e16c
diff --git a/init-db.c b/init-db.c
index bd88291..e403dac 100644
--- a/init-db.c
+++ b/init-db.c
@@ -9,6 +9,8 @@
 #define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates/"
 #endif
 
+#define REPO_VERSION 1
+
 static void safe_create_dir(const char *dir)
 {
 	if (mkdir(dir, 0777) < 0) {
@@ -19,6 +21,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\n", REPO_VERSION);
+	
+	fclose(verfile);
+}
+
 static int copy_file(const char *dst, const char *src, int mode)
 {
 	int fdi, fdo, status;
@@ -212,6 +225,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

-- 
Due to a shortage of devoted followers, the production of great leaders has been discontinued.

  reply	other threads:[~2005-11-17 19:19 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   ` [PATCH 2/2] Make init-db record the version in $GIT_DIR/version when creating repo Martin Atukunda
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         ` Martin Atukunda [this message]
2005-11-17 19:25   ` 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=20051117191821.GC5745@igloo.ds.co.ug \
    --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).