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

[PATCH] Use new .git/config for storing "origin" shortcut repository

From
APAndy Parkins <andyparkins@gmail.com>
Date
Nov 26, 2006, 12:10 UTC
Message-ID
<200611261210.52154.andyparkins@gmail.com>
In-Reply-To
<ekbnr6$naq$2@sea.gmane.org>

Rather than use a separate config .git/remotes/ for remote shortcuts, this patch adds the analagous definitions to .git/config using git-repo-config calls.

For example what was previously .git/remotes/origin
  URL: proto://host/path
  Pull: refs/heads/master:refs/heads/origin
Is now added to .git/config as
  [remote "origin"]
  url = proto://host/path
  fetch = refs/heads/master:refs/heads/origin
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
You're absolutely correct; fixed.  This patch replaces the previous (again).
 git-clone.sh |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index 9ed4135..7e5dc0f 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -373,9 +373,8 @@ then
 		*)	origin_track="$remote_top/$origin"
 			git-update-ref "refs/heads/$origin" "$head_sha1" ;;
 		esac &&
-		echo >"$GIT_DIR/remotes/$origin" \
-		"URL: $repo
-Pull: refs/heads/$head_points_at:$origin_track" &&
+		git-repo-config remote."$origin".url "$repo" &&
+		git-repo-config remote."$origin".fetch "refs/heads/$head_points_at:$origin_track" ^$ &&
 		(cd "$GIT_DIR/$remote_top" && find . -type f -print) |
 		while read dotslref
 		do
@@ -389,8 +388,8 @@ Pull: refs/heads/$head_points_at:$origin_track" &&
 			then
 				continue
 			fi
-			echo "Pull: refs/heads/${name}:$remote_top/${name}"
-		done >>"$GIT_DIR/remotes/$origin" &&
+			git-repo-config remote."$origin".fetch "refs/heads/${name}:$remote_top/${name}" ^$
+		done &&
 		case "$use_separate_remote" in
 		t)
 			rm -f "refs/remotes/$origin/HEAD"
-- 
1.4.4.1.g9fd7
Previous: Jakub NarebskiNext: Johannes Schindelin
Message 4 of 5 in “Re: [PATCH] Use new .git/config for storing "origin" shortcut repository”
  1. Junio C HamanoNov 26, 2006
  2. Use new .git/config for storing "origin" shortcut repositoryAndy Parkins, Nov 26, 2006
  3. Jakub NarebskiNov 26, 2006
  4. Use new .git/config for storing "origin" shortcut repositoryAndy Parkins, Nov 26, 2006
  5. Johannes SchindelinNov 26, 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.