From: "Kyle J. McKay" <mackyle@gmail.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
Junio C Hamano <gitster@pobox.com>
Cc: "repo.or.cz admin team" <admin@repo.or.cz>,
Git mailing list <git@vger.kernel.org>,
Michael Haggerty <mhagger@alum.mit.edu>,
Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: [PATCH v2 00/10] Use a structure for object IDs.
Date: Tue, 10 Mar 2015 19:38:28 -0700 [thread overview]
Message-ID: <82A92572-98E5-4911-87A6-DF5377579436@gmail.com> (raw)
In-Reply-To: <1425770645-628957-1-git-send-email-sandals@crustytoothpaste.net>
On Mar 7, 2015, at 15:23, brian m. carlson wrote:
> This is a patch series to convert some of the relevant uses of
> unsigned
> char [20] to struct object_id.
>
> brian m. carlson (10):
All patches applied for me (to master) and all tests pass.
Tested-by: Kyle J. McKay
> Define a structure for object IDs.
Comments in reply to the patch.
> Define utility functions for object IDs.
> bisect.c: convert leaf functions to use struct object_id
> archive.c: convert to use struct object_id
> zip: use GIT_SHA1_HEXSZ for trailers
> bulk-checkin.c: convert to use struct object_id
> diff: convert struct combine_diff_path to object_id
> commit: convert parts to struct object_id
> patch-id: convert to use struct object_id
> apply: convert threeway_stage to object_id
These all look good, the conversions are simple and easy to follow.
On Mar 7, 2015, at 23:43, Junio C Hamano wrote:
> "brian m. carlson" <sandals@crustytoothpaste.net> writes:
>
>> Certain parts of the code have to be converted before others to
>> keep the
>> patch sizes small, maintainable, and bisectable, so functions and
>> structures that are used across the codebase (e.g. struct object)
>> will
>> be converted later. Conversion has been done in a somewhat haphazard
>> manner by converting modules with leaf functions and less commonly
>> used
>> structs first.
>
> That "leaf-first" approach sounds very sensible.
>
> In the medium term, I wonder if the changes can progress faster and
> in a less error prone way if you first used GIT_SHA1_RAWSZ in places
> that cannot be immediately converted to the struct yet. That way,
> we will be easily tell by "git grep GIT_SHA1_RAWSZ" how many more
> places need treatment. I do not know if that is all that useful
> offhand, though. Those places need to be touched in the second pass
> to use the struct again, after the "s/\[20\]/[GIT_SHA1_RAWSZ]/"
> first pass.
I definitely noticed the leaf-first approach as I was looking through
the patches where, for example (03/10), this prototype was left
unchanged:
static int register_ref(const char *refname, const unsigned char *sha1,
int flags, void *cb_data)
but its contents got the update leaving it half converted. As
mentioned above this makes the patches more manageable, maintainable
and bisectable. However, these functions could be converted to take a
typedef (a quick grep of 'CodingGuidelines' does not mention typedef)
and perhaps, as Junio mentions above, help the changes progress faster
by making it easier to find the affected code (e.g. changing or
removing the typedef would make the compiler find them for you).
For example, if we added this to object.h:
typedef unsigned char sha1raw_t[GIT_SHA1_RAWSZ];
then the above prototype could be immediately converted to (and this
does compile and pass all the tests):
static int register_ref(const char *refname, const sha1raw_t sha,
int flags, void *cb_data)
So that together with Junio's suggestion above (and perhaps also a
sha1hex_t type) would help mark everything in the first pass that
needs to be touched again in the second pass. (I'm just throwing out
some typedef names as an example, there may be more preferable names
to "sha1raw_t" and "sha1hex_t", but those names would end up being
replaced eventually anyway.)
-Kyle
next prev parent reply other threads:[~2015-03-11 2:38 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-07 23:23 [PATCH v2 00/10] Use a structure for object IDs brian m. carlson
2015-03-07 23:23 ` [PATCH v2 01/10] Define " brian m. carlson
[not found] ` <CEA07500-9F47-4B24-AD5D-1423A601A4DD@gmail.com>
2015-03-11 22:08 ` brian m. carlson
2015-03-12 0:26 ` Junio C Hamano
2015-03-12 9:34 ` brian m. carlson
2015-03-12 10:28 ` Michael Haggerty
2015-03-12 10:46 ` brian m. carlson
2015-03-12 11:16 ` Duy Nguyen
2015-03-12 18:24 ` Junio C Hamano
2015-03-12 18:44 ` Junio C Hamano
2015-03-13 0:58 ` Duy Nguyen
2015-03-13 6:03 ` Junio C Hamano
2015-03-14 11:49 ` Duy Nguyen
2015-03-14 22:19 ` Junio C Hamano
2015-03-15 0:17 ` Duy Nguyen
2015-03-15 2:32 ` Junio C Hamano
2015-03-07 23:23 ` [PATCH v2 02/10] Define utility functions " brian m. carlson
2015-03-08 9:57 ` Duy Nguyen
2015-03-08 14:48 ` brian m. carlson
2015-03-11 12:44 ` Michael Haggerty
2015-03-07 23:23 ` [PATCH v2 03/10] bisect.c: convert leaf functions to use struct object_id brian m. carlson
2015-03-07 23:23 ` [PATCH v2 04/10] archive.c: convert " brian m. carlson
2015-03-11 14:20 ` Michael Haggerty
2015-03-11 22:12 ` brian m. carlson
2015-03-07 23:24 ` [PATCH v2 05/10] zip: use GIT_SHA1_HEXSZ for trailers brian m. carlson
2015-03-07 23:24 ` [PATCH v2 06/10] bulk-checkin.c: convert to use struct object_id brian m. carlson
2015-03-07 23:24 ` [PATCH v2 07/10] diff: convert struct combine_diff_path to object_id brian m. carlson
2015-03-07 23:24 ` [PATCH v2 08/10] commit: convert parts to struct object_id brian m. carlson
2015-03-11 14:46 ` Michael Haggerty
2015-03-07 23:24 ` [PATCH v2 09/10] patch-id: convert to use " brian m. carlson
2015-03-07 23:24 ` [PATCH v2 10/10] apply: convert threeway_stage to object_id brian m. carlson
2015-03-08 7:43 ` [PATCH v2 00/10] Use a structure for object IDs Junio C Hamano
2015-03-11 2:38 ` Kyle J. McKay [this message]
2015-03-11 16:08 ` Michael Haggerty
2015-03-11 20:35 ` Junio C Hamano
2015-03-13 22:45 ` brian m. carlson
-- strict thread matches above, loose matches on Subject: below --
2015-03-13 23:39 brian m. carlson
2015-03-14 14:16 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82A92572-98E5-4911-87A6-DF5377579436@gmail.com \
--to=mackyle@gmail.com \
--cc=admin@repo.or.cz \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mhagger@alum.mit.edu \
--cc=sandals@crustytoothpaste.net \
--cc=schwab@linux-m68k.org \
/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.
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 NNTP newsgroup(s).