diff mbox series

[1/3] commit-graph: remove a duplicate assignment

Message ID 20190925020158.751492-2-alexhenrie24@gmail.com (mailing list archive)
State New, archived
Headers show
Series scan-build fixes | expand

Commit Message

Alex Henrie Sept. 25, 2019, 2:01 a.m. UTC
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
 commit-graph.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Derrick Stolee Sept. 26, 2019, 1:02 p.m. UTC | #1
On 9/24/2019 10:01 PM, Alex Henrie wrote:
> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
> ---
>  commit-graph.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/commit-graph.c b/commit-graph.c
> index 9b02d2c426..659f4bb4f4 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -1534,7 +1534,6 @@ static void split_graph_merge_strategy(struct write_commit_graph_context *ctx)
>  		size_mult = ctx->split_opts->size_multiple;
>  	}
>  
> -	g = ctx->r->objects->commit_graph;
>  	ctx->num_commit_graphs_after = ctx->num_commit_graphs_before + 1;
>  
>  	while (g && (g->num_commits <= size_mult * num_commits ||

Could we instead remove the assignment during the declaration? It is
easier to know the while loop will work if the assignment is closer
to the loop.

Thanks,
-Stolee
Alex Henrie Sept. 26, 2019, 6:05 p.m. UTC | #2
On Thu, Sep 26, 2019 at 7:02 AM Derrick Stolee <stolee@gmail.com> wrote:
>
> Could we instead remove the assignment during the declaration? It is
> easier to know the while loop will work if the assignment is closer
> to the loop.

Sure, that's fine. I'll send a v2 with that change.

-Alex
diff mbox series

Patch

diff --git a/commit-graph.c b/commit-graph.c
index 9b02d2c426..659f4bb4f4 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1534,7 +1534,6 @@  static void split_graph_merge_strategy(struct write_commit_graph_context *ctx)
 		size_mult = ctx->split_opts->size_multiple;
 	}
 
-	g = ctx->r->objects->commit_graph;
 	ctx->num_commit_graphs_after = ctx->num_commit_graphs_before + 1;
 
 	while (g && (g->num_commits <= size_mult * num_commits ||