lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Relocating a proprietary git repository


From: Greg Chicares
Subject: Re: [lmi] Relocating a proprietary git repository
Date: Fri, 4 Mar 2022 20:18:13 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0

On 2022-03-03 21:20, Greg Chicares wrote:
> [This email serves only to document some rarely-used git commands
> that I wouldn't want to have to look up again. Nobody need read it.]

[This reply serves only to document how, the next day, I tried
to verify this, and stumbled over git's documentation. This
won't matter because I have no reason to use a multi-'origin'
repository except as a temporary transitional workaround.]

> I was mildly surprised, but of course pleased, to learn that
> git allows us to add an additional 'origin':
>   git remote set-url --add --push origin 
> file:///srv/cache_for_lmi/blessed/proprietary/

Of course, git provides ways to verify the URLs; they just
don't work as the official documentation suggests. To
recapitulate, 'origin' was originally
  file:///opt/lmi/blessed/proprietary
to which the command quoted above adds
  file:///srv/cache_for_lmi/blessed/proprietary/
with '--add':

  https://git-scm.com/docs/git-remote
| With --add, instead of changing existing URLs, new URL is added.

...so the existing URL isn't changed, and a new one is added.
Now what does 'get-url' do?

| Retrieves the URLs for a remote.

Okay, it retrieves the (plural) URLs...except that:

| By default, only the first URL is listed.

This command therefore returns the original 'origin':

$git remote get-url origin           
file:///opt/lmi/blessed/proprietary

| With --all, all URLs for the remote will be listed.

Thus, to see all URLs, I should add '--all'; but:

$git remote get-url --all origin       
file:///opt/lmi/blessed/proprietary

again it returns only one URL. Trying random options,
I found this:

$git remote get-url --push origin      
file:///srv/cache_for_lmi/blessed/proprietary/

...which returns the secondary URL. To obtain the
behavior documented for 'get-url --all', this very
different command seems to work:

$git remote -v                   
origin  file:///opt/lmi/blessed/proprietary (fetch)
origin  file:///srv/cache_for_lmi/blessed/proprietary/ (push)

Referring back to the 'set-url' documentation, I find
a later paragraph that says:

| Note that the push URL and the fetch URL, even though they
| can be set differently, must still refer to the same place.

This seems to be an invariant that's expressed only in
the fifth of five paragraphs in the documentation, but
violating it elicited no error or warning. And it was
indeed violated, because the two URLs refer to very
different places:

/opt/lmi/proprietary[0]$ls -idl /opt/lmi/blessed/proprietary         
11143270 drwxrwsr-x 7 greg lmi 4096 Oct 16 22:34 /opt/lmi/blessed/proprietary
/opt/lmi/proprietary[0]$ls -idl /srv/cache_for_lmi/blessed/proprietary/
791091 drwxr-xr-x 7 greg 1000 4096 Oct 16 22:34 
/srv/cache_for_lmi/blessed/proprietary/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]