On Thu, May 31, 2018 at 10:41 AM, Derrick Stolee <dsto...@microsoft.com> wrote:
> 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.

Makes sense.

>
> Signed-off-by: Derrick Stolee <dsto...@microsoft.com>
> ---
>  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

supported

> +        * generation skips as they are un-shallowed.
> +        */
> +       if (is_repository_shallow()) {
> +               warning("writing a commit-graph in a shallow repository is 
> not supported");

_() ?

Reply via email to