Have a constant extern refspec for "--tags"
The refspec refs/tags/*:refs/tags/* is sufficiently common and generic to merit having a constant instead of generating it as needed. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Daniel Barkalow committed
Apr 17, 2008 at 19:32 UTC
e0aaa29ff324c40a6428d5cc26867392eedf94ad
3 files changed
+13
-8
builtin-fetch.c
+2
-8
@@ -127,14 +127,8 @@ static struct ref *get_ref_map(struct transport *transport,
127
/* Merge everything on the command line, but not --tags */
128
for (rm = ref_map; rm; rm = rm->next)
129
rm->merge = 1;
130
- if (tags == TAGS_SET) {
131
- struct refspec refspec;
132
- refspec.src = "refs/tags/";
133
- refspec.dst = "refs/tags/";
134
- refspec.pattern = 1;
135
- refspec.force = 0;
136
- get_fetch_map(remote_refs, &refspec, &tail, 0);
137
- }
130
+ if (tags == TAGS_SET)
131
+ get_fetch_map(remote_refs, tag_refspec, &tail, 0);
132
} else {
133
/* Use the defaults */
134
struct remote *remote = transport->remote;
remote.c
+9
@@ -2,6 +2,15 @@
2
#include "remote.h"
3
#include "refs.h"
4
5
+static struct refspec s_tag_refspec = {
6
+ 0,
7
+ 1,
8
+ "refs/tags/",
9
+ "refs/tags/"
10
+};
11
+
12
+const struct refspec *tag_refspec = &s_tag_refspec;
13
+
14
struct counted_string {
15
size_t len;
16
const char *s;
remote.h
+2
@@ -51,6 +51,8 @@ struct refspec {
51
char *dst;
52
};
53
54
+extern const struct refspec *tag_refspec;
55
+
56
struct ref *alloc_ref(unsigned namelen);
57
58
struct ref *copy_ref_list(const struct ref *ref);