sha1-name.c: remove the_repo from interpret_branch_mark()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Apr 16, 2019 at 16:33 UTC
ea1c873c7dd82353e7b42b5b9612946dac354142
1 file changed
+7
-6
sha1-name.c
+7
-6
@@ -1412,9 +1412,9 @@ static int reinterpret(const char *name, int namelen, int len,
1412
return ret - used + len;
1413
}
1414
1415
-static void set_shortened_ref(struct strbuf *buf, const char *ref)
1415
+static void set_shortened_ref(struct repository *r, struct strbuf *buf, const char *ref)
1416
{
1417
- char *s = shorten_unambiguous_ref(ref, 0);
1417
+ char *s = refs_shorten_unambiguous_ref(get_main_ref_store(r), ref, 0);
1418
strbuf_reset(buf);
1419
strbuf_addstr(buf, s);
1420
free(s);
@@ -1435,7 +1435,8 @@ static int branch_interpret_allowed(const char *refname, unsigned allowed)
1435
return 0;
1436
}
1437
1438
-static int interpret_branch_mark(const char *name, int namelen,
1438
+static int interpret_branch_mark(struct repository *r,
1439
+ const char *name, int namelen,
1440
int at, struct strbuf *buf,
1441
int (*get_mark)(const char *, int),
1442
const char *(*get_data)(struct branch *,
@@ -1468,7 +1469,7 @@ static int interpret_branch_mark(const char *name, int namelen,
1469
if (!branch_interpret_allowed(value, allowed))
1470
return -1;
1471
1471
- set_shortened_ref(buf, value);
1472
+ set_shortened_ref(r, buf, value);
1473
return len + at;
1474
}
1475
@@ -1509,13 +1510,13 @@ int repo_interpret_branch_name(struct repository *r,
1510
allowed);
1511
}
1512
1512
- len = interpret_branch_mark(name, namelen, at - name, buf,
1513
+ len = interpret_branch_mark(the_repository, name, namelen, at - name, buf,
1514
upstream_mark, branch_get_upstream,
1515
allowed);
1516
if (len > 0)
1517
return len;
1518
1518
- len = interpret_branch_mark(name, namelen, at - name, buf,
1519
+ len = interpret_branch_mark(the_repository, name, namelen, at - name, buf,
1520
push_mark, branch_get_push,
1521
allowed);
1522
if (len > 0)