summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8cc3fe4)
raw | patch | inline | side by side (parent: 8cc3fe4)
author | Daniel Barkalow <barkalow@iabervon.org> | |
Fri, 6 Mar 2009 04:56:16 +0000 (23:56 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 7 Mar 2009 20:19:05 +0000 (12:19 -0800) |
Instead of creating a refspec by hand, go through the refspec parsing
code, so that changes in the refspec storage will be accounted for.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
code, so that changes in the refspec storage will be accounted for.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-clone.c | patch | blob | history |
diff --git a/builtin-clone.c b/builtin-clone.c
index c338910b1c76f3c994e4a22c9c0a1da38843e050..06b5a7fc391fd8da0d963f9c9cd0c5cd1675a38b 100644 (file)
--- a/builtin-clone.c
+++ b/builtin-clone.c
struct transport *transport = NULL;
char *src_ref_prefix = "refs/heads/";
- struct refspec refspec;
+ struct refspec *refspec;
+ const char *fetch_pattern;
junk_pid = getpid();
strbuf_addf(&branch_top, "refs/remotes/%s/", option_origin);
}
+ strbuf_addf(&value, "+%s*:%s*", src_ref_prefix, branch_top.buf);
+
if (option_mirror || !option_bare) {
/* Configure the remote */
+ strbuf_addf(&key, "remote.%s.fetch", option_origin);
+ git_config_set_multivar(key.buf, value.buf, "^$", 0);
+ strbuf_reset(&key);
+
if (option_mirror) {
strbuf_addf(&key, "remote.%s.mirror", option_origin);
git_config_set(key.buf, "true");
strbuf_addf(&key, "remote.%s.url", option_origin);
git_config_set(key.buf, repo);
- strbuf_reset(&key);
-
- strbuf_addf(&key, "remote.%s.fetch", option_origin);
- strbuf_addf(&value, "+%s*:%s*", src_ref_prefix, branch_top.buf);
- git_config_set_multivar(key.buf, value.buf, "^$", 0);
strbuf_reset(&key);
- strbuf_reset(&value);
}
- refspec.force = 0;
- refspec.pattern = 1;
- refspec.src = src_ref_prefix;
- refspec.dst = branch_top.buf;
+ fetch_pattern = value.buf;
+ refspec = parse_fetch_refspec(1, &fetch_pattern);
+
+ strbuf_reset(&value);
if (path && !is_bundle)
refs = clone_local(path, git_dir);
if (refs) {
clear_extra_refs();
- mapped_refs = write_remote_refs(refs, &refspec, reflog_msg.buf);
+ mapped_refs = write_remote_refs(refs, refspec, reflog_msg.buf);
head_points_at = locate_head(refs, mapped_refs, &remote_head);
}