* [PATCH 5/8] Have a constant extern refspec for "--tags"
@ 2008-04-17 23:32 Daniel Barkalow
0 siblings, 0 replies; only message in thread
From: Daniel Barkalow @ 2008-04-17 23:32 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Johannes Schindelin
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>
---
builtin-fetch.c | 10 ++--------
remote.c | 9 +++++++++
remote.h | 2 ++
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 139a6b1..e010fef 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -127,14 +127,8 @@ static struct ref *get_ref_map(struct transport *transport,
/* Merge everything on the command line, but not --tags */
for (rm = ref_map; rm; rm = rm->next)
rm->merge = 1;
- if (tags == TAGS_SET) {
- struct refspec refspec;
- refspec.src = "refs/tags/";
- refspec.dst = "refs/tags/";
- refspec.pattern = 1;
- refspec.force = 0;
- get_fetch_map(remote_refs, &refspec, &tail, 0);
- }
+ if (tags == TAGS_SET)
+ get_fetch_map(remote_refs, tag_refspec, &tail, 0);
} else {
/* Use the defaults */
struct remote *remote = transport->remote;
diff --git a/remote.c b/remote.c
index 08af7f9..5053b5f 100644
--- a/remote.c
+++ b/remote.c
@@ -2,6 +2,15 @@
#include "remote.h"
#include "refs.h"
+static struct refspec s_tag_refspec = {
+ 0,
+ 1,
+ "refs/tags/",
+ "refs/tags/"
+};
+
+const struct refspec *tag_refspec = &s_tag_refspec;
+
struct counted_string {
size_t len;
const char *s;
diff --git a/remote.h b/remote.h
index 7e9ae79..d9974fa 100644
--- a/remote.h
+++ b/remote.h
@@ -51,6 +51,8 @@ struct refspec {
char *dst;
};
+extern const struct refspec *tag_refspec;
+
struct ref *alloc_ref(unsigned namelen);
struct ref *copy_ref_list(const struct ref *ref);
--
1.5.4.3.610.gea6cd
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-17 23:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-17 23:32 [PATCH 5/8] Have a constant extern refspec for "--tags" Daniel Barkalow
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).