From 0baad1f3aee508d84bf74b9670f283f8c91e55dd Mon Sep 17 00:00:00 2001 From: Taylor Blau Date: Tue, 18 Mar 2025 18:50:21 -0400 Subject: refspec: replace `refspec_init()` with fetch/push variants To avoid having a Boolean argument in the refspec_init() function, replace it with two variants: - `refspec_init_fetch()` - `refspec_init_push()` to codify the meaning of that Boolean into the function's name itself. Signed-off-by: Taylor Blau Acked-by: Elijah Newren Signed-off-by: Junio C Hamano --- refspec.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'refspec.c') diff --git a/refspec.c b/refspec.c index db5a1c34a5..f6be0c54d7 100644 --- a/refspec.c +++ b/refspec.c @@ -178,10 +178,16 @@ void refspec_item_clear(struct refspec_item *item) item->exact_sha1 = 0; } -void refspec_init(struct refspec *rs, int fetch) +void refspec_init_fetch(struct refspec *rs) { - memset(rs, 0, sizeof(*rs)); - rs->fetch = fetch; + struct refspec blank = REFSPEC_INIT_FETCH; + memcpy(rs, &blank, sizeof(*rs)); +} + +void refspec_init_push(struct refspec *rs) +{ + struct refspec blank = REFSPEC_INIT_PUSH; + memcpy(rs, &blank, sizeof(*rs)); } void refspec_append(struct refspec *rs, const char *refspec) -- cgit v1.3