Merge branch 'mh/deref-symref-over-helper-transport' into maint
"git fetch" over a remote-helper that cannot respond to "list" command could not fetch from a symbolic reference e.g. HEAD. * mh/deref-symref-over-helper-transport: transport-helper: do not request symbolic refs to remote helpersmaint
commit
6db0497e1a
|
|
@ -1,7 +1,13 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2012 Felipe Contreras
|
# Copyright (c) 2012 Felipe Contreras
|
||||||
|
|
||||||
alias=$1
|
# The first argument can be a url when the fetch/push command was a url
|
||||||
|
# instead of a configured remote. In this case, use a generic alias.
|
||||||
|
if test "$1" = "testgit::$2"; then
|
||||||
|
alias=_
|
||||||
|
else
|
||||||
|
alias=$1
|
||||||
|
fi
|
||||||
url=$2
|
url=$2
|
||||||
|
|
||||||
dir="$GIT_DIR/testgit/$alias"
|
dir="$GIT_DIR/testgit/$alias"
|
||||||
|
|
|
||||||
|
|
@ -281,4 +281,28 @@ test_expect_success 'push messages' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'fetch HEAD' '
|
||||||
|
(cd server &&
|
||||||
|
git checkout master &&
|
||||||
|
echo more >>file &&
|
||||||
|
git commit -a -m more
|
||||||
|
) &&
|
||||||
|
(cd local &&
|
||||||
|
git fetch origin HEAD
|
||||||
|
) &&
|
||||||
|
compare_refs server HEAD local FETCH_HEAD
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'fetch url' '
|
||||||
|
(cd server &&
|
||||||
|
git checkout master &&
|
||||||
|
echo more >>file &&
|
||||||
|
git commit -a -m more
|
||||||
|
) &&
|
||||||
|
(cd local &&
|
||||||
|
git fetch "testgit::${PWD}/../server"
|
||||||
|
) &&
|
||||||
|
compare_refs server HEAD local FETCH_HEAD
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,8 @@ static int fetch_with_fetch(struct transport *transport,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
strbuf_addf(&buf, "fetch %s %s\n",
|
strbuf_addf(&buf, "fetch %s %s\n",
|
||||||
sha1_to_hex(posn->old_sha1), posn->name);
|
sha1_to_hex(posn->old_sha1),
|
||||||
|
posn->symref ? posn->symref : posn->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_addch(&buf, '\n');
|
strbuf_addch(&buf, '\n');
|
||||||
|
|
@ -453,7 +454,8 @@ static int fetch_with_import(struct transport *transport,
|
||||||
if (posn->status & REF_STATUS_UPTODATE)
|
if (posn->status & REF_STATUS_UPTODATE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
strbuf_addf(&buf, "import %s\n", posn->name);
|
strbuf_addf(&buf, "import %s\n",
|
||||||
|
posn->symref ? posn->symref : posn->name);
|
||||||
sendline(data, &buf);
|
sendline(data, &buf);
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
}
|
}
|
||||||
|
|
@ -486,14 +488,15 @@ static int fetch_with_import(struct transport *transport,
|
||||||
* fast-forward or this is a forced update.
|
* fast-forward or this is a forced update.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < nr_heads; i++) {
|
for (i = 0; i < nr_heads; i++) {
|
||||||
char *private;
|
char *private, *name;
|
||||||
posn = to_fetch[i];
|
posn = to_fetch[i];
|
||||||
if (posn->status & REF_STATUS_UPTODATE)
|
if (posn->status & REF_STATUS_UPTODATE)
|
||||||
continue;
|
continue;
|
||||||
|
name = posn->symref ? posn->symref : posn->name;
|
||||||
if (data->refspecs)
|
if (data->refspecs)
|
||||||
private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name);
|
private = apply_refspecs(data->refspecs, data->refspec_nr, name);
|
||||||
else
|
else
|
||||||
private = xstrdup(posn->name);
|
private = xstrdup(name);
|
||||||
if (private) {
|
if (private) {
|
||||||
read_ref(private, posn->old_sha1);
|
read_ref(private, posn->old_sha1);
|
||||||
free(private);
|
free(private);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue