Re: [PATCH v5 0/6] Kill manual ref parsing code in worktree.c

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

 



Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> v5 chanes are mostly cosmetic:

Good changes.  Will re-queue.

Thanks.

>
> diff --git a/refs.c b/refs.c
> index 5d31fb6bcf..7972720256 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1530,11 +1530,7 @@ struct ref_store *get_main_ref_store(void)
>  	if (main_ref_store)
>  		return main_ref_store;
>  
> -	main_ref_store = ref_store_init(get_git_dir(),
> -					(REF_STORE_READ |
> -					 REF_STORE_WRITE |
> -					 REF_STORE_ODB |
> -					 REF_STORE_MAIN));
> +	main_ref_store = ref_store_init(get_git_dir(), REF_STORE_ALL_CAPS);
>  	return main_ref_store;
>  }
>  
> @@ -1597,9 +1593,6 @@ struct ref_store *get_submodule_ref_store(const char *submodule)
>  struct ref_store *get_worktree_ref_store(const struct worktree *wt)
>  {
>  	struct ref_store *refs;
> -	unsigned int refs_all_capabilities =
> -		REF_STORE_READ | REF_STORE_WRITE |
> -		REF_STORE_ODB | REF_STORE_MAIN;
>  	const char *id;
>  
>  	if (wt->is_current)
> @@ -1612,10 +1605,10 @@ struct ref_store *get_worktree_ref_store(const struct worktree *wt)
>  
>  	if (wt->id)
>  		refs = ref_store_init(git_common_path("worktrees/%s", wt->id),
> -				      refs_all_capabilities);
> +				      REF_STORE_ALL_CAPS);
>  	else
>  		refs = ref_store_init(get_git_common_dir(),
> -				      refs_all_capabilities);
> +				      REF_STORE_ALL_CAPS);
>  
>  	if (refs)
>  		register_ref_store_map(&worktree_ref_stores, "worktree",
> diff --git a/refs/refs-internal.h b/refs/refs-internal.h
> index 690498698e..b26f7e41ce 100644
> --- a/refs/refs-internal.h
> +++ b/refs/refs-internal.h
> @@ -467,6 +467,10 @@ struct ref_store;
>  #define REF_STORE_WRITE		(1 << 1) /* can perform update operations */
>  #define REF_STORE_ODB		(1 << 2) /* has access to object database */
>  #define REF_STORE_MAIN		(1 << 3)
> +#define REF_STORE_ALL_CAPS	(REF_STORE_READ | \
> +				 REF_STORE_WRITE | \
> +				 REF_STORE_ODB | \
> +				 REF_STORE_MAIN)
>  
>  /*
>   * Initialize the ref_store for the specified gitdir. These functions
>
> Nguyễn Thái Ngọc Duy (6):
>   environment.c: fix potential segfault by get_git_common_dir()
>   refs.c: make submodule ref store hashmap generic
>   refs: add REFS_STORE_ALL_CAPS
>   refs: introduce get_worktree_ref_store()
>   worktree.c: kill parse_ref() in favor of refs_resolve_ref_unsafe()
>   refs: kill set_worktree_head_symref()
>
>  branch.c                               |  15 ++---
>  environment.c                          |   2 +
>  refs.c                                 | 100 ++++++++++++++++++++------------
>  refs.h                                 |  12 +---
>  refs/files-backend.c                   |  44 --------------
>  refs/refs-internal.h                   |   4 ++
>  t/helper/test-ref-store.c              |  18 ++++++
>  t/t1407-worktree-ref-store.sh (new +x) |  52 +++++++++++++++++
>  worktree.c                             | 102 +++++++++------------------------
>  worktree.h                             |   2 +-
>  10 files changed, 177 insertions(+), 174 deletions(-)
>  create mode 100755 t/t1407-worktree-ref-store.sh



[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]