Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
clone: convert cmd_clone to use refspec_item_init
author
Brandon Williams
<bmwill@google.com>
Wed, 16 May 2018 22:57:58 +0000
(15:57 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 17 May 2018 21:19:42 +0000
(06:19 +0900)
Convert 'cmd_clone()' to use 'refspec_item_init()' instead of relying on
the old 'parse_fetch_refspec()' to initialize a single refspec item.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
8ca6937
)
diff --git
a/builtin/clone.c
b/builtin/clone.c
index 854088a3a28b077313debbd69d5526925990927d..8c5f4d8f074f13c62b7d6d5a3ea4deff80de2d58 100644
(file)
--- a/
builtin/clone.c
+++ b/
builtin/clone.c
@@
-895,8
+895,7
@@
int cmd_clone(int argc, const char **argv, const char *prefix)
int err = 0, complete_refs_before_fetch = 1;
int submodule_progress;
int err = 0, complete_refs_before_fetch = 1;
int submodule_progress;
- struct refspec_item *refspec;
- const char *fetch_pattern;
+ struct refspec_item refspec;
fetch_if_missing = 0;
fetch_if_missing = 0;
@@
-1078,8
+1077,7
@@
int cmd_clone(int argc, const char **argv, const char *prefix)
if (option_required_reference.nr || option_optional_reference.nr)
setup_reference();
if (option_required_reference.nr || option_optional_reference.nr)
setup_reference();
- fetch_pattern = value.buf;
- refspec = parse_fetch_refspec(1, &fetch_pattern);
+ refspec_item_init(&refspec, value.buf, REFSPEC_FETCH);
strbuf_reset(&value);
strbuf_reset(&value);
@@
-1139,7
+1137,7
@@
int cmd_clone(int argc, const char **argv, const char *prefix)
refs = transport_get_remote_refs(transport, NULL);
if (refs) {
refs = transport_get_remote_refs(transport, NULL);
if (refs) {
- mapped_refs = wanted_peer_refs(refs, refspec);
+ mapped_refs = wanted_peer_refs(refs,
&
refspec);
/*
* transport_get_remote_refs() may return refs with null sha-1
* in mapped_refs (see struct transport->get_refs_list
/*
* transport_get_remote_refs() may return refs with null sha-1
* in mapped_refs (see struct transport->get_refs_list
@@
-1233,6
+1231,6
@@
int cmd_clone(int argc, const char **argv, const char *prefix)
strbuf_release(&value);
junk_mode = JUNK_LEAVE_ALL;
strbuf_release(&value);
junk_mode = JUNK_LEAVE_ALL;
-
free(
refspec);
+
refspec_item_clear(&
refspec);
return err;
}
return err;
}