Re: [RFC PATCH 4/6] commit-graph: avoid writing when repo is shallow
Derrick Stolee writes: >>> 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. > > Do you mean that we should call destroy_commit_graph() if we detect a > shallow repository during write_commit_graph(), then I can make that > change. > No, I was just having trouble with reading "Instead of doing X, instead do Y".
Re: [RFC PATCH 4/6] commit-graph: avoid writing when repo is shallow
Derrick Stolee writes: > On 5/31/2018 10:30 PM, Junio C Hamano wrote: >> Derrick Stolee 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. > > Do you mean that we should call destroy_commit_graph() if we detect a > shallow repository during write_commit_graph(), then I can make that > change. I think Junio meant here the "instead" word, because you have it twice in the second sentence of quoted paragraph. -- Jakub Narębski
Re: [RFC PATCH 4/6] commit-graph: avoid writing when repo is shallow
On 5/31/2018 10:30 PM, Junio C Hamano wrote: Derrick Stolee 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. Do you mean that we should call destroy_commit_graph() if we detect a shallow repository during write_commit_graph(), then I can make that change. Signed-off-by: Derrick Stolee --- 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;
Re: [RFC PATCH 4/6] commit-graph: avoid writing when repo is shallow
Derrick Stolee 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 > --- > 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;
Re: [RFC PATCH 4/6] commit-graph: avoid writing when repo is shallow
On Thu, May 31, 2018 at 10:41 AM, Derrick Stolee 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 > --- > 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"); _() ?
[RFC PATCH 4/6] commit-graph: avoid writing when repo is shallow
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. Signed-off-by: Derrick Stolee --- 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; -- 2.16.2.338.gcfe06ae955