git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>,
	Michael Haggerty <mhagger@alum.mit.edu>,
	Brandon Williams <bmwill@google.com>
Subject: [PATCH 20/24] worktree: convert struct worktree to object_id
Date: Sun,  1 Oct 2017 22:08:27 +0000	[thread overview]
Message-ID: <20171001220831.214705-21-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20171001220831.214705-1-sandals@crustytoothpaste.net>

Convert the head_sha1 member to be head_oid instead.  This is required
to convert resolve_ref_unsafe.

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

diff --git a/builtin/worktree.c b/builtin/worktree.c
index de26849f55..d9fe6f694e 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -392,7 +392,7 @@ static void show_worktree_porcelain(struct worktree *wt)
 	if (wt->is_bare)
 		printf("bare\n");
 	else {
-		printf("HEAD %s\n", sha1_to_hex(wt->head_sha1));
+		printf("HEAD %s\n", oid_to_hex(&wt->head_oid));
 		if (wt->is_detached)
 			printf("detached\n");
 		else if (wt->head_ref)
@@ -412,7 +412,7 @@ static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)
 		strbuf_addstr(&sb, "(bare)");
 	else {
 		strbuf_addf(&sb, "%-*s ", abbrev_len,
-				find_unique_abbrev(wt->head_sha1, DEFAULT_ABBREV));
+				find_unique_abbrev(wt->head_oid.hash, DEFAULT_ABBREV));
 		if (wt->is_detached)
 			strbuf_addstr(&sb, "(detached HEAD)");
 		else if (wt->head_ref) {
@@ -437,7 +437,7 @@ static void measure_widths(struct worktree **wt, int *abbrev, int *maxlen)
 
 		if (path_len > *maxlen)
 			*maxlen = path_len;
-		sha1_len = strlen(find_unique_abbrev(wt[i]->head_sha1, *abbrev));
+		sha1_len = strlen(find_unique_abbrev(wt[i]->head_oid.hash, *abbrev));
 		if (sha1_len > *abbrev)
 			*abbrev = sha1_len;
 	}
diff --git a/worktree.c b/worktree.c
index 70015629dc..cb35db03fa 100644
--- a/worktree.c
+++ b/worktree.c
@@ -31,7 +31,7 @@ static void add_head_info(struct worktree *wt)
 	target = refs_resolve_ref_unsafe(get_worktree_ref_store(wt),
 					 "HEAD",
 					 0,
-					 wt->head_sha1, &flags);
+					 wt->head_oid.hash, &flags);
 	if (!target)
 		return;
 
diff --git a/worktree.h b/worktree.h
index 9276c81ae7..c28a880e18 100644
--- a/worktree.h
+++ b/worktree.h
@@ -8,7 +8,7 @@ struct worktree {
 	char *id;
 	char *head_ref;		/* NULL if HEAD is broken or detached */
 	char *lock_reason;	/* internal use */
-	unsigned char head_sha1[20];
+	struct object_id head_oid;
 	int is_detached;
 	int is_bare;
 	int is_current;
-- 
2.14.2.822.g60be5d43e6


  parent reply	other threads:[~2017-10-01 22:09 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-01 22:08 [PATCH 00/24] object_id part 10 brian m. carlson
2017-10-01 22:08 ` [PATCH 01/24] walker: convert to struct object_id brian m. carlson
2017-10-01 22:08 ` [PATCH 02/24] refs/files-backend: convert struct ref_to_prune to object_id brian m. carlson
2017-10-01 22:08 ` [PATCH 03/24] refs: convert delete_ref and refs_delete_ref to struct object_id brian m. carlson
2017-10-01 22:08 ` [PATCH 04/24] refs: convert update_ref and refs_update_ref to use " brian m. carlson
2017-10-02 22:37   ` Stefan Beller
2017-10-03  1:23     ` brian m. carlson
2017-10-02 23:08   ` Brandon Williams
2017-10-01 22:08 ` [PATCH 05/24] refs: update ref transactions " brian m. carlson
2017-10-01 22:08 ` [PATCH 06/24] Convert check_connected " brian m. carlson
2017-10-02 23:00   ` Stefan Beller
2017-10-01 22:08 ` [PATCH 07/24] refs: convert resolve_refdup and refs_resolve_refdup to " brian m. carlson
2017-10-01 22:08 ` [PATCH 08/24] refs: convert read_ref and read_ref_full to object_id brian m. carlson
2017-10-01 22:08 ` [PATCH 09/24] refs: convert dwim_ref and expand_ref to struct object_id brian m. carlson
2017-10-01 22:08 ` [PATCH 10/24] builtin/reflog: convert remaining unsigned char uses to object_id brian m. carlson
2017-10-01 22:08 ` [PATCH 11/24] refs: convert dwim_log to struct object_id brian m. carlson
2017-10-01 22:08 ` [PATCH 12/24] pack-bitmap: convert traverse_bitmap_commit_list to object_id brian m. carlson
2017-10-01 22:08 ` [PATCH 13/24] builtin/pack-objects: convert to struct object_id brian m. carlson
2017-10-02 23:20   ` Stefan Beller
2017-10-01 22:08 ` [PATCH 14/24] refs: convert peel_ref " brian m. carlson
2017-10-01 22:08 ` [PATCH 15/24] refs: convert read_ref_at " brian m. carlson
2017-10-02 23:26   ` Brandon Williams
2017-10-01 22:08 ` [PATCH 16/24] refs: convert reflog_expire parameter " brian m. carlson
2017-10-01 22:08 ` [PATCH 17/24] sha1_file: convert index_path and index_fd " brian m. carlson
2017-10-01 22:08 ` [PATCH 18/24] Convert remaining callers of resolve_gitlink_ref to object_id brian m. carlson
2017-10-01 22:08 ` [PATCH 19/24] refs: convert resolve_gitlink_ref to struct object_id brian m. carlson
2017-10-01 22:08 ` brian m. carlson [this message]
2017-10-01 22:08 ` [PATCH 21/24] refs: convert resolve_ref_unsafe " brian m. carlson
2017-10-01 22:08 ` [PATCH 22/24] refs: convert peel_object " brian m. carlson
2017-10-01 22:08 ` [PATCH 23/24] refs: convert read_raw_ref backends " brian m. carlson
2017-10-01 22:08 ` [PATCH 24/24] refs/files-backend: convert static functions to object_id brian m. carlson
2017-10-02 23:34 ` [PATCH 00/24] object_id part 10 Brandon Williams
2017-10-02 23:34 ` Stefan Beller
2017-10-03  1:43   ` brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171001220831.214705-21-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).