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

[PATCH] cg-init shouldn't create master branch when pulling

From
PRPavel Roskin <proski@gnu.org>
Date
Apr 27, 2005, 21:33 UTC
Message-ID
<1114637617.15385.10.camel@dv>
Hello!
>From what I see in the current cogito sources, ".git/refs/heads/master"

is never used once it's created by cg-init. I believe the "master" branch is only useful when creating a new repository. Then it's the only branch in the repository.

When pulling from a remote repository, the "origin" branch is created, and it should be default. There is no need in having a separate "master" branch unless the user decides to create it for local development.

This patch changes cg-init so that the "master" branch is only created when the remote URI is not specified.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Index: cg-init
===================================================================
--- 8dc4ace046ad3545d48088e604012f95e34e24d3/cg-init  (mode:100755 sha1:d249140002888742c46ecba5925cae7c8025ea93)
+++ uncommitted/cg-init  (mode:100755)
@@ -14,17 +14,18 @@
 
 init-db
 mkdir .git/branches .git/refs .git/refs/heads .git/refs/tags
-touch .git/refs/heads/master
-ln -s refs/heads/master .git/HEAD
 
 if [ "$uri" ]; then
 	echo "$uri" >.git/branches/origin
+	ln -s refs/heads/origin .git/HEAD
 	cg-pull origin || die "pull failed"
 
-	cp .git/refs/heads/origin .git/refs/heads/master
 	read-tree $(tree-id)
 	checkout-cache -a
 	update-cache --refresh
 
 	echo "Cloned (origin $uri available as branch \"origin\")"
+else
+	touch .git/refs/heads/master
+	ln -s refs/heads/master .git/HEAD
 fi
-- 
Regards,
Pavel Roskin
Next: Pavel Roskin
Message 1 of 2 in “cg-init shouldn't create master branch when pulling”
  1. cg-init shouldn't create master branch when pullingPavel Roskin, Apr 27, 2005
  2. Pavel RoskinMay 3, 2005

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.