Re: [RFC PATCH 4/6] commit-graph: avoid writing when repo is shallow

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

 



Derrick Stolee <dstolee@xxxxxxxxxxxxx> writes:

> Shallow clones do not interact well with the commit-graph feature for
> several reasons. Instead of doing the hard thing to fix those
> interactions, instead prevent reading or writing a commit-graph file for
> shallow repositories.

The latter instead would want to vanish, I would guess.

>
> Signed-off-by: Derrick Stolee <dstolee@xxxxxxxxxxxxx>
> ---
>  commit-graph.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/commit-graph.c b/commit-graph.c
> index 95af4ed519..80e377b90f 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -208,6 +208,9 @@ static void prepare_commit_graph(void)
>  		return;
>  	prepare_commit_graph_run_once = 1;
>  
> +	if (is_repository_shallow())
> +		return;
> +
>  	obj_dir = get_object_directory();
>  	prepare_commit_graph_one(obj_dir);
>  	prepare_alt_odb();
> @@ -711,6 +714,15 @@ void write_commit_graph(const char *obj_dir,
>  	int num_extra_edges;
>  	struct commit_list *parent;
>  
> +	/*
> +	 * Shallow clones are not supproted, as they create bad
> +	 * generation skips as they are un-shallowed.
> +	 */
> +	if (is_repository_shallow()) {
> +		warning("writing a commit-graph in a shallow repository is not supported");
> +		return;
> +	}
> +
>  	oids.nr = 0;
>  	oids.alloc = approximate_object_count() / 4;



[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