worktree: reorder an if statement
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 28 Nov 2016 09:36:53 +0000 (16:36 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Nov 2016 21:18:51 +0000 (13:18 -0800)
This is no-op. But it helps reduce diff noise in the next patch.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c

index 5c4854d3e4a679f59f4a7db7cb3f37bd0e210622..8a654e4ad3ee8d830e9271f13ae2335528a1d1b7 100644 (file)
@@ -406,10 +406,10 @@ static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)
        else {
                strbuf_addf(&sb, "%-*s ", abbrev_len,
                                find_unique_abbrev(wt->head_sha1, DEFAULT_ABBREV));
-               if (!wt->is_detached)
-                       strbuf_addf(&sb, "[%s]", shorten_unambiguous_ref(wt->head_ref, 0));
-               else
+               if (wt->is_detached)
                        strbuf_addstr(&sb, "(detached HEAD)");
+               else
+                       strbuf_addf(&sb, "[%s]", shorten_unambiguous_ref(wt->head_ref, 0));
        }
        printf("%s\n", sb.buf);