Re: Make ref resolution saner

From: <linux@horizon.com>
Date: 2006-09-13 04:57:28
I just noticed as part of that patch that building the path of
$GIT_DIR/HEAD is no longer necessary, which is the middle hunk,
and the other two jumped out at me while looking at the code.

(On top of Linus' patch.)

diff --git a/builtin-init-db.c b/builtin-init-db.c
index 23b7714..f4a6d1f 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -203,7 +203,6 @@ static void create_default_files(const c
 	 * shared-repository settings, we would need to fix them up.
 	 */
 	if (shared_repository) {
-		path[len] = 0;
 		adjust_shared_perm(path);
 		strcpy(path + len, "refs");
 		adjust_shared_perm(path);
@@ -217,7 +216,6 @@ static void create_default_files(const c
 	 * Create the default symlink from ".git/HEAD" to the "master"
 	 * branch, if it does not exist yet.
 	 */
-	strcpy(path + len, "HEAD");
 	if (read_ref("HEAD", sha1) < 0) {
 		if (create_symref("HEAD", "refs/heads/master") < 0)
 			exit(1);
@@ -227,7 +225,6 @@ static void create_default_files(const c
 	sprintf(repo_version_string, "%d", GIT_REPO_VERSION);
 	git_config_set("core.repositoryformatversion", repo_version_string);
 
-	path[len] = 0;
 	strcpy(path + len, "config");
 
 	/* Check filemode trustability */
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Sep 13 04:57:38 2006

This archive was generated by hypermail 2.1.8 : 2006-09-13 04:58:24 EST