]> git.ipfire.org Git - thirdparty/git.git/blobdiff - wt-status.c
Merge branch 'ea/blame-use-oideq'
[thirdparty/git.git] / wt-status.c
index d75399085dead1ad52b36a12b505eef02b2036cc..d9872d543b5e367ddfa3cf37a97bc2e4207bd71c 100644 (file)
@@ -703,7 +703,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
        if (!s->show_untracked_files)
                return;
 
-       memset(&dir, 0, sizeof(dir));
+       dir_init(&dir);
        if (s->show_untracked_files != SHOW_ALL_UNTRACKED_FILES)
                dir.flags |=
                        DIR_SHOW_OTHER_DIRECTORIES | DIR_HIDE_EMPTY_DIRECTORIES;
@@ -724,19 +724,15 @@ static void wt_status_collect_untracked(struct wt_status *s)
                struct dir_entry *ent = dir.entries[i];
                if (index_name_is_other(istate, ent->name, ent->len))
                        string_list_insert(&s->untracked, ent->name);
-               free(ent);
        }
 
        for (i = 0; i < dir.ignored_nr; i++) {
                struct dir_entry *ent = dir.ignored[i];
                if (index_name_is_other(istate, ent->name, ent->len))
                        string_list_insert(&s->ignored, ent->name);
-               free(ent);
        }
 
-       free(dir.entries);
-       free(dir.ignored);
-       clear_directory(&dir);
+       dir_clear(&dir);
 
        if (advice_status_u_option)
                s->untracked_in_ms = (getnanotime() - t_begin) / 1000000;
@@ -1573,7 +1569,7 @@ static void wt_status_get_detached_from(struct repository *r,
                return;
        }
 
-       if (dwim_ref(cb.buf.buf, cb.buf.len, &oid, &ref) == 1 &&
+       if (dwim_ref(cb.buf.buf, cb.buf.len, &oid, &ref, 1) == 1 &&
            /* sha1 is a commit? match without further lookup */
            (oideq(&cb.noid, &oid) ||
             /* perhaps sha1 is a tag, try to dereference to a commit */
@@ -1672,13 +1668,13 @@ void wt_status_get_state(struct repository *r,
                state->merge_in_progress = 1;
        } else if (wt_status_check_rebase(NULL, state)) {
                ;               /* all set */
-       } else if (!stat(git_path_cherry_pick_head(r), &st) &&
-                       !get_oid("CHERRY_PICK_HEAD", &oid)) {
+       } else if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
+                  !get_oid("CHERRY_PICK_HEAD", &oid)) {
                state->cherry_pick_in_progress = 1;
                oidcpy(&state->cherry_pick_head_oid, &oid);
        }
        wt_status_check_bisect(NULL, state);
-       if (!stat(git_path_revert_head(r), &st) &&
+       if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") &&
            !get_oid("REVERT_HEAD", &oid)) {
                state->revert_in_progress = 1;
                oidcpy(&state->revert_head_oid, &oid);