read_raw_ref(): rename symref argument to referent
After all, it doesn't hold the symbolic reference, but rather the reference referred to. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Michael Haggerty committed
Apr 22, 2016 at 01:11 UTC
92b380931ee8beacb0c09635432b38a02b9fcc7e
2 files changed
+12
-11
refs/files-backend.c
+11
-10
@@ -1393,9 +1393,10 @@ static int resolve_missing_loose_ref(const char *refname,
1393
*
1394
* If the ref is a sha1, fill in sha1 and return 0.
1395
*
1396
- * If the ref is symbolic, fill in *symref with the referrent
1397
- * (e.g. "refs/heads/master") and return 0. The caller is responsible
1398
- * for validating the referrent. Set REF_ISSYMREF in type.
1396
+ * If the ref is symbolic, fill in *referent with the name of the
1397
+ * branch to which it refers (e.g. "refs/heads/master") and return 0.
1398
+ * The caller is responsible for validating the referent. Set
1399
+ * REF_ISSYMREF in type.
1400
*
1401
* If the ref doesn't exist, set errno to ENOENT and return -1.
1402
*
@@ -1411,15 +1412,15 @@ static int resolve_missing_loose_ref(const char *refname,
1412
*
1413
* sb_path is workspace: the caller should allocate and free it.
1414
*
1414
- * It is OK for refname to point into symref. In this case:
1415
- * - if the function succeeds with REF_ISSYMREF, symref will be
1415
+ * It is OK for refname to point into referent. In this case:
1416
+ * - if the function succeeds with REF_ISSYMREF, referent will be
1417
* overwritten and the memory pointed to by refname might be changed
1418
* or even freed.
1418
- * - in all other cases, symref will be untouched, and therefore
1419
+ * - in all other cases, referent will be untouched, and therefore
1420
* refname will still be valid and unchanged.
1421
*/
1422
int read_raw_ref(const char *refname, unsigned char *sha1,
1422
- struct strbuf *symref, unsigned int *type)
1423
+ struct strbuf *referent, unsigned int *type)
1424
{
1425
struct strbuf sb_contents = STRBUF_INIT;
1426
struct strbuf sb_path = STRBUF_INIT;
@@ -1469,7 +1470,7 @@ stat_ref:
1470
}
1471
if (starts_with(sb_contents.buf, "refs/") &&
1472
!check_refname_format(sb_contents.buf, 0)) {
1472
- strbuf_swap(&sb_contents, symref);
1473
+ strbuf_swap(&sb_contents, referent);
1474
*type |= REF_ISSYMREF;
1475
ret = 0;
1476
goto out;
@@ -1518,8 +1519,8 @@ stat_ref:
1519
while (isspace(*buf))
1520
buf++;
1521
1521
- strbuf_reset(symref);
1522
- strbuf_addstr(symref, buf);
1522
+ strbuf_reset(referent);
1523
+ strbuf_addstr(referent, buf);
1524
*type |= REF_ISSYMREF;
1525
ret = 0;
1526
goto out;
refs/refs-internal.h
+1
-1
@@ -210,6 +210,6 @@ int do_for_each_ref(const char *submodule, const char *base,
210
each_ref_fn fn, int trim, int flags, void *cb_data);
211
212
int read_raw_ref(const char *refname, unsigned char *sha1,
213
- struct strbuf *symref, unsigned int *type);
213
+ struct strbuf *referent, unsigned int *type);
214
215
#endif /* REFS_REFS_INTERNAL_H */