diff options
author | Taylor Blau <me@ttaylorr.com> | 2025-03-18 18:50:21 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-03-21 01:45:16 -0700 |
commit | 0baad1f3aee508d84bf74b9670f283f8c91e55dd (patch) | |
tree | cb48414cc881f331b4e2d90da6c0485c0c9b648c /refspec.c | |
parent | 3809633d0adb77b02ba8cfe87578134e6a30f54d (diff) |
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 <me@ttaylorr.com>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refspec.c')
-rw-r--r-- | refspec.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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) |