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>
This commit is contained in:
2
remote.h
2
remote.h
@ -128,6 +128,7 @@ struct ref *alloc_ref(const char *name);
|
||||
struct ref *copy_ref(const struct ref *ref);
|
||||
struct ref *copy_ref_list(const struct ref *ref);
|
||||
void sort_ref_list(struct ref **, int (*cmp)(const void *, const void *));
|
||||
extern int count_refspec_match(const char *, struct ref *refs, struct ref **matched_ref);
|
||||
int ref_compare_name(const void *, const void *);
|
||||
|
||||
int check_ref_type(const struct ref *ref, int flags);
|
||||
@ -158,6 +159,7 @@ struct refspec *parse_fetch_refspec(int nr_refspec, const char **refspec);
|
||||
|
||||
void free_refspec(int nr_refspec, struct refspec *refspec);
|
||||
|
||||
extern int query_refspecs(struct refspec *specs, int nr, struct refspec *query);
|
||||
char *apply_refspecs(struct refspec *refspecs, int nr_refspec,
|
||||
const char *name);
|
||||
|
||||
|
Reference in New Issue
Block a user