Merge branch 'jk/remote-helper-object-format-option-fix'
The implementation and documentation of "object-format" option exchange between the Git itself and its remote helpers did not quite match, which has been corrected. * jk/remote-helper-object-format-option-fix: transport-helper: send "true" value for object-format option transport-helper: drop "object-format <algo>" option transport-helper: use write helpers more consistentlymaint
commit
e139bb1006
|
@ -542,13 +542,10 @@ set by Git if the remote helper has the 'option' capability.
|
||||||
transaction. If successful, all refs will be updated, or none will. If the
|
transaction. If successful, all refs will be updated, or none will. If the
|
||||||
remote side does not support this capability, the push will fail.
|
remote side does not support this capability, the push will fail.
|
||||||
|
|
||||||
'option object-format' {'true'|algorithm}::
|
'option object-format true'::
|
||||||
If 'true', indicate that the caller wants hash algorithm information
|
Indicate that the caller wants hash algorithm information
|
||||||
to be passed back from the remote. This mode is used when fetching
|
to be passed back from the remote. This mode is used when fetching
|
||||||
refs.
|
refs.
|
||||||
+
|
|
||||||
If set to an algorithm, indicate that the caller wants to interact with
|
|
||||||
the remote side using that algorithm.
|
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -211,14 +211,9 @@ static int set_option(const char *name, const char *value)
|
||||||
options.filter = xstrdup(value);
|
options.filter = xstrdup(value);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(name, "object-format")) {
|
} else if (!strcmp(name, "object-format")) {
|
||||||
int algo;
|
|
||||||
options.object_format = 1;
|
options.object_format = 1;
|
||||||
if (strcmp(value, "true")) {
|
if (strcmp(value, "true"))
|
||||||
algo = hash_algo_by_name(value);
|
die(_("unknown value for object-format: %s"), value);
|
||||||
if (algo == GIT_HASH_UNKNOWN)
|
|
||||||
die("unknown object format '%s'", value);
|
|
||||||
options.hash_algo = &hash_algos[algo];
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return 1 /* unsupported */;
|
return 1 /* unsupported */;
|
||||||
|
|
|
@ -30,6 +30,7 @@ GIT_DIR="$url/.git"
|
||||||
export GIT_DIR
|
export GIT_DIR
|
||||||
|
|
||||||
force=
|
force=
|
||||||
|
object_format=
|
||||||
|
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ do
|
||||||
echo
|
echo
|
||||||
;;
|
;;
|
||||||
list)
|
list)
|
||||||
|
test -n "$object_format" &&
|
||||||
echo ":object-format $(git rev-parse --show-object-format=storage)"
|
echo ":object-format $(git rev-parse --show-object-format=storage)"
|
||||||
git for-each-ref --format='? %(refname)' 'refs/heads/' 'refs/tags/'
|
git for-each-ref --format='? %(refname)' 'refs/heads/' 'refs/tags/'
|
||||||
head=$(git symbolic-ref HEAD)
|
head=$(git symbolic-ref HEAD)
|
||||||
|
|
|
@ -1210,16 +1210,13 @@ static struct ref *get_refs_list_using_list(struct transport *transport,
|
||||||
data->get_refs_list_called = 1;
|
data->get_refs_list_called = 1;
|
||||||
helper = get_helper(transport);
|
helper = get_helper(transport);
|
||||||
|
|
||||||
if (data->object_format) {
|
if (data->object_format)
|
||||||
write_str_in_full(helper->in, "option object-format\n");
|
set_helper_option(transport, "object-format", "true");
|
||||||
if (recvline(data, &buf) || strcmp(buf.buf, "ok"))
|
|
||||||
exit(128);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data->push && for_push)
|
if (data->push && for_push)
|
||||||
write_str_in_full(helper->in, "list for-push\n");
|
write_constant(helper->in, "list for-push\n");
|
||||||
else
|
else
|
||||||
write_str_in_full(helper->in, "list\n");
|
write_constant(helper->in, "list\n");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
char *eov, *eon;
|
char *eov, *eon;
|
||||||
|
|
Loading…
Reference in New Issue