git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Make ref resolution saner

From
Llinux@horizon.com <linux@horizon.com>
Date
Sep 12, 2006, 18:57 UTC
Message-ID
<20060912185728.29885.qmail@science.horizon.com>

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 */
Message 1 of 1 in “Re: Make ref resolution saner”
  1. linux@horizon.comSep 12, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.