Skip to content

Allow writing invalid OIDs into refs for testing purposes

Han-Wen Nienhuys via GitGitGadget git 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest8 patches 1 replyIn review
  2. v38 patches 1 replySuperseded
  3. v26 patches 11 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches1 replySuperseded

Changes in v4 from the cover letter

* fix stack OOB read due to missing array terminator.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8test-ref-store: remove force-create argument for create-reflogt/helper/test-ref-store.c t/t1405-main-ref-store.sh t/t1406-submodule-ref-store.sh+4 -50 replies
2/8test-ref-store: parse symbolic flag constantst/helper/test-ref-store.c t/t1405-main-ref-store.sh+60 -90 replies
3/8test-ref-store: plug memory leak in cmd_delete_refst/helper/test-ref-store.c+4 -10 replies
4/8refs: update comment.refs/files-backend.c+1 -20 replies
5/8refs: introduce REF_SKIP_OID_VERIFICATION flagrefs.h refs/files-backend.c t/helper/test-ref-store.c +2 more+43 -270 replies
6/8refs: introduce REF_SKIP_REFNAME_VERIFICATION flagrefs.c refs.h t/helper/test-ref-store.c +1 more+45 -320 replies
7/8t1430: remove refs using test-toolt/t1430-bad-ref-name.sh+12 -120 replies
8/8t1430: create valid symrefs using test-helpert/t1430-bad-ref-name.sh+6 -80 replies

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH v4 0/8] Allow writing invalid OIDs into refs for testing purposes

this covers a few cases of direct filesystem access to the ref database in tests.

v4:

* fix stack OOB read due to missing array terminator.

Han-Wen Nienhuys (8):
test-ref-store: remove force-create argument for create-reflog
test-ref-store: parse symbolic flag constants
test-ref-store: plug memory leak in cmd_delete_refs
refs: update comment.
refs: introduce REF_SKIP_OID_VERIFICATION flag
refs: introduce REF_SKIP_REFNAME_VERIFICATION flag
t1430: remove refs using test-tool
t1430: create valid symrefs using test-helper

 refs.c                         |  7 +--
 refs.h                         | 16 +++++-
 refs/files-backend.c           | 53 ++++++++++---------
 t/helper/test-ref-store.c      | 75 +++++++++++++++++++++++----
 t/t1006-cat-file.sh            |  5 +-
 t/t1405-main-ref-store.sh      |  8 ++-
 t/t1406-submodule-ref-store.sh |  2 +-
 t/t1430-bad-ref-name.sh        | 93 ++++++++++++++++++----------------
 t/t3800-mktag.sh               |  6 ++-
 9 files changed, 172 insertions(+), 93 deletions(-)

base-commit: abe6bb3905392d5eb6b01fa6e54d7e784e0522aa
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1147%2Fhanwen%2Fskip-verification-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1147/hanwen/skip-verification-v4
Pull-Request: https://github.com/git/git/pull/1147

Range-diff vs v3:

 1:  3649ef6d0fa = 1:  3649ef6d0fa test-ref-store: remove force-create argument for create-reflog
 2:  3cdebd2dbca ! 2:  865458bc0cb test-ref-store: parse symbolic flag constants
     @@ t/helper/test-ref-store.c
      +	return result;
      +}
      +
     -+static struct flag_definition empty_flags[] = {
     -+	{ NULL, 0 },
     -+};
     ++static struct flag_definition empty_flags[] = { { NULL, 0 } };
      +
       static const char *notnull(const char *arg, const char *name)
       {
     @@ t/helper/test-ref-store.c: static const char **get_store(const char **argv, stru
       	return argv + 1;
       }
       
     -+static struct flag_definition pack_flags[] = {
     -+	FLAG_DEF(PACK_REFS_PRUNE),
     -+	FLAG_DEF(PACK_REFS_ALL),
     -+};
     ++static struct flag_definition pack_flags[] = { FLAG_DEF(PACK_REFS_PRUNE),
     ++					       FLAG_DEF(PACK_REFS_ALL),
     ++					       { NULL, 0 } };
       
       static int cmd_pack_refs(struct ref_store *refs, const char **argv)
       {
     @@ t/helper/test-ref-store.c: static int cmd_create_symref(struct ref_store *refs,
      +static struct flag_definition transaction_flags[] = {
      +	FLAG_DEF(REF_NO_DEREF),
      +	FLAG_DEF(REF_FORCE_CREATE_REFLOG),
     -+	{ NULL, 0 },
     ++	{ NULL, 0 }
      +};
      +
       static int cmd_delete_refs(struct ref_store *refs, const char **argv)
 3:  536005d65a2 = 3:  dcd4e9f5f26 test-ref-store: plug memory leak in cmd_delete_refs
 4:  466b4451015 = 4:  67d22211ac4 refs: update comment.
 5:  89d692a34b8 ! 5:  a8713dd59ee refs: introduce REF_SKIP_OID_VERIFICATION flag

@@ t/helper/test-ref-store.c: static int cmd_create_symref(struct ref_store *refs,
FLAG_DEF(REF_NO_DEREF),
FLAG_DEF(REF_FORCE_CREATE_REFLOG),
+ FLAG_DEF(REF_SKIP_OID_VERIFICATION),
- { NULL, 0 },
+ { NULL, 0 }
};

6: af9e94935bf ! 6: 577726dc9df refs: introduce REF_SKIP_REFNAME_VERIFICATION flag
@@ t/helper/test-ref-store.c: static struct flag_definition transaction_flags[] = {
FLAG_DEF(REF_FORCE_CREATE_REFLOG), FLAG_DEF(REF_SKIP_OID_VERIFICATION),
+ FLAG_DEF(REF_SKIP_REFNAME_VERIFICATION),
- { NULL, 0 },
+ { NULL, 0 }
};

 7:  d4f1d209468 = 7:  d85cfa3fee1 t1430: remove refs using test-tool
 8:  ca7f8aea3d9 = 8:  7597620ec83 t1430: create valid symrefs using test-helper
Signature · 1 line
gitgitgadget