Skip to content

Commit

Permalink
Have a constant extern refspec for "--tags"
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
iabervon authored and gitster committed May 5, 2008
1 parent bef70b2 commit e0aaa29
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
10 changes: 2 additions & 8 deletions builtin-fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e0aaa29

Please sign in to comment.