Skip to content

Improvements to sha1_file

Jonathan Tan git 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest8 patches 4 repliesIn review
  2. v48 patches 16 repliesSuperseded
  3. v34 patches 0 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v24 patches8 repliesSuperseded
v1 RFC4 patches4 repliesSuperseded

Changes in v5 from the cover letter

- patch 2
- Updated commit message to explain why OBJECT_INFO_ALLOW_UNKNOWN_TYPE is defined to be 2, not 1.
- patch 3
- Made all invocations of sha1_object_info_extended() compare "< 0".
- patch 5
- Made all invocations of sha1_object_info_extended() compare "< 0".
- patch 7
- Rewrote patch to make sha1_object_info_extended() accept NULL struct object_info pointer.
- patch 8
- Made has_sha1_file_with_flags send NULL instead of blank struct object_info.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8sha1_file: teach packed_object_info about typenamesha1_file.c+12 -170 replies
2/8sha1_file: rename LOOKUP_UNKNOWN_OBJECTbuiltin/cat-file.c cache.h sha1_file.c+5 -40 replies
3/8sha1_file: rename LOOKUP_REPLACE_OBJECTbuiltin/cat-file.c cache.h sha1_file.c+18 -180 replies
4/8sha1_file: move delta base cache code upsha1_file.c+110 -1100 replies
5/8sha1_file: refactor read_objectcache.h sha1_file.c+43 -420 replies
6/8sha1_file: improve sha1_object_info_extendedcache.h sha1_file.c+28 -190 replies
7/8sha1_file: do not access pack if unneededsha1_file.c+11 -00 replies
8/8sha1_file: refactor has_sha1_file_with_flagsbuiltin/fetch.c builtin/index-pack.c cache.h +1 more+13 -238 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 0/8] Improvements to sha1_file

Thanks, Junio. A reply to your comment on patch 7:

Quoted 8 lines

... this "if" statement feels like a maintenance nightmare. The intent of the guard, I think, is "when the call wants absolutely nothing but whence", but the implementation of the guard will not stay true to the intent whenever somebody adds a new field to oi.

I wonder if it makes more sense to have a new field "whence_only", which is set only by such a specialized caller, which this guard checks (and no other fields).

After some more thought, I think I came up with a better solution - allow sha1_object_info_extended() to take a NULL struct object_info pointer, and immediately assign it (if NULL) a blank struct, but use the NULL-ness as an indication that we can skip accessing the packfile. The last patch actually doesn't even need the "whence", so we can do this.

Changes from v4:
- patch 2
- Updated commit message to explain why OBJECT_INFO_ALLOW_UNKNOWN_TYPE is defined to be 2, not 1.
- patch 3
- Made all invocations of sha1_object_info_extended() compare "< 0".
- patch 5
- Made all invocations of sha1_object_info_extended() compare "< 0".
- patch 7
- Rewrote patch to make sha1_object_info_extended() accept NULL struct object_info pointer.
- patch 8
- Made has_sha1_file_with_flags send NULL instead of blank struct object_info.

Jonathan Tan (8):
sha1_file: teach packed_object_info about typename
sha1_file: rename LOOKUP_UNKNOWN_OBJECT
sha1_file: rename LOOKUP_REPLACE_OBJECT
sha1_file: move delta base cache code up
sha1_file: refactor read_object
sha1_file: improve sha1_object_info_extended
sha1_file: do not access pack if unneeded
sha1_file: refactor has_sha1_file_with_flags

 builtin/cat-file.c   |   7 +-
 builtin/fetch.c      |  10 +-
 builtin/index-pack.c |   3 +-
 cache.h              |  36 +++--
 sha1_file.c          | 385 ++++++++++++++++++++++++++-------------------------
 5 files changed, 224 insertions(+), 217 deletions(-)
Signature · 1 line
2.13.1.611.g7e3b11ae1-goog