Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
http-push: store refspecs in a struct refspec
author
Brandon Williams
<bmwill@google.com>
Wed, 16 May 2018 22:58:20 +0000
(15:58 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 17 May 2018 21:19:44 +0000
(06:19 +0900)
Convert http-push.c to store refspecs in a 'struct refspec' instead of
in an array of 'const char *'.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
7a78a82
)
diff --git
a/http-push.c
b/http-push.c
index f308ce0195a5f0991996a3daad9b13809e8f7895..a724ef03f9caa292f610a5e93d9ed7331fb53b96 100644
(file)
--- a/
http-push.c
+++ b/
http-push.c
@@
-1692,8
+1692,7
@@
int cmd_main(int argc, const char **argv)
{
struct transfer_request *request;
struct transfer_request *next_request;
{
struct transfer_request *request;
struct transfer_request *next_request;
- int nr_refspec = 0;
- const char **refspec = NULL;
+ struct refspec rs = REFSPEC_INIT_PUSH;
struct remote_lock *ref_lock = NULL;
struct remote_lock *info_ref_lock = NULL;
struct rev_info revs;
struct remote_lock *ref_lock = NULL;
struct remote_lock *info_ref_lock = NULL;
struct rev_info revs;
@@
-1756,8
+1755,7
@@
int cmd_main(int argc, const char **argv)
}
continue;
}
}
continue;
}
- refspec = argv;
- nr_refspec = argc - i;
+ refspec_appendn(&rs, argv, argc - i);
break;
}
break;
}
@@
-1768,7
+1766,7
@@
int cmd_main(int argc, const char **argv)
if (!repo->url)
usage(http_push_usage);
if (!repo->url)
usage(http_push_usage);
- if (delete_branch &&
nr_refspec
!= 1)
+ if (delete_branch &&
rs.nr
!= 1)
die("You must specify only one branch name when deleting a remote branch");
setup_git_directory();
die("You must specify only one branch name when deleting a remote branch");
setup_git_directory();
@@
-1814,18
+1812,19
@@
int cmd_main(int argc, const char **argv)
/* Remove a remote branch if -d or -D was specified */
if (delete_branch) {
/* Remove a remote branch if -d or -D was specified */
if (delete_branch) {
- if (delete_remote_branch(refspec[0], force_delete) == -1) {
+ const char *branch = rs.items[i].src;
+ if (delete_remote_branch(branch, force_delete) == -1) {
fprintf(stderr, "Unable to delete remote branch %s\n",
fprintf(stderr, "Unable to delete remote branch %s\n",
-
refspec[0]
);
+
branch
);
if (helper_status)
if (helper_status)
- printf("error %s cannot remove\n",
refspec[0]
);
+ printf("error %s cannot remove\n",
branch
);
}
goto cleanup;
}
/* match them up */
if (match_push_refs(local_refs, &remote_refs,
}
goto cleanup;
}
/* match them up */
if (match_push_refs(local_refs, &remote_refs,
-
nr_refspec, (const char **) refspec
, push_all)) {
+
rs.raw_nr, rs.raw
, push_all)) {
rc = -1;
goto cleanup;
}
rc = -1;
goto cleanup;
}