Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sha1_name: refactor upstream_mark
author
Jeff King
<peff@peff.net>
Thu, 21 May 2015 04:45:39 +0000
(
00:45
-0400)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 22 May 2015 16:33:08 +0000
(09:33 -0700)
We will be adding new mark types in the future, so separate
the suffix data from the logic.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
e291c75
)
diff --git
a/sha1_name.c
b/sha1_name.c
index 461157a5bcd4fccf43c31d9074ec596d7d028add..1005f45d75927a05a7f4dfabea6ccba82ef367a4 100644
(file)
--- a/
sha1_name.c
+++ b/
sha1_name.c
@@
-415,12
+415,12
@@
static int ambiguous_path(const char *path, int len)
return slash;
}
return slash;
}
-static inline int upstream_mark(const char *string, int len)
+static inline int at_mark(const char *string, int len,
+ const char **suffix, int nr)
{
{
- const char *suffix[] = { "@{upstream}", "@{u}" };
int i;
int i;
- for (i = 0; i <
ARRAY_SIZE(suffix)
; i++) {
+ for (i = 0; i <
nr
; i++) {
int suffix_len = strlen(suffix[i]);
if (suffix_len <= len
&& !memcmp(string, suffix[i], suffix_len))
int suffix_len = strlen(suffix[i]);
if (suffix_len <= len
&& !memcmp(string, suffix[i], suffix_len))
@@
-429,6
+429,12
@@
static inline int upstream_mark(const char *string, int len)
return 0;
}
return 0;
}
+static inline int upstream_mark(const char *string, int len)
+{
+ const char *suffix[] = { "@{upstream}", "@{u}" };
+ return at_mark(string, len, suffix, ARRAY_SIZE(suffix));
+}
+
static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned lookup_flags);
static int interpret_nth_prior_checkout(const char *name, int namelen, struct strbuf *buf);
static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned lookup_flags);
static int interpret_nth_prior_checkout(const char *name, int namelen, struct strbuf *buf);