Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sha1-name.c: add repo_interpret_branch_name()
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Tue, 16 Apr 2019 09:33:28 +0000
(16:33 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 16 Apr 2019 09:56:52 +0000
(18:56 +0900)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1-name.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
ea1c873
)
diff --git
a/sha1-name.c
b/sha1-name.c
index 7d9512ac44662133d2540ef16496afef3e528ee4..49c62d52543c7ec2a55693c22dc6dc315db50164 100644
(file)
--- a/
sha1-name.c
+++ b/
sha1-name.c
@@
-1390,7
+1390,8
@@
static int interpret_empty_at(const char *name, int namelen, int len, struct str
return 1;
}
return 1;
}
-static int reinterpret(const char *name, int namelen, int len,
+static int reinterpret(struct repository *r,
+ const char *name, int namelen, int len,
struct strbuf *buf, unsigned allowed)
{
/* we have extra data, which might need further processing */
struct strbuf *buf, unsigned allowed)
{
/* we have extra data, which might need further processing */
@@
-1399,7
+1400,7
@@
static int reinterpret(const char *name, int namelen, int len,
int ret;
strbuf_add(buf, name + len, namelen - len);
int ret;
strbuf_add(buf, name + len, namelen - len);
- ret =
interpret_branch_name(
buf->buf, buf->len, &tmp, allowed);
+ ret =
repo_interpret_branch_name(r,
buf->buf, buf->len, &tmp, allowed);
/* that data was not interpreted, remove our cruft */
if (ret < 0) {
strbuf_setlen(buf, used);
/* that data was not interpreted, remove our cruft */
if (ret < 0) {
strbuf_setlen(buf, used);
@@
-1482,20
+1483,18
@@
int repo_interpret_branch_name(struct repository *r,
const char *start;
int len;
const char *start;
int len;
- if (r != the_repository)
- BUG("interpret_branch_name() does not really use 'r' yet");
if (!namelen)
namelen = strlen(name);
if (!allowed || (allowed & INTERPRET_BRANCH_LOCAL)) {
if (!namelen)
namelen = strlen(name);
if (!allowed || (allowed & INTERPRET_BRANCH_LOCAL)) {
- len = interpret_nth_prior_checkout(
the_repository
, name, namelen, buf);
+ len = interpret_nth_prior_checkout(
r
, name, namelen, buf);
if (!len) {
return len; /* syntax Ok, not enough switches */
} else if (len > 0) {
if (len == namelen)
return len; /* consumed all */
else
if (!len) {
return len; /* syntax Ok, not enough switches */
} else if (len > 0) {
if (len == namelen)
return len; /* consumed all */
else
- return reinterpret(name, namelen, len, buf, allowed);
+ return reinterpret(
r,
name, namelen, len, buf, allowed);
}
}
}
}
@@
-1506,17
+1505,17
@@
int repo_interpret_branch_name(struct repository *r,
if (!allowed || (allowed & INTERPRET_BRANCH_HEAD)) {
len = interpret_empty_at(name, namelen, at - name, buf);
if (len > 0)
if (!allowed || (allowed & INTERPRET_BRANCH_HEAD)) {
len = interpret_empty_at(name, namelen, at - name, buf);
if (len > 0)
- return reinterpret(name, namelen, len, buf,
+ return reinterpret(
r,
name, namelen, len, buf,
allowed);
}
allowed);
}
- len = interpret_branch_mark(
the_repository
, name, namelen, at - name, buf,
+ len = interpret_branch_mark(
r
, name, namelen, at - name, buf,
upstream_mark, branch_get_upstream,
allowed);
if (len > 0)
return len;
upstream_mark, branch_get_upstream,
allowed);
if (len > 0)
return len;
- len = interpret_branch_mark(
the_repository
, name, namelen, at - name, buf,
+ len = interpret_branch_mark(
r
, name, namelen, at - name, buf,
push_mark, branch_get_push,
allowed);
if (len > 0)
push_mark, branch_get_push,
allowed);
if (len > 0)