Skip to content

Commit f632ded

Browse files
peffgitster
authored andcommitted
handle_revision_arg: stop using "dotdot" as a generic pointer
The handle_revision_arg() function has a "dotdot" variable that it uses to find a ".." or "..." in the argument. If we don't find one, we look for other marks, like "^!". But we just keep re-using the "dotdot" variable, which is confusing. Let's introduce a separate "mark" variable that can be used for these other marks. They still reuse the same variable, but at least the name is no longer actively misleading. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 1d6c938 commit f632ded

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

revision.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,7 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi
14331433
{
14341434
struct object_context oc;
14351435
char *dotdot;
1436+
char *mark;
14361437
struct object *object;
14371438
unsigned char sha1[20];
14381439
int local_flags;
@@ -1529,33 +1530,33 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi
15291530
*dotdot = '.';
15301531
}
15311532

1532-
dotdot = strstr(arg, "^@");
1533-
if (dotdot && !dotdot[2]) {
1534-
*dotdot = 0;
1533+
mark = strstr(arg, "^@");
1534+
if (mark && !mark[2]) {
1535+
*mark = 0;
15351536
if (add_parents_only(revs, arg, flags, 0))
15361537
return 0;
1537-
*dotdot = '^';
1538+
*mark = '^';
15381539
}
1539-
dotdot = strstr(arg, "^!");
1540-
if (dotdot && !dotdot[2]) {
1541-
*dotdot = 0;
1540+
mark = strstr(arg, "^!");
1541+
if (mark && !mark[2]) {
1542+
*mark = 0;
15421543
if (!add_parents_only(revs, arg, flags ^ (UNINTERESTING | BOTTOM), 0))
1543-
*dotdot = '^';
1544+
*mark = '^';
15441545
}
1545-
dotdot = strstr(arg, "^-");
1546-
if (dotdot) {
1546+
mark = strstr(arg, "^-");
1547+
if (mark) {
15471548
int exclude_parent = 1;
15481549

1549-
if (dotdot[2]) {
1550+
if (mark[2]) {
15501551
char *end;
1551-
exclude_parent = strtoul(dotdot + 2, &end, 10);
1552+
exclude_parent = strtoul(mark + 2, &end, 10);
15521553
if (*end != '\0' || !exclude_parent)
15531554
return -1;
15541555
}
15551556

1556-
*dotdot = 0;
1557+
*mark = 0;
15571558
if (!add_parents_only(revs, arg, flags ^ (UNINTERESTING | BOTTOM), exclude_parent))
1558-
*dotdot = '^';
1559+
*mark = '^';
15591560
}
15601561

15611562
local_flags = 0;

0 commit comments

Comments
 (0)