Re: [PATCH v4 5/8] evolve: add the change-table structure

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

 




On 01/02/2019 03:09, sxenos@xxxxxxxxxx wrote:
> From: Stefan Xenos <sxenos@xxxxxxxxxx>
> 
> A change table stores a list of changes, and supports efficient lookup
> from a commit hash to the list of changes that reference that commit
> directly.
> 
> It can be used to look up content commits or metacommits at the head
> of a change, but does not support lookup of commits referenced as part
> of the commit history.
> 
> Signed-off-by: Stefan Xenos <sxenos@xxxxxxxxxx>
> ---
>  Makefile       |   1 +
>  change-table.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++
>  change-table.h | 127 +++++++++++++++++++++++++++++++++++
>  3 files changed, 304 insertions(+)
>  create mode 100644 change-table.c
>  create mode 100644 change-table.h
> 

[snip]

> diff --git a/change-table.h b/change-table.h
> new file mode 100644
> index 0000000000..023bca37d1
> --- /dev/null
> +++ b/change-table.h
> @@ -0,0 +1,127 @@
> +#ifndef CHANGE_TABLE_H
> +#define CHANGE_TABLE_H
> +
> +#include "oidmap.h"
> +
> +struct commit;
> +struct ref_filter;
> +
> +/*
> + * This struct holds a list of change refs. The first element is stored inline,
> + * to optimize for small lists.
> + */
> +struct change_list {
> +	/* Ref name for the first change in the list, or null if none.
> +	 *
> +	 * This field is private. Use for_each_change_in to read.
> +	 */
> +	const char* first_refname;
> +	/* List of additional change refs. Note that this is empty if the list
> +	 * contains 0 or 1 elements.
> +	 *
> +	 * This field is private. Use for_each_change_in to read.
> +	 */
> +	struct string_list additional_refnames;
> +};
> +
> +/*
> + * Holds information about the head of a single change.
> + */
> +struct change_head {
> +	/*
> +	 * The location pointed to by the head of the change. May be a commit or a
> +	 * metacommit.
> +	 */
> +	struct object_id head;
> +	/*
> +	 * The content commit for the latest commit in the change. Always points to a
> +	 * real commit, never a metacommit.
> +	 */
> +	struct object_id content;
> +	/*
> +	 * Abandoned: indicates that the content commit should be removed from the
> +	 * history.
> +	 *
> +	 * Hidden: indicates that the change is an inactive change from the
> +	 * hiddenmetas namespace. Such changes will be hidden from the user by
> +	 * default.
> +	 *
> +	 * Deleted: indicates that the change has been removed from the repository.
> +	 * That is the ref was deleted since the time this struct was created. Such
> +	 * entries should be ignored.
> +	 */
> +	int abandoned:1,
> +		hidden:1,
> +		remote:1,
> +		deleted:1;

This causes sparse to issue errors about 'dubious one-bit signed
bitfield' for each of these fields (and for each file which #includes
this header file).

The field type should be 'unsigned int', thus:

-- >8 --
diff --git a/change-table.h b/change-table.h
index 85bb19c3bf..1c385e076e 100644
--- a/change-table.h
+++ b/change-table.h
@@ -50,10 +50,10 @@ struct change_head {
         * That is the ref was deleted since the time this struct was created. Such
         * entries should be ignored.
         */
-       int abandoned:1,
-               hidden:1,
-               remote:1,
-               deleted:1;
+       unsigned int abandoned:1,
+                       hidden:1,
+                       remote:1,
+                       deleted:1;
 };
 
 /*
-- >8 --

[Note: this diff was against the v3 series].

ATB,
Ramsay Jones




[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