mbox series

[v4,00/22] fsck: API improvements

Message ID 20210316161738.30254-1-avarab@gmail.com (mailing list archive)
Headers show
Series fsck: API improvements | expand

Message

Ævar Arnfjörð Bjarmason March 16, 2021, 4:17 p.m. UTC
A re-send of a rebased v3, which I sent at:
http://lore.kernel.org/git/20210306110439.27694-1-avarab@gmail.com as
seen in the range-diff there are no changes since v3. I'm just sending
this as a post-release bump of this, per
https://lore.kernel.org/git/xmqqy2etczqi.fsf@gitster.g/

Ævar Arnfjörð Bjarmason (22):
  fsck.h: update FSCK_OPTIONS_* for object_name
  fsck.h: use designed initializers for FSCK_OPTIONS_{DEFAULT,STRICT}
  fsck.h: reduce duplication between FSCK_OPTIONS_{DEFAULT,STRICT}
  fsck.h: add a FSCK_OPTIONS_COMMON_ERROR_FUNC macro
  fsck.h: indent arguments to of fsck_set_msg_type
  fsck.h: use "enum object_type" instead of "int"
  fsck.c: rename variables in fsck_set_msg_type() for less confusion
  fsck.c: move definition of msg_id into append_msg_id()
  fsck.c: rename remaining fsck_msg_id "id" to "msg_id"
  fsck.c: refactor fsck_msg_type() to limit scope of "int msg_type"
  fsck.h: move FSCK_{FATAL,INFO,ERROR,WARN,IGNORE} into an enum
  fsck.h: re-order and re-assign "enum fsck_msg_type"
  fsck.c: call parse_msg_type() early in fsck_set_msg_type()
  fsck.c: undefine temporary STR macro after use
  fsck.c: give "FOREACH_MSG_ID" a more specific name
  fsck.[ch]: move FOREACH_FSCK_MSG_ID & fsck_msg_id from *.c to *.h
  fsck.c: pass along the fsck_msg_id in the fsck_error callback
  fsck.c: add an fsck_set_msg_type() API that takes enums
  fsck.c: move gitmodules_{found,done} into fsck_options
  fetch-pack: don't needlessly copy fsck_options
  fetch-pack: use file-scope static struct for fsck_options
  fetch-pack: use new fsck API to printing dangling submodules

 Makefile                 |   1 +
 builtin/fsck.c           |   7 +-
 builtin/index-pack.c     |  30 ++-----
 builtin/mktag.c          |   7 +-
 builtin/unpack-objects.c |   3 +-
 fetch-pack.c             |   6 +-
 fsck-cb.c                |  16 ++++
 fsck.c                   | 175 ++++++++++++---------------------------
 fsck.h                   | 132 ++++++++++++++++++++++++++---
 9 files changed, 211 insertions(+), 166 deletions(-)
 create mode 100644 fsck-cb.c

Range-diff:
 1:  9d809466bd =  1:  9cd942b526 fsck.h: update FSCK_OPTIONS_* for object_name
 2:  33e8b6d654 =  2:  d67966b838 fsck.h: use designed initializers for FSCK_OPTIONS_{DEFAULT,STRICT}
 3:  c23f7ce9e4 =  3:  211472e0c5 fsck.h: reduce duplication between FSCK_OPTIONS_{DEFAULT,STRICT}
 4:  5dde68df6c =  4:  70afee988d fsck.h: add a FSCK_OPTIONS_COMMON_ERROR_FUNC macro
 5:  7ae35a6e9d =  5:  1337d53352 fsck.h: indent arguments to of fsck_set_msg_type
 6:  dfb5f754b3 =  6:  e4ef107bb4 fsck.h: use "enum object_type" instead of "int"
 7:  fd58ec73c6 =  7:  20bac3207e fsck.c: rename variables in fsck_set_msg_type() for less confusion
 8:  48cb4d3bb7 =  8:  09c3bba9e9 fsck.c: move definition of msg_id into append_msg_id()
 9:  2c80ad3203 =  9:  8067df53a2 fsck.c: rename remaining fsck_msg_id "id" to "msg_id"
10:  92dfbdfb62 = 10:  bdf5e13f3d fsck.c: refactor fsck_msg_type() to limit scope of "int msg_type"
11:  c1c476af69 = 11:  b03caa237f fsck.h: move FSCK_{FATAL,INFO,ERROR,WARN,IGNORE} into an enum
12:  d55587719a = 12:  7b1d13b4cc fsck.h: re-order and re-assign "enum fsck_msg_type"
13:  32828d1c78 = 13:  a8e4ca7b19 fsck.c: call parse_msg_type() early in fsck_set_msg_type()
14:  5c62066235 = 14:  214c375a20 fsck.c: undefine temporary STR macro after use
15:  f8e50fbf7d = 15:  19a2499a80 fsck.c: give "FOREACH_MSG_ID" a more specific name
16:  cd74dee876 = 16:  6e1a7b6274 fsck.[ch]: move FOREACH_FSCK_MSG_ID & fsck_msg_id from *.c to *.h
17:  234e287d08 = 17:  42af4e164c fsck.c: pass along the fsck_msg_id in the fsck_error callback
18:  8049dc0739 = 18:  fa47f473a8 fsck.c: add an fsck_set_msg_type() API that takes enums
19:  4224a29d15 = 19:  4cc3880cc4 fsck.c: move gitmodules_{found,done} into fsck_options
20:  40b1346812 = 20:  fd219d318a fetch-pack: don't needlessly copy fsck_options
21:  8e418abfbd = 21:  e4cd8c250e fetch-pack: use file-scope static struct for fsck_options
22:  113de190f7 = 22:  fdbc3c304c fetch-pack: use new fsck API to printing dangling submodules

Comments

Derrick Stolee March 16, 2021, 7:35 p.m. UTC | #1
On 3/16/2021 12:17 PM, Ævar Arnfjörð Bjarmason wrote:
> A re-send of a rebased v3, which I sent at:
> http://lore.kernel.org/git/20210306110439.27694-1-avarab@gmail.com as
> seen in the range-diff there are no changes since v3. I'm just sending
> this as a post-release bump of this, per
> https://lore.kernel.org/git/xmqqy2etczqi.fsf@gitster.g/
> 
> Ævar Arnfjörð Bjarmason (22):
>   fsck.h: update FSCK_OPTIONS_* for object_name
>   fsck.h: use designed initializers for FSCK_OPTIONS_{DEFAULT,STRICT}
>   fsck.h: reduce duplication between FSCK_OPTIONS_{DEFAULT,STRICT}
>   fsck.h: add a FSCK_OPTIONS_COMMON_ERROR_FUNC macro
>   fsck.h: indent arguments to of fsck_set_msg_type
>   fsck.h: use "enum object_type" instead of "int"
>   fsck.c: rename variables in fsck_set_msg_type() for less confusion
>   fsck.c: move definition of msg_id into append_msg_id()
>   fsck.c: rename remaining fsck_msg_id "id" to "msg_id"
>   fsck.c: refactor fsck_msg_type() to limit scope of "int msg_type"
>   fsck.h: move FSCK_{FATAL,INFO,ERROR,WARN,IGNORE} into an enum
>   fsck.h: re-order and re-assign "enum fsck_msg_type"
>   fsck.c: call parse_msg_type() early in fsck_set_msg_type()
>   fsck.c: undefine temporary STR macro after use
>   fsck.c: give "FOREACH_MSG_ID" a more specific name
>   fsck.[ch]: move FOREACH_FSCK_MSG_ID & fsck_msg_id from *.c to *.h
>   fsck.c: pass along the fsck_msg_id in the fsck_error callback
>   fsck.c: add an fsck_set_msg_type() API that takes enums
>   fsck.c: move gitmodules_{found,done} into fsck_options
>   fetch-pack: don't needlessly copy fsck_options
>   fetch-pack: use file-scope static struct for fsck_options
>   fetch-pack: use new fsck API to printing dangling submodules

This series is carefully organized and motivated. It was quite
easy to read.

My complaints were minor. One was that patches 1-4 seemed to be
unnecessarily granular. I'm not sure that having four patches
like that will be more helpful for inspecting the history in
the future. But, I don't care enough to say this should be
re-rolled.

Finally, the last issue is that fsck-cb.c is loosely justified
with only one method inside. If you have plans in the near
future to add similar methods there, then I think that is fine.
Otherwise, it would be simpler to avoid the extra file and
code move.

Thanks,
-Stolee