From f61fa52851dab624de065914d0cbc485c30d35f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Wed, 24 Jul 2024 07:34:58 +0200 Subject: [PATCH] fix: push tags correctly --- src/cli/command/push.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/cli/command/push.c b/src/cli/command/push.c index 4dece79..77103cf 100644 --- a/src/cli/command/push.c +++ b/src/cli/command/push.c @@ -36,19 +36,22 @@ int git_push(char *provider_name, char *branch_name, bool tags, bool verbose) { char output[1024]; char command[256]; - char push_args[50] = ""; - if (tags) { - strcat(push_args, " --tags"); - } else { - if (strcmp(provider_name, "sourcehut") == 0) { - strcat(push_args, " -o skip-ci"); - } else if (strcmp(provider_name, "gitlab") == 0) { - strcat(push_args, " -o ci.skip"); - } + char push_options[50] = ""; + if (strcmp(provider_name, "sourcehut") == 0) { + strcat(push_options, " -o skip-ci"); + } else if (strcmp(provider_name, "gitlab") == 0) { + strcat(push_options, " -o ci.skip"); } - snprintf(command, sizeof(command), "git push%s gimi-%s %s 2>&1", push_args, - provider_name, branch_name); + char branch_or_tags[256] = ""; + if (tags) { + strcat(branch_or_tags, "--tags"); + } else { + strcat(branch_or_tags, branch_name); + } + + snprintf(command, sizeof(command), "git push%s gimi-%s %s 2>&1", push_options, + provider_name, branch_or_tags); file_ptr = popen(command, "r"); if (file_ptr == NULL) {