git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/9] Use a structure for object IDs.
@ 2014-05-03 20:12 brian m. carlson
  2014-05-03 20:12 ` [PATCH 1/9] Define " brian m. carlson
                   ` (10 more replies)
  0 siblings, 11 replies; 39+ messages in thread
From: brian m. carlson @ 2014-05-03 20:12 UTC (permalink / raw)
  To: git

This is a preliminary RFC patch series to move all the relevant uses of
unsigned char [20] to struct object_id.  It should not be applied to any
branch yet.

The goal of this series to improve type-checking in the codebase and to
make it easier to move to a different hash function if the project
decides to do that.  This series does not convert all of the codebase,
but only parts.  I'm looking for feedback to see if there is consensus
that this is the right direction before investing a large amount of
time.

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. hashcmp and struct
object) will be converted later.  Conversion has been done in a roughly
alphabetical order by name of file.

The constants for raw and hex sizes of SHA-1 values are maintained.
These constants are used where the quantity is the size of an SHA-1
value, and sizeof(struct object_id) is used wherever memory is to be
allocated.  This is done to permit the struct to turn into a union later
if multiple hashes are supported.  I left the names at GIT_OID_RAWSZ and
GIT_OID_HEXSZ because that's what libgit2 uses and what Junio seemed to
prefer, but they can be changed later if there's a desire to do that.

I called the structure member "oid" because it was easily grepable and
distinct from the rest of the codebase.  It, too, can be changed if we
decide on a better name.  I specifically did not choose "sha1" since it
looks weird to have "sha1->sha1" and I didn't want to rename lots of
variables.

Comments?

brian m. carlson (9):
  Define a structure for object IDs.
  bisect.c: convert to use struct object_id
  archive.c: convert to use struct object_id
  zip: use GIT_OID_HEXSZ for trailers
  branch.c: convert to use struct object_id
  bulk-checkin.c: convert to use struct object_id
  bundle.c: convert leaf functions to struct object_id
  cache-tree: convert struct cache_tree to use object_id
  diff: convert struct combine_diff_path to object_id

 archive-zip.c          |  4 ++--
 archive.c              | 16 +++++++--------
 archive.h              |  1 +
 bisect.c               | 30 ++++++++++++++--------------
 branch.c               | 16 +++++++--------
 builtin/commit.c       |  2 +-
 builtin/fsck.c         |  4 ++--
 bulk-checkin.c         | 12 +++++------
 bundle.c               | 38 +++++++++++++++++------------------
 cache-tree.c           | 30 ++++++++++++++--------------
 cache-tree.h           |  3 ++-
 combine-diff.c         | 54 +++++++++++++++++++++++++-------------------------
 diff-lib.c             | 10 +++++-----
 diff.h                 |  5 +++--
 merge-recursive.c      |  2 +-
 object.h               | 13 +++++++++++-
 reachable.c            |  2 +-
 sequencer.c            |  2 +-
 test-dump-cache-tree.c |  4 ++--
 19 files changed, 131 insertions(+), 117 deletions(-)

-- 
2.0.0.rc0

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2014-05-06 16:45 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-03 20:12 [RFC PATCH 0/9] Use a structure for object IDs brian m. carlson
2014-05-03 20:12 ` [PATCH 1/9] Define " brian m. carlson
2014-05-04  6:07   ` Michael Haggerty
2014-05-04  9:21     ` Johannes Sixt
2014-05-04  9:43       ` David Kastrup
2014-05-04 10:55       ` Andreas Schwab
2014-05-04 20:18         ` Johannes Sixt
2014-05-04 21:31           ` Andreas Schwab
2014-05-05  5:19             ` David Kastrup
2014-05-05  9:23               ` Andreas Schwab
2014-05-05  9:33                 ` James Denholm
2014-05-05  9:50                 ` David Kastrup
2014-05-05 10:52                   ` Michael Haggerty
2014-05-05 11:05                   ` Andreas Schwab
2014-05-05 11:23                     ` David Kastrup
2014-05-05 18:16                     ` Felipe Contreras
2014-05-04 12:29     ` Duy Nguyen
2014-05-04 16:07     ` brian m. carlson
2014-05-04 16:48       ` Andreas Schwab
2014-05-04 17:07         ` David Kastrup
2014-05-04 17:24           ` Andreas Schwab
2014-05-04 17:44             ` David Kastrup
2014-05-04 18:01               ` Andreas Schwab
2014-05-03 20:12 ` [PATCH 2/9] bisect.c: convert to use struct object_id brian m. carlson
2014-05-03 20:12 ` [PATCH 3/9] archive.c: " brian m. carlson
2014-05-03 20:12 ` [PATCH 4/9] zip: use GIT_OID_HEXSZ for trailers brian m. carlson
2014-05-03 20:12 ` [PATCH 5/9] branch.c: convert to use struct object_id brian m. carlson
2014-05-03 20:12 ` [PATCH 6/9] bulk-checkin.c: " brian m. carlson
2014-05-03 20:12 ` [PATCH 7/9] bundle.c: convert leaf functions to " brian m. carlson
2014-05-06 14:42   ` Michael Haggerty
2014-05-03 20:12 ` [PATCH 8/9] cache-tree: convert struct cache_tree to use object_id brian m. carlson
2014-05-06 14:53   ` Michael Haggerty
2014-05-06 15:02   ` Michael Haggerty
2014-05-03 20:12 ` [PATCH 9/9] diff: convert struct combine_diff_path to object_id brian m. carlson
2014-05-06 15:08   ` Michael Haggerty
2014-05-03 22:49 ` [RFC PATCH 0/9] Use a structure for object IDs brian m. carlson
2014-05-04  6:35 ` Michael Haggerty
2014-05-04  9:19   ` Johannes Sixt
2014-05-04 17:54   ` brian m. carlson

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).