wt-status: convert struct wt_status_state to object_id

Convert the various *_sha1 members to use struct object_id instead.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2018-03-12 02:27:29 +00:00
committed by Junio C Hamano
parent 30e677e0e2
commit 40f5555ca3
2 changed files with 9 additions and 9 deletions

View File

@@ -1350,7 +1350,7 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
const char *color) const char *color)
{ {
status_printf_ln(s, color, _("You are currently cherry-picking commit %s."), status_printf_ln(s, color, _("You are currently cherry-picking commit %s."),
find_unique_abbrev(state->cherry_pick_head_sha1, DEFAULT_ABBREV)); find_unique_abbrev(state->cherry_pick_head_oid.hash, DEFAULT_ABBREV));
if (s->hints) { if (s->hints) {
if (has_unmerged(s)) if (has_unmerged(s))
status_printf_ln(s, color, status_printf_ln(s, color,
@@ -1369,7 +1369,7 @@ static void show_revert_in_progress(struct wt_status *s,
const char *color) const char *color)
{ {
status_printf_ln(s, color, _("You are currently reverting commit %s."), status_printf_ln(s, color, _("You are currently reverting commit %s."),
find_unique_abbrev(state->revert_head_sha1, DEFAULT_ABBREV)); find_unique_abbrev(state->revert_head_oid.hash, DEFAULT_ABBREV));
if (s->hints) { if (s->hints) {
if (has_unmerged(s)) if (has_unmerged(s))
status_printf_ln(s, color, status_printf_ln(s, color,
@@ -1490,9 +1490,9 @@ static void wt_status_get_detached_from(struct wt_status_state *state)
} else } else
state->detached_from = state->detached_from =
xstrdup(find_unique_abbrev(cb.noid.hash, DEFAULT_ABBREV)); xstrdup(find_unique_abbrev(cb.noid.hash, DEFAULT_ABBREV));
hashcpy(state->detached_sha1, cb.noid.hash); oidcpy(&state->detached_oid, &cb.noid);
state->detached_at = !get_oid("HEAD", &oid) && state->detached_at = !get_oid("HEAD", &oid) &&
!hashcmp(oid.hash, state->detached_sha1); !oidcmp(&oid, &state->detached_oid);
free(ref); free(ref);
strbuf_release(&cb.buf); strbuf_release(&cb.buf);
@@ -1551,13 +1551,13 @@ void wt_status_get_state(struct wt_status_state *state,
} else if (!stat(git_path_cherry_pick_head(), &st) && } else if (!stat(git_path_cherry_pick_head(), &st) &&
!get_oid("CHERRY_PICK_HEAD", &oid)) { !get_oid("CHERRY_PICK_HEAD", &oid)) {
state->cherry_pick_in_progress = 1; state->cherry_pick_in_progress = 1;
hashcpy(state->cherry_pick_head_sha1, oid.hash); oidcpy(&state->cherry_pick_head_oid, &oid);
} }
wt_status_check_bisect(NULL, state); wt_status_check_bisect(NULL, state);
if (!stat(git_path_revert_head(), &st) && if (!stat(git_path_revert_head(), &st) &&
!get_oid("REVERT_HEAD", &oid)) { !get_oid("REVERT_HEAD", &oid)) {
state->revert_in_progress = 1; state->revert_in_progress = 1;
hashcpy(state->revert_head_sha1, oid.hash); oidcpy(&state->revert_head_oid, &oid);
} }
if (get_detached_from) if (get_detached_from)

View File

@@ -118,9 +118,9 @@ struct wt_status_state {
char *branch; char *branch;
char *onto; char *onto;
char *detached_from; char *detached_from;
unsigned char detached_sha1[20]; struct object_id detached_oid;
unsigned char revert_head_sha1[20]; struct object_id revert_head_oid;
unsigned char cherry_pick_head_sha1[20]; struct object_id cherry_pick_head_oid;
}; };
size_t wt_status_locate_end(const char *s, size_t len); size_t wt_status_locate_end(const char *s, size_t len);