git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 04/13] remote: convert struct push_cas to struct object_id

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jul 13, 2017, 23:49 UTC
Message-ID
<20170713234930.949612-5-sandals@crustytoothpaste.net>
In-Reply-To
<20170713234930.949612-1-sandals@crustytoothpaste.net>
This gets rid of one use of get_sha1.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 remote.c | 6 +++---
 remote.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/remote.c b/remote.c
index d87482573d..9da9040bf0 100644
--- a/remote.c
+++ b/remote.c
@@ -2294,8 +2294,8 @@ static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, i
 	if (!*colon)
 		entry->use_tracking = 1;
 	else if (!colon[1])
-		hashclr(entry->expect);
-	else if (get_sha1(colon + 1, entry->expect))
+		oidclr(&entry->expect);
+	else if (get_oid(colon + 1, &entry->expect))
 		return error("cannot parse expected object name '%s'", colon + 1);
 	return 0;
 }
@@ -2342,7 +2342,7 @@ static void apply_cas(struct push_cas_option *cas,
 			continue;
 		ref->expect_old_sha1 = 1;
 		if (!entry->use_tracking)
-			hashcpy(ref->old_oid_expect.hash, cas->entry[i].expect);
+			oidcpy(&ref->old_oid_expect, &entry->expect);
 		else if (remote_tracking(remote, ref->name, &ref->old_oid_expect))
 			oidclr(&ref->old_oid_expect);
 		return;
diff --git a/remote.h b/remote.h
index 6c28cd3e4b..2ecf4c8c74 100644
--- a/remote.h
+++ b/remote.h
@@ -282,7 +282,7 @@ struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet
 struct push_cas_option {
 	unsigned use_tracking_for_rest:1;
 	struct push_cas {
-		unsigned char expect[20];
+		struct object_id expect;
 		unsigned use_tracking:1;
 		char *refname;
 	} *entry;
Previous: brian m. carlsonNext: brian m. carlson
Message 12 of 15 in “object_id part 9”
  1. 00/13 object_id part 9brian m. carlson, Jul 13, 2017
  2. 01/13 builtin/fsck: convert remaining caller of get_sha1 to object_idbrian m. carlson, Jul 13, 2017
  3. 02/13 builtin/merge-tree: convert remaining caller of get_sha1 to object_idbrian m. carlson, Jul 13, 2017
  4. 10/13 Convert remaining callers of get_sha1 to get_oid.brian m. carlson, Jul 13, 2017
  5. 05/13 sequencer: convert to struct object_idbrian m. carlson, Jul 13, 2017
  6. 07/13 bisect: convert bisect_checkout to struct object_idbrian m. carlson, Jul 13, 2017
  7. 11/13 sha1_name: convert get_sha1* to get_oid*brian m. carlson, Jul 13, 2017
  8. 09/13 builtin/verify-tag: convert to struct object_idbrian m. carlson, Jul 13, 2017
  9. 06/13 builtin/update_ref: convert to struct object_idbrian m. carlson, Jul 13, 2017
  10. 08/13 builtin/unpack-file: convert to struct object_idbrian m. carlson, Jul 13, 2017
  11. 03/13 submodule: convert submodule config lookup to use object_idbrian m. carlson, Jul 13, 2017
  12. 04/13 remote: convert struct push_cas to struct object_idbrian m. carlson, Jul 13, 2017
  13. 12/13 sha1_name: convert GET_SHA1* flags to GET_OID*brian m. carlson, Jul 13, 2017
  14. 13/13 sha1_name: convert uses of 40 to GIT_SHA1_HEXSZbrian m. carlson, Jul 13, 2017
  15. Brandon WilliamsJul 14, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.