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>

brian m. carlson committed Mar 12, 2018 at 02:27 UTC 40f5555ca331fa7855406c674cb60b087e5dfc1a
2 files changed +9 -9
wt-status.c
+6 -6
@@ -1350,7 +1350,7 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
1350 const char *color)
1351 {
1352 status_printf_ln(s, color, _("You are currently cherry-picking commit %s."),
1353 - find_unique_abbrev(state->cherry_pick_head_sha1, DEFAULT_ABBREV));
1353 + find_unique_abbrev(state->cherry_pick_head_oid.hash, DEFAULT_ABBREV));
1354 if (s->hints) {
1355 if (has_unmerged(s))
1356 status_printf_ln(s, color,
@@ -1369,7 +1369,7 @@ static void show_revert_in_progress(struct wt_status *s,
1369 const char *color)
1370 {
1371 status_printf_ln(s, color, _("You are currently reverting commit %s."),
1372 - find_unique_abbrev(state->revert_head_sha1, DEFAULT_ABBREV));
1372 + find_unique_abbrev(state->revert_head_oid.hash, DEFAULT_ABBREV));
1373 if (s->hints) {
1374 if (has_unmerged(s))
1375 status_printf_ln(s, color,
@@ -1490,9 +1490,9 @@ static void wt_status_get_detached_from(struct wt_status_state *state)
1490 } else
1491 state->detached_from =
1492 xstrdup(find_unique_abbrev(cb.noid.hash, DEFAULT_ABBREV));
1493 - hashcpy(state->detached_sha1, cb.noid.hash);
1493 + oidcpy(&state->detached_oid, &cb.noid);
1494 state->detached_at = !get_oid("HEAD", &oid) &&
1495 - !hashcmp(oid.hash, state->detached_sha1);
1495 + !oidcmp(&oid, &state->detached_oid);
1496
1497 free(ref);
1498 strbuf_release(&cb.buf);
@@ -1551,13 +1551,13 @@ void wt_status_get_state(struct wt_status_state *state,
1551 } else if (!stat(git_path_cherry_pick_head(), &st) &&
1552 !get_oid("CHERRY_PICK_HEAD", &oid)) {
1553 state->cherry_pick_in_progress = 1;
1554 - hashcpy(state->cherry_pick_head_sha1, oid.hash);
1554 + oidcpy(&state->cherry_pick_head_oid, &oid);
1555 }
1556 wt_status_check_bisect(NULL, state);
1557 if (!stat(git_path_revert_head(), &st) &&
1558 !get_oid("REVERT_HEAD", &oid)) {
1559 state->revert_in_progress = 1;
1560 - hashcpy(state->revert_head_sha1, oid.hash);
1560 + oidcpy(&state->revert_head_oid, &oid);
1561 }
1562
1563 if (get_detached_from)
wt-status.h
+3 -3
@@ -118,9 +118,9 @@ struct wt_status_state {
118 char *branch;
119 char *onto;
120 char *detached_from;
121 - unsigned char detached_sha1[20];
122 - unsigned char revert_head_sha1[20];
123 - unsigned char cherry_pick_head_sha1[20];
121 + struct object_id detached_oid;
122 + struct object_id revert_head_oid;
123 + struct object_id cherry_pick_head_oid;
124 };
125
126 size_t wt_status_locate_end(const char *s, size_t len);