Skip to content

Commit 40f5555

Browse files
bk2204gitster
authored andcommitted
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>
1 parent 30e677e commit 40f5555

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

wt-status.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
13501350
const char *color)
13511351
{
13521352
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));
13541354
if (s->hints) {
13551355
if (has_unmerged(s))
13561356
status_printf_ln(s, color,
@@ -1369,7 +1369,7 @@ static void show_revert_in_progress(struct wt_status *s,
13691369
const char *color)
13701370
{
13711371
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));
13731373
if (s->hints) {
13741374
if (has_unmerged(s))
13751375
status_printf_ln(s, color,
@@ -1490,9 +1490,9 @@ static void wt_status_get_detached_from(struct wt_status_state *state)
14901490
} else
14911491
state->detached_from =
14921492
xstrdup(find_unique_abbrev(cb.noid.hash, DEFAULT_ABBREV));
1493-
hashcpy(state->detached_sha1, cb.noid.hash);
1493+
oidcpy(&state->detached_oid, &cb.noid);
14941494
state->detached_at = !get_oid("HEAD", &oid) &&
1495-
!hashcmp(oid.hash, state->detached_sha1);
1495+
!oidcmp(&oid, &state->detached_oid);
14961496

14971497
free(ref);
14981498
strbuf_release(&cb.buf);
@@ -1551,13 +1551,13 @@ void wt_status_get_state(struct wt_status_state *state,
15511551
} else if (!stat(git_path_cherry_pick_head(), &st) &&
15521552
!get_oid("CHERRY_PICK_HEAD", &oid)) {
15531553
state->cherry_pick_in_progress = 1;
1554-
hashcpy(state->cherry_pick_head_sha1, oid.hash);
1554+
oidcpy(&state->cherry_pick_head_oid, &oid);
15551555
}
15561556
wt_status_check_bisect(NULL, state);
15571557
if (!stat(git_path_revert_head(), &st) &&
15581558
!get_oid("REVERT_HEAD", &oid)) {
15591559
state->revert_in_progress = 1;
1560-
hashcpy(state->revert_head_sha1, oid.hash);
1560+
oidcpy(&state->revert_head_oid, &oid);
15611561
}
15621562

15631563
if (get_detached_from)

wt-status.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ struct wt_status_state {
118118
char *branch;
119119
char *onto;
120120
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;
124124
};
125125

126126
size_t wt_status_locate_end(const char *s, size_t len);

0 commit comments

Comments
 (0)