Fix broken sha1 locking
[gitweb.git] / wt-status.c
index ec2c7286b1fdbddda8e305a32549ca1362e36b64..050922df54de483cf7112aeb397fc555e4eb2310 100644 (file)
@@ -41,15 +41,14 @@ void wt_status_prepare(struct wt_status *s)
 
        s->is_initial = get_sha1("HEAD", sha1) ? 1 : 0;
 
-       head = resolve_ref(git_path("HEAD"), sha1, 0);
-       s->branch = head ?
-                   strdup(head + strlen(get_git_dir()) + 1) :
-                   NULL;
+       head = resolve_ref("HEAD", sha1, 0);
+       s->branch = head ? xstrdup(head) : NULL;
 
        s->reference = "HEAD";
        s->amend = 0;
        s->verbose = 0;
        s->commitable = 0;
+       s->untracked = 0;
 }
 
 static void wt_status_print_header(const char *main, const char *sub)
@@ -77,7 +76,7 @@ static void wt_status_print_filepair(int t, struct diff_filepair *p)
                                p->one->path, p->two->path);
                break;
        case DIFF_STATUS_DELETED:
-               color_printf_ln(c, "deleted: %s", p->one->path); break;
+               color_printf(c, "deleted: %s", p->one->path); break;
        case DIFF_STATUS_MODIFIED:
                color_printf(c, "modified: %s", p->one->path); break;
        case DIFF_STATUS_RENAMED:
@@ -188,6 +187,10 @@ static void wt_status_print_untracked(const struct wt_status *s)
        memset(&dir, 0, sizeof(dir));
 
        dir.exclude_per_dir = ".gitignore";
+       if (!s->untracked) {
+               dir.show_other_directories = 1;
+               dir.hide_empty_directories = 1;
+       }
        x = git_path("info/exclude");
        if (file_exists(x))
                add_excludes_from_file(&dir, x);