зеркало из https://github.com/microsoft/git.git
transport-helper: add support to delete branches
For remote-helpers that use 'export' to push. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
60ed26438c
Коммит
f3d0376356
|
@ -102,6 +102,14 @@ test_expect_success 'push new branch with HEAD:new refspec' '
|
|||
compare_refs local HEAD server refs/heads/new-refspec-2
|
||||
'
|
||||
|
||||
test_expect_success 'push delete branch' '
|
||||
(cd local &&
|
||||
git push origin :new-name
|
||||
) &&
|
||||
test_must_fail git --git-dir="server/.git" \
|
||||
rev-parse --verify refs/heads/new-name
|
||||
'
|
||||
|
||||
test_expect_success 'forced push' '
|
||||
(cd local &&
|
||||
git checkout -b force-test &&
|
||||
|
|
|
@ -882,9 +882,6 @@ static int push_refs_with_export(struct transport *transport,
|
|||
char *private;
|
||||
unsigned char sha1[20];
|
||||
|
||||
if (ref->deletion)
|
||||
die("remote-helpers do not support ref deletion");
|
||||
|
||||
private = apply_refspecs(data->refspecs, data->refspec_nr, ref->name);
|
||||
if (private && !get_sha1(private, sha1)) {
|
||||
strbuf_addf(&buf, "^%s", private);
|
||||
|
@ -896,6 +893,8 @@ static int push_refs_with_export(struct transport *transport,
|
|||
if (ref->peer_ref) {
|
||||
if (strcmp(ref->name, ref->peer_ref->name)) {
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
|
||||
if (!ref->deletion) {
|
||||
const char *name;
|
||||
int flag;
|
||||
|
||||
|
@ -905,11 +904,14 @@ static int push_refs_with_export(struct transport *transport,
|
|||
name = ref->peer_ref->name;
|
||||
|
||||
strbuf_addf(&buf, "%s:%s", name, ref->name);
|
||||
} else
|
||||
strbuf_addf(&buf, ":%s", ref->name);
|
||||
|
||||
string_list_append(&revlist_args, "--refspec");
|
||||
string_list_append(&revlist_args, buf.buf);
|
||||
strbuf_release(&buf);
|
||||
}
|
||||
if (!ref->deletion)
|
||||
string_list_append(&revlist_args, ref->peer_ref->name);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче