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

Re: suggestion: store the URL somewhere in .git/

From
JCJeff Carr <jcarr@linuxmachines.com>
Date
Aug 23, 2005, 01:46 UTC
Message-ID
<430A7FE6.4010801@linuxmachines.com>
In-Reply-To
<Pine.LNX.4.63.0508222217310.695@wgmdd8.biozentrum.uni-wuerzburg.de>
On 08/22/2005 01:18 PM, Johannes Schindelin wrote:
Show 11 quoted lines
> Hi,
> 
> On Mon, 22 Aug 2005, Jeff Carr wrote:
> 
> 
>>It would be nice if the URL could be stored somewhere in .git/ This
>>makes it a lot easier to update repositories because you don't always
>>have to go and track down where you got it in the first place.
> 
> 
> This is why your original target (when you clone) is stored as "origin".

OK. I rsync'ed the repository directly so a origin file wasn't created. That explains that. So my small "feature" request reduces to adding something like this to git-pull-script. Thanks, Jeff

diff --git a/git-pull-script b/git-pull-script
--- a/git-pull-script
+++ b/git-pull-script
@@ -1,10 +1,20 @@
 #!/bin/sh
 #
+ORIGIN="$@"
+
+if [ ! $ORIGIN ]
+then
+	if [ -f .git/branches/origin ]
+	then
+		ORIGIN=`cat .git/branches/origin`
+	fi
+fi
+
 . git-sh-setup-script || die "Not a git archive"
-. git-parse-remote "$@"
+. git-parse-remote "$ORIGIN"
 merge_name="$_remote_name"

-git-fetch-script "$@" || exit 1
+git-fetch-script "$ORIGIN" || exit 1

 git-resolve-script \
 	"$(cat "$GIT_DIR"/HEAD)" \
Previous: Johannes SchindelinNext: Junio C Hamano
Message 3 of 4 in “suggestion: store the URL somewhere in .git/”
  1. Jeff CarrAug 22, 2005
  2. Johannes SchindelinAug 22, 2005
  3. Jeff CarrAug 23, 2005
  4. Junio C HamanoAug 23, 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.