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: Brandon Williams <bmwill@google.com>,
	Stefan Beller <stefanbeller@gmail.com>, Jeff King <peff@peff.net>
Subject: [PATCH v2 07/13] bisect: convert bisect_checkout to struct object_id
Date: Thu, 13 Jul 2017 23:49:24 +0000	[thread overview]
Message-ID: <20170713234930.949612-8-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20170713234930.949612-1-sandals@crustytoothpaste.net>

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 bisect.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/bisect.c b/bisect.c
index a9fd9fbc61..2549eaf7b1 100644
--- a/bisect.c
+++ b/bisect.c
@@ -680,16 +680,16 @@ static int is_expected_rev(const struct object_id *oid)
 	return res;
 }
 
-static int bisect_checkout(const unsigned char *bisect_rev, int no_checkout)
+static int bisect_checkout(const struct object_id *bisect_rev, int no_checkout)
 {
 	char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
 
-	memcpy(bisect_rev_hex, sha1_to_hex(bisect_rev), GIT_SHA1_HEXSZ + 1);
-	update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
+	memcpy(bisect_rev_hex, oid_to_hex(bisect_rev), GIT_SHA1_HEXSZ + 1);
+	update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev->hash, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
 
 	argv_checkout[2] = bisect_rev_hex;
 	if (no_checkout) {
-		update_ref(NULL, "BISECT_HEAD", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
+		update_ref(NULL, "BISECT_HEAD", bisect_rev->hash, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
 	} else {
 		int res;
 		res = run_command_v_opt(argv_checkout, RUN_GIT_CMD);
@@ -796,7 +796,7 @@ static void check_merge_bases(int no_checkout)
 			handle_skipped_merge_base(mb);
 		} else {
 			printf(_("Bisecting: a merge base must be tested\n"));
-			exit(bisect_checkout(mb->hash, no_checkout));
+			exit(bisect_checkout(mb, no_checkout));
 		}
 	}
 
@@ -939,7 +939,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
 	struct rev_info revs;
 	struct commit_list *tried;
 	int reaches = 0, all = 0, nr, steps;
-	const unsigned char *bisect_rev;
+	struct object_id *bisect_rev;
 	char *steps_msg;
 
 	read_bisect_terms(&term_bad, &term_good);
@@ -977,11 +977,11 @@ int bisect_next_all(const char *prefix, int no_checkout)
 		exit(4);
 	}
 
-	bisect_rev = revs.commits->item->object.oid.hash;
+	bisect_rev = &revs.commits->item->object.oid;
 
-	if (!hashcmp(bisect_rev, current_bad_oid->hash)) {
+	if (!oidcmp(bisect_rev, current_bad_oid)) {
 		exit_if_skipped_commits(tried, current_bad_oid);
-		printf("%s is the first %s commit\n", sha1_to_hex(bisect_rev),
+		printf("%s is the first %s commit\n", oid_to_hex(bisect_rev),
 			term_bad);
 		show_diff_tree(prefix, revs.commits->item);
 		/* This means the bisection process succeeded. */

  parent reply	other threads:[~2017-07-13 23:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13 23:49 [PATCH v2 00/13] object_id part 9 brian m. carlson
2017-07-13 23:49 ` [PATCH v2 01/13] builtin/fsck: convert remaining caller of get_sha1 to object_id brian m. carlson
2017-07-13 23:49 ` [PATCH v2 02/13] builtin/merge-tree: " brian m. carlson
2017-07-13 23:49 ` [PATCH v2 03/13] submodule: convert submodule config lookup to use object_id brian m. carlson
2017-07-13 23:49 ` [PATCH v2 04/13] remote: convert struct push_cas to struct object_id brian m. carlson
2017-07-13 23:49 ` [PATCH v2 05/13] sequencer: convert " brian m. carlson
2017-07-13 23:49 ` [PATCH v2 06/13] builtin/update_ref: " brian m. carlson
2017-07-13 23:49 ` brian m. carlson [this message]
2017-07-13 23:49 ` [PATCH v2 08/13] builtin/unpack-file: " brian m. carlson
2017-07-13 23:49 ` [PATCH v2 09/13] builtin/verify-tag: " brian m. carlson
2017-07-13 23:49 ` [PATCH v2 10/13] Convert remaining callers of get_sha1 to get_oid brian m. carlson
2017-07-13 23:49 ` [PATCH v2 11/13] sha1_name: convert get_sha1* to get_oid* brian m. carlson
2017-07-13 23:49 ` [PATCH v2 12/13] sha1_name: convert GET_SHA1* flags to GET_OID* brian m. carlson
2017-07-13 23:49 ` [PATCH v2 13/13] sha1_name: convert uses of 40 to GIT_SHA1_HEXSZ brian m. carlson
2017-07-14 19:35 ` [PATCH v2 00/13] object_id part 9 Brandon Williams

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=20170713234930.949612-8-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=stefanbeller@gmail.com \
    /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).