[PATCH v8 0/9] add more ref consistency checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All:

This changes enhances the following things:

1. [PATCH v8 3/9]: initialize fd = -1 for two purposes:
   1. We could use unified `goto cleanup` where we have one only
   control.
   2. We should not close the fd when we cannot open the file.

Hope that this version would be final. Thank for the effort of every
reviewer.

Thanks,
Jialuo

---

This series mainly does the following things:

1. Fix subshell issues
2. Add ref checks for packed-backend.
   1. Check whether the filetype of "packed-refs" is correct.
   2. Check whether the syntax of "packed-refs" is correct by using the
      rules from "packed-backend.c::create_snapshot" and
      "packed-backend.c::next_record".
   3. Check whether the pointed object exists and whether the
      "packed-refs" file is sorted.
3. Call "git refs verify" for "git-fsck(1)".

shejialuo (9):
  t0602: use subshell to ensure working directory unchanged
  builtin/refs: get worktrees without reading head information
  packed-backend: check whether the "packed-refs" is regular file
  packed-backend: check if header starts with "# pack-refs with: "
  packed-backend: add "packed-refs" header consistency check
  packed-backend: check whether the refname contains NUL characters
  packed-backend: add "packed-refs" entry consistency check
  packed-backend: check whether the "packed-refs" is sorted
  builtin/fsck: add `git refs verify` child process

 Documentation/fsck-msgids.adoc |   14 +
 Documentation/git-fsck.adoc    |    7 +-
 builtin/fsck.c                 |   33 +-
 builtin/refs.c                 |    2 +-
 fsck.h                         |    4 +
 refs/packed-backend.c          |  363 +++++++++-
 t/t0602-reffiles-fsck.sh       | 1209 +++++++++++++++++++-------------
 worktree.c                     |    5 +
 worktree.h                     |    8 +
 9 files changed, 1162 insertions(+), 483 deletions(-)

Range-diff against v7:
 1:  b3952d80a2 =  1:  b3952d80a2 t0602: use subshell to ensure working directory unchanged
 2:  fa5ce20bb7 =  2:  fa5ce20bb7 builtin/refs: get worktrees without reading head information
 3:  861583f417 !  3:  b3686a9695 packed-backend: check whether the "packed-refs" is regular file
    @@ refs/packed-backend.c: static struct ref_iterator *packed_reflog_iterator_begin(
     +							REF_STORE_READ, "fsck");
     +	struct stat st;
     +	int ret = 0;
    -+	int fd;
    ++	int fd = -1;
      
      	if (!is_main_worktree(wt))
    - 		return 0;
    +-		return 0;
    ++		goto cleanup;
      
     -	return 0;
     +	if (o->verbose)
 4:  5f54cb05c3 =  4:  2638d5043f packed-backend: check if header starts with "# pack-refs with: "
 5:  7d7dc899ad !  5:  13e34de350 packed-backend: add "packed-refs" header consistency check
    @@ refs/packed-backend.c: static struct ref_iterator *packed_reflog_iterator_begin(
     +	struct strbuf packed_ref_content = STRBUF_INIT;
      	struct stat st;
      	int ret = 0;
    - 	int fd;
    + 	int fd = -1;
     @@ refs/packed-backend.c: static int packed_fsck(struct ref_store *ref_store,
      		goto cleanup;
      	}
 6:  571479d3e7 =  6:  0632a1d5e2 packed-backend: check whether the refname contains NUL characters
 7:  e498a57286 =  7:  4618da3199 packed-backend: add "packed-refs" entry consistency check
 8:  3638cb118d !  8:  355e43d251 packed-backend: check whether the "packed-refs" is sorted
    @@ refs/packed-backend.c: static int packed_fsck(struct ref_store *ref_store,
     +	unsigned int sorted = 0;
      	struct stat st;
      	int ret = 0;
    - 	int fd;
    + 	int fd = -1;
     @@ refs/packed-backend.c: static int packed_fsck(struct ref_store *ref_store,
      		goto cleanup;
      	}
 9:  5d87e76d28 =  9:  57dac06151 builtin/fsck: add `git refs verify` child process
-- 
2.48.1





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux