OSDN Git Service

Merge branch 'jk/status-read-branch-name-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 17 Feb 2015 18:15:28 +0000 (10:15 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 Feb 2015 18:15:29 +0000 (10:15 -0800)
Code to read branch name from various files in .git/ directory
would have misbehaved if the code to write them left an empty file.

* jk/status-read-branch-name-fix:
  read_and_strip_branch: fix typo'd address-of operator

wt-status.c

index b54eac5..29666d0 100644 (file)
@@ -1140,7 +1140,7 @@ static char *read_and_strip_branch(const char *path)
        if (strbuf_read_file(&sb, git_path("%s", path), 0) <= 0)
                goto got_nothing;
 
-       while (&sb.len && sb.buf[sb.len - 1] == '\n')
+       while (sb.len && sb.buf[sb.len - 1] == '\n')
                strbuf_setlen(&sb, sb.len - 1);
        if (!sb.len)
                goto got_nothing;