diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2008-04-28 11:32:12 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-05-04 17:41:39 -0700 |
commit | a83619d692deeb2565335144078465acb2dd1457 (patch) | |
tree | 568c8aa7b0092ee996e1a4612e89ff252d61ac60 /builtin-send-pack.c | |
parent | c697ad143ba1ff58b29e7efe149d244d4b7010a5 (diff) | |
download | git-a83619d692deeb2565335144078465acb2dd1457.tar.gz |
add special "matching refs" refspec
This patch provides a way to specify "push matching heads" using a
special refspec ":". This is useful because it allows "push = +:"
as a way to specify that matching refs will be pushed but, in addition,
forced updates will be allowed, which was not possible before.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-send-pack.c')
-rw-r--r-- | builtin-send-pack.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin-send-pack.c b/builtin-send-pack.c index bb9c33a650..d76260c09e 100644 --- a/builtin-send-pack.c +++ b/builtin-send-pack.c @@ -537,9 +537,17 @@ static void verify_remote_names(int nr_heads, const char **heads) int i; for (i = 0; i < nr_heads; i++) { + const char *local = heads[i]; const char *remote = strrchr(heads[i], ':'); - remote = remote ? (remote + 1) : heads[i]; + if (*local == '+') + local++; + + /* A matching refspec is okay. */ + if (remote == local && remote[1] == '\0') + continue; + + remote = remote ? (remote + 1) : local; switch (check_ref_format(remote)) { case 0: /* ok */ case CHECK_REF_FORMAT_ONELEVEL: |