git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Daniel Barkalow <barkalow@iabervon.org>,
	git@vger.kernel.org, Teemu Likonen <tlikonen@iki.fi>
Subject: On fetch refspecs and wildcards
Date: Sun, 16 Mar 2008 15:24:34 -0700	[thread overview]
Message-ID: <7v8x0igvdp.fsf_-_@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <200803161921.49274.tlikonen@iki.fi> (Teemu Likonen's message of "Sun, 16 Mar 2008 19:21:49 +0200")

I was looking at t5505 tests and noticed something funny.

This is a design level question, so I am cc'ing Daniel whose remote.c is
heavily involved in the new implementation.

What should this config do:

    [remote "origin"]
        url = ../one/.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        fetch = refs/heads/master:refs/heads/upstream

when the other repository (../one/.git) has branches "master" and "side2"?

I am not sure if the original implementation used to copy master to both
refs/remotes/origin/master and refs/heads/upstream, but I think that is
what the users would expect.  

I think the current one excludes any source that has an explicit
destination from the wildcard matches.  It is probably Ok as long as we
reject if the same source has more than one destinations (or matches more
than one wildcards, for that matter) like this as a configuration error:

    [remote "origin"]
        url = ../one/.git
        fetch = refs/heads/master:refs/heads/upstream
        fetch = refs/heads/master:refs/heads/another

If it doesn't, it does feel somewhat inconsistent.

Fortunately or unfortunately, Documentation/pull-fetch-param.txt does not
talk about wildcard refspecs (not even the syntax, let alone the
semantics), so we can define whatever we want right now, and I think both

    (1) allow duplicated destinations, including wildcard matches; and

    (2) refuse duplicated destinations for explicit ones, and more than
        one wildcard patterns that match the same ref, but omit explicitly
        specified ones from wildcard matches;

are viable options.  I suspect the current code does not do either.  We
should pick one semantics, make sure the implementation matches that, and
document it.

Another topic is what the semantics should be for mirroring configuration,
like this:

    [remote "origin"]
        url = ../one/.git
        fetch = refs/*:refs/*

or

    [remote "origin"]
        url = ../one/.git
        fetch = refs/*:refs/remotes/one/*

The issues are:

 (1) get_fetch_map() currently insists on refname to be check_ref_format()
     clean; it even rejects CHECK_REF_FORMAT_ONELEVEL, which means that
     refs/stash would not be considered Ok and the code will die().

 (2) "git remote prune" seems to cull refs/remotes/one/HEAD if exists.

Currently we do not have a way to determine where HEAD at the remote
points at at the protocol level (I've sent a patch to the list earlier for
the necessary protocol extension on the upload-pack side, but receiver
side never got implemented in remotes.c).  So we cannot propagate
refs/HEAD information correctly right now, but when we accept the protocol
extension to do so, issue (1) will matter also for HEAD.

I think there is no design level question on this one.  I think both are
bugs we currently have (and they may probably not be regressions).

  reply	other threads:[~2008-03-16 22:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-14 13:05 git remote --mirror bug? Joakim Tjernlund
2008-03-15 18:08 ` Joakim Tjernlund
2008-03-16 10:21   ` Re* " Junio C Hamano
2008-03-16 17:21     ` remote/clone bug: Stale tracking branch HEAD Teemu Likonen
2008-03-16 22:24       ` Junio C Hamano [this message]
2008-03-16 22:33         ` On fetch refspecs and wildcards Junio C Hamano
2008-03-16 23:03         ` Daniel Barkalow
2008-03-17  0:14           ` Junio C Hamano
2008-03-17  2:14             ` Daniel Barkalow
2008-03-18 14:04     ` Re* git remote --mirror bug? Johannes Schindelin
2008-03-18 19:02       ` Junio C Hamano
2008-03-19  0:35         ` Johannes Schindelin
2008-03-28  6:16   ` [PATCH/RFC] Allow "git remote --mirror" to mirror stashes Junio C Hamano
2008-03-28 15:45     ` Daniel Barkalow
2008-03-31  0:19       ` Junio C Hamano
2008-03-31  3:03         ` Daniel Barkalow

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=7v8x0igvdp.fsf_-_@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=tlikonen@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).