# suggestion: store the URL somewhere in .git/

4 messages from 2005-08-22 to 2005-08-23. Participants: Jeff Carr, Johannes Schindelin, Junio C Hamano.
Thread: https://gitlist.dev/t/1611

## Jeff Carr, 2005-08-22 20:08

Subject: suggestion: store the URL somewhere in .git/
Message-ID: <430A30C8.3080908@linuxmachines.com>
URL: https://gitlist.dev/e/430A30C8.3080908%40linuxmachines.com

```
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. Something
like this perhaps:

~$ cat .git/location
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/
~$ git-pull-script

Then something like below could be added to handle that easy enough.

Jeff


--- git-pull-script.orig	2005-07-31 22:23:50.000000000 -0700
+++ git-pull-script	2005-08-22 13:01:22.000000000 -0700
@@ -4,13 +4,24 @@
 # cogito.]
 #

+LOCATION="$@"
+
+if [ ! $LOCATION ]
+then
+	if [ -f .git/location ]
+	then
+		LOCATION=`cat .git/location`
+	fi
+fi
+
 . git-sh-setup-script || die "Not a git archive"
-. git-parse-remote "$@"
+. git-parse-remote "$LOCATION"
 merge_name="$_remote_name"

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

 git-resolve-script \
 	"$(cat "$GIT_DIR"/HEAD)" \
 	"$(cat "$GIT_DIR"/FETCH_HEAD)" \
 	"Merge $merge_name"
+

```

## Johannes Schindelin, 2005-08-22 20:18

Subject: Re: suggestion: store the URL somewhere in .git/
Message-ID: <Pine.LNX.4.63.0508222217310.695@wgmdd8.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0508222217310.695%40wgmdd8.biozentrum.uni-wuerzburg.de
In-Reply-To: <430A30C8.3080908@linuxmachines.com>

```
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".

Hth,
Dscho

```

## Jeff Carr, 2005-08-23 01:46

Subject: Re: suggestion: store the URL somewhere in .git/
Message-ID: <430A7FE6.4010801@linuxmachines.com>
URL: https://gitlist.dev/e/430A7FE6.4010801%40linuxmachines.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:
> 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)" \

```

## Junio C Hamano, 2005-08-23 05:16

Subject: Re: suggestion: store the URL somewhere in .git/
Message-ID: <7vslx1xmff.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vslx1xmff.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <430A7FE6.4010801@linuxmachines.com>

```
Jeff Carr <jcarr@linuxmachines.com> writes:

> So my small "feature" request reduces to adding
> something like this to git-pull-script. Thanks, Jeff

Somebody else earlier asked for fetch and pull to default to
"origin" URL, and the necessary change is already in the
proposed updates branch.

```
