summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-08-03 23:35:29 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-08-04 00:16:29 (GMT)
commitf88395ac233572b19f67b3a47b9fe024f397a85b (patch)
tree1685bf95ed8737694561061be4956cc941ea266f /cache.h
parent8d5afef0f9b3a252f7b90406d35c295dc698e26d (diff)
downloadgit-f88395ac233572b19f67b3a47b9fe024f397a85b.zip
git-f88395ac233572b19f67b3a47b9fe024f397a85b.tar.gz
git-f88395ac233572b19f67b3a47b9fe024f397a85b.tar.bz2
Renaming push.
This allows git-send-pack to push local refs to a destination repository under different names. Here is the name mapping rules for refs. * If there is no ref mapping on the command line: - if '--all' is specified, it is equivalent to specifying <local> ":" <local> for all the existing local refs on the command line - otherwise, it is equivalent to specifying <ref> ":" <ref> for all the refs that exist on both sides. * <name> is just a shorthand for <name> ":" <name> * <src> ":" <dst> push ref that matches <src> to ref that matches <dst>. - It is an error if <src> does not match exactly one of local refs. - It is an error if <dst> matches more than one remote refs. - If <dst> does not match any remote refs, either - it has to start with "refs/"; <dst> is used as the destination literally in this case. - <src> == <dst> and the ref that matched the <src> must not exist in the set of remote refs; the ref matched <src> locally is used as the name of the destination. For example, - "git-send-pack --all <remote>" works exactly as before; - "git-send-pack <remote> master:upstream" pushes local master to remote ref that matches "upstream". If there is no such ref, it is an error. - "git-send-pack <remote> master:refs/heads/upstream" pushes local master to remote refs/heads/upstream, even when refs/heads/upstream does not exist. - "git-send-pack <remote> master" into an empty remote repository pushes the local ref/heads/master to the remote ref/heads/master. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 10243f0..fd4988e 100644
--- a/cache.h
+++ b/cache.h
@@ -302,12 +302,15 @@ struct ref {
struct ref *next;
unsigned char old_sha1[20];
unsigned char new_sha1[20];
+ struct ref *peer_ref; /* when renaming */
char name[0];
};
extern int git_connect(int fd[2], char *url, const char *prog);
extern int finish_connect(pid_t pid);
extern int path_match(const char *path, int nr, char **match);
+extern int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
+ int nr_refspec, char **refspec, int all);
extern int get_ack(int fd, unsigned char *result_sha1);
extern struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match);