Re: [GSoC][PATCH 1/2] refs: setup ref consistency check infrastructure

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

 



Hello,

shejialuo <shejialuo@xxxxxxxxx> writes:

[snip]

> diff --git a/refs.h b/refs.h
> index 34568ee1fb..2799820c40 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -544,6 +544,11 @@ int refs_for_each_reflog(struct ref_store *refs, each_reflog_fn fn, void *cb_dat
>   */
>  int check_refname_format(const char *refname, int flags);
>
> +/*
> +  * Return 0 iff all refs in filesystem are consistent.
> +*/

s/iff/if

The indentation seems to be wrong here. Also since we want to check refs
and reflogs, it might be better to mention that the function checks the
reference database for consistency.

> +int refs_fsck(struct ref_store *refs);
> +
>  /*
>   * Apply the rules from check_refname_format, but mutate the result until it
>   * is acceptable, and place the result in "out".
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 5f3089d947..b6147c588b 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -3299,6 +3299,11 @@ static int files_init_db(struct ref_store *ref_store,
>  	return 0;
>  }
>
> +static int files_fsck(struct ref_store *ref_store)
> +{
> +	return 0;
> +}
> +
>  struct ref_storage_be refs_be_files = {
>  	.name = "files",
>  	.init = files_ref_store_create,
> @@ -3322,5 +3327,7 @@ struct ref_storage_be refs_be_files = {
>  	.reflog_exists = files_reflog_exists,
>  	.create_reflog = files_create_reflog,
>  	.delete_reflog = files_delete_reflog,
> -	.reflog_expire = files_reflog_expire
> +	.reflog_expire = files_reflog_expire,
> +
> +	.fsck = files_fsck,
>  };
> diff --git a/refs/packed-backend.c b/refs/packed-backend.c
> index a937e7dbfc..0617321634 100644
> --- a/refs/packed-backend.c
> +++ b/refs/packed-backend.c
> @@ -1704,6 +1704,11 @@ static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_s
>  	return empty_ref_iterator_begin();
>  }
>
> +static int packed_fsck(struct ref_store *ref_store)
> +{
> +	return 0;
> +}
> +
>  struct ref_storage_be refs_be_packed = {
>  	.name = "packed",
>  	.init = packed_ref_store_create,
> @@ -1728,4 +1733,6 @@ struct ref_storage_be refs_be_packed = {
>  	.create_reflog = NULL,
>  	.delete_reflog = NULL,
>  	.reflog_expire = NULL,
> +
> +	.fsck = packed_fsck,
>  };
> diff --git a/refs/refs-internal.h b/refs/refs-internal.h
> index 53a6c5d842..ef697bf3bf 100644
> --- a/refs/refs-internal.h
> +++ b/refs/refs-internal.h
> @@ -675,6 +675,8 @@ typedef int read_raw_ref_fn(struct ref_store *ref_store, const char *refname,
>  typedef int read_symbolic_ref_fn(struct ref_store *ref_store, const char *refname,
>  				 struct strbuf *referent);
>
> +typedef int fsck_fn(struct ref_store *ref_store);
> +
>  struct ref_storage_be {
>  	const char *name;
>  	ref_store_init_fn *init;
> @@ -700,6 +702,8 @@ struct ref_storage_be {
>  	create_reflog_fn *create_reflog;
>  	delete_reflog_fn *delete_reflog;
>  	reflog_expire_fn *reflog_expire;
> +
> +	fsck_fn *fsck;
>  };
>
>  extern struct ref_storage_be refs_be_files;
> diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
> index 1af86bbdec..f3f85cd2f0 100644
> --- a/refs/reftable-backend.c
> +++ b/refs/reftable-backend.c
> @@ -2167,6 +2167,11 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
>  	return ret;
>  }
>
> +static int reftable_be_fsck(struct ref_store *ref_store)
> +{
> +	return 0;
> +}
> +
>  struct ref_storage_be refs_be_reftable = {
>  	.name = "reftable",
>  	.init = reftable_be_init,
> @@ -2191,4 +2196,6 @@ struct ref_storage_be refs_be_reftable = {
>  	.create_reflog = reftable_be_create_reflog,
>  	.delete_reflog = reftable_be_delete_reflog,
>  	.reflog_expire = reftable_be_reflog_expire,
> +
> +	.fsck = reftable_be_fsck,
>  };
> --
> 2.45.1

Attachment: signature.asc
Description: PGP signature


[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