[20/26] wt-status: convert struct wt_status to object_id
diff mbox series

Message ID 20190818200427.870753-21-sandals@crustytoothpaste.net
State New
Headers show
Series
  • object_id part 17
Related show

Commit Message

brian m. carlson Aug. 18, 2019, 8:04 p.m. UTC
Change struct wt_status to use struct object_id instead of an array of
unsigned char.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 builtin/commit.c | 4 ++--
 wt-status.c      | 2 +-
 wt-status.h      | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/builtin/commit.c b/builtin/commit.c
index ae7aaf6dc6..e588bc6ad3 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -510,7 +510,7 @@  static int run_status(FILE *fp, const char *index_file, const char *prefix, int
 	s->nowarn = nowarn;
 	s->is_initial = get_oid(s->reference, &oid) ? 1 : 0;
 	if (!s->is_initial)
-		hashcpy(s->sha1_commit, oid.hash);
+		oidcpy(&s->oid_commit, &oid);
 	s->status_format = status_format;
 	s->ignore_submodule_arg = ignore_submodule_arg;
 
@@ -1406,7 +1406,7 @@  int cmd_status(int argc, const char **argv, const char *prefix)
 
 	s.is_initial = get_oid(s.reference, &oid) ? 1 : 0;
 	if (!s.is_initial)
-		hashcpy(s.sha1_commit, oid.hash);
+		oidcpy(&s.oid_commit, &oid);
 
 	s.ignore_submodule_arg = ignore_submodule_arg;
 	s.status_format = status_format;
diff --git a/wt-status.c b/wt-status.c
index 9f6c65a580..7cf220fed4 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -2025,7 +2025,7 @@  static void wt_porcelain_v2_print_tracking(struct wt_status *s)
 	char eol = s->null_termination ? '\0' : '\n';
 
 	fprintf(s->fp, "# branch.oid %s%c",
-			(s->is_initial ? "(initial)" : sha1_to_hex(s->sha1_commit)),
+			(s->is_initial ? "(initial)" : oid_to_hex(&s->oid_commit)),
 			eol);
 
 	if (!s->branch)
diff --git a/wt-status.h b/wt-status.h
index 77dad5b920..71c3f25f43 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -116,7 +116,7 @@  struct wt_status {
 	int rename_limit;
 	enum wt_status_format status_format;
 	struct wt_status_state state;
-	unsigned char sha1_commit[GIT_MAX_RAWSZ]; /* when not Initial */
+	struct object_id oid_commit; /* when not Initial */
 
 	/* These are computed during processing of the individual sections */
 	int committable;