public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Salikh Zakirov <salikh@gmail•com>
To: git@vger•kernel.org
Subject: Re: [PATCH] Make git-clone --use-separate-remote the default
Date: Sat, 25 Nov 2006 02:28:02 +0300	[thread overview]
Message-ID: <ek7v61$k89$1@sea.gmane.org> (raw)
In-Reply-To: <7vslg9axzv.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:
> The way this command:
> 
> 	git push $remote $src:$dst
> 
> is handled is:
> 
>  (0) send-pack gets ls-remote equivalent from the remote.  This
>      tells us the set of refs the remote has and the value of
>      each of them.
> 
>  (1) $src can be a ref that is resolved locally the usual way.
>      You could have any valid SHA-1 expression (e.g. HEAD~6).

>  (2) $dst is compared with the list of refs that the remote
>      has, and unique match is found.

I think that remote matching semantics is confusing, and the following change
would make understanding easier.

I was understanding the manual incorrectly for a long time until you've
explained its true meaning today (thanks!).

As a side effect, making 'git push repo master' unambiguously expanded
to 'git push repo refs/heads/master:refs/heads/master' will make
the syntax 'git push repo tag v1' unneeded at all, because it would be
exactly the same as 'git push repo v1'
(expanded to 'git push repo refs/tags/v1:refs/tags/v1').

--- connect.c
+++ connect.c
@@ -277,6 +277,16 @@ static int match_explicit_refs(struct re
                              rs[i].src);
                        break;
                }
+               if (!strcmp(rs[i].src,rs[i].dst)) {
+                       /* src refspec is the same as dst,
+                        * take the remote refpath exactly the same
+                        * as existing local reference
+                        */
+                       int len = strlen(matched_src->name) + 1;
+                       matched_dst = xcalloc(1, sizeof(*dst) + len);
+                       memcpy(matched_dst->name, matched_src->name, len);
+                       link_dst_tail(matched_dst, dst_tail);
+               } else
                switch (count_refspec_match(rs[i].dst, dst, &matched_dst)) {
                case 1:
                        break;

  parent reply	other threads:[~2006-11-24 23:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23 22:58 [PATCH] Make git-clone --use-separate-remote the default Petr Baudis
2006-11-23 23:12 ` Junio C Hamano
2006-11-23 23:39   ` Andy Whitcroft
2006-11-23 23:42   ` Petr Baudis
2006-11-23 23:45     ` J. Bruce Fields
2006-11-24  0:17     ` Junio C Hamano
2006-11-24  5:47       ` Junio C Hamano
2006-11-24  6:36         ` Junio C Hamano
2006-11-24 10:14           ` Salikh Zakirov
2006-11-24 11:24             ` Junio C Hamano
2006-11-24 11:56               ` Salikh Zakirov
2006-11-24 23:28               ` Salikh Zakirov [this message]
2006-11-25  0:04                 ` Junio C Hamano
2006-11-24 11:32             ` Sergey Vlasov
2006-11-24 11:37               ` Junio C Hamano
2006-11-24  9:22       ` Jakub Narebski
2006-11-24  9:58 ` Salikh Zakirov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ek7v61$k89$1@sea.gmane.org' \
    --to=salikh@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox