OSDN Git Service

worktree.c: use is_dot_or_dotdot()
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sun, 22 May 2016 09:33:54 +0000 (16:33 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 May 2016 20:19:22 +0000 (13:19 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c
worktree.c

index bf80111..aaee0e2 100644 (file)
@@ -95,7 +95,7 @@ static void prune_worktrees(void)
        if (!dir)
                return;
        while ((d = readdir(dir)) != NULL) {
-               if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
+               if (is_dot_or_dotdot(d->d_name))
                        continue;
                strbuf_reset(&reason);
                if (!prune_worktree(d->d_name, &reason))
index 6a11611..f4a4f38 100644 (file)
@@ -187,7 +187,7 @@ struct worktree **get_worktrees(void)
        if (dir) {
                while ((d = readdir(dir)) != NULL) {
                        struct worktree *linked = NULL;
-                       if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
+                       if (is_dot_or_dotdot(d->d_name))
                                continue;
 
                        if ((linked = get_linked_worktree(d->d_name))) {