Skip to content

Commit

Permalink
Save the available branch for later reading
Browse files Browse the repository at this point in the history
Signed-off-by: Vector Li <[email protected]>
  • Loading branch information
Vector Li committed Feb 21, 2023
1 parent 9580f65 commit c356d87
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/fetch_git.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "fetch.h"
#include "fetch_git.h"

static const gchar *g_git_branches[] = {GIT_BRANCHES};
static const gchar *git_branches[] = {GIT_BRANCHES};

static gint
packet_length(const gchar *linelen)
Expand Down Expand Up @@ -234,13 +234,17 @@ myopen(FetchData *fetch_data, GError **error)
}

// traverse git branches one by one
for (gint i = 0; i < sizeof (g_git_branches) / sizeof (const gchar *); i++) {
gchar *branch = (gchar *)(g_git_branches[i]);
write_succeeded = FALSE;
for (gint i = 0; i < sizeof (git_branches) / sizeof (const gchar *); i++) {
gchar *branch = (gchar *)(git_branches[i]);
write_succeeded = packet_write(fetch_data->ostream, &tmp_error, "argument %s:%s\0",
fetch_data->url->query == NULL ? branch: fetch_data->url->query,
fetch_data->url->fragment == NULL ? "" : fetch_data->url->fragment + fragment_offset);
if (write_succeeded)
if (write_succeeded) {
if (fetch_data->url->query == NULL)
fetch_data->url->query = branch;
break;
}
}
if (!write_succeeded) {
g_propagate_prefixed_error(error, tmp_error,
Expand Down

0 comments on commit c356d87

Please sign in to comment.