summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-12-03 15:41:15 -0800
committerJunio C Hamano <gitster@pobox.com>2013-12-04 15:11:08 -0800
commitca02465b41311fe7634acb9bb5b5c61975ef5f38 (patch)
tree67ed0c5f4ad4711d2959a717471331e6d175bcf9 /remote.c
parent50d829c11a3c82a8b23f2e165ab6944dfd9bbb36 (diff)
downloadgit-ca02465b41311fe7634acb9bb5b5c61975ef5f38.tar.gz
push: use remote.$name.push as a refmap
Since f2690487 (fetch: opportunistically update tracking refs, 2013-05-11), we stopped taking a non-storing refspec given on the command line of "git fetch" literally, and instead started mapping it via remote.$name.fetch refspecs. This allows $ git fetch origin master from the 'origin' repository, which is configured with [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* to update refs/remotes/origin/master with the result, as if the command line were $ git fetch origin +master:refs/remotes/origin/master to reduce surprises and improve usability. Before that change, a refspec on the command line without a colon was only to fetch the history and leave the result in FETCH_HEAD, without updating the remote-tracking branches. When you are simulating a fetch from you by your mothership with a push by you into your mothership, instead of having: [remote "satellite"] fetch = +refs/heads/*:refs/remotes/satellite/* on the mothership repository and running: mothership$ git fetch satellite you would have: [remote "mothership"] push = +refs/heads/*:refs/remotes/satellite/* on your satellite machine, and run: satellite$ git push mothership Because we so far did not make the corresponding change to the push side, this command: satellite$ git push mothership master does _not_ allow you on the satellite to only push 'master' out but still to the usual destination (i.e. refs/remotes/satellite/master). Implement the logic to map an unqualified refspec given on the command line via the remote.$name.push refspec. This will bring a bit more symmetry between "fetch" and "push". Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/remote.c b/remote.c
index 9f1a8aa2c4..6ffa14946d 100644
--- a/remote.c
+++ b/remote.c
@@ -821,7 +821,7 @@ static int match_name_with_pattern(const char *key, const char *name,
return ret;
}
-static int query_refspecs(struct refspec *refs, int ref_count, struct refspec *query)
+int query_refspecs(struct refspec *refs, int ref_count, struct refspec *query)
{
int i;
int find_src = !query->src;
@@ -955,9 +955,9 @@ void sort_ref_list(struct ref **l, int (*cmp)(const void *, const void *))
*l = llist_mergesort(*l, ref_list_get_next, ref_list_set_next, cmp);
}
-static int count_refspec_match(const char *pattern,
- struct ref *refs,
- struct ref **matched_ref)
+int count_refspec_match(const char *pattern,
+ struct ref *refs,
+ struct ref **matched_ref)
{
int patlen = strlen(pattern);
struct ref *matched_weak = NULL;