git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Tan <jonathantanmy@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC 03/14] upload-pack: test negotiation with changing repo
Date: Thu, 26 Jan 2017 16:44:14 -0800	[thread overview]
Message-ID: <0c727063-0583-f713-68fb-bd284be696b2@google.com> (raw)
In-Reply-To: <xmqq8tpx30zq.fsf@gitster.mtv.corp.google.com>

On 01/26/2017 02:33 PM, Junio C Hamano wrote:
> Jonathan Tan <jonathantanmy@google.com> writes:
>
>> diff --git a/t/lib-httpd/one-time-sed.sh b/t/lib-httpd/one-time-sed.sh
>> new file mode 100644
>> index 000000000..060ec0300
>> --- /dev/null
>> +++ b/t/lib-httpd/one-time-sed.sh
>> @@ -0,0 +1,8 @@
>> +#!/bin/sh
>> +
>> +if [ -e one-time-sed ]; then
>> +	"$GIT_EXEC_PATH/git-http-backend" | sed "$(cat one-time-sed)"
>> +	rm one-time-sed
>> +else
>> +	"$GIT_EXEC_PATH/git-http-backend"
>> +fi
>
> CodingGuidelines?

Thanks - done locally and will send out in the next reroll.

>> +inconsistency() {
>> +	# Simulate that the server initially reports $2 as the ref
>> +	# corresponding to $1, and after that, $1 as the ref corresponding to
>> +	# $1. This corresponds to the real-life situation where the server's
>> +	# repository appears to change during negotiation, for example, when
>> +	# different servers in a load-balancing arrangement serve (stateless)
>> +	# RPCs during a single negotiation.
>> +	printf "s/%s/%s/" \
>> +	       $(git -C "$REPO" rev-parse $1 | tr -d "\n") \
>> +	       $(git -C "$REPO" rev-parse $2 | tr -d "\n") \
>> +	       >"$HTTPD_ROOT_PATH/one-time-sed"
>
> I'd prefer for the printf'd result to have a final LF (i.e. not
> leaving the resulting one-time-sed with a final incomplete line).
> Also, do you really need the pipe to tr-d?  Doesn't the result of
> $(command substitution) omit the final LF anyway?
>
>     $ printf '1 %s 2 %s 3\n' "$(echo foo)" "$(echo bar)"; echo OK
>     1 foo 2 bar 3
>     OK

Done.

>> diff --git a/upload-pack.c b/upload-pack.c
>> index b88ed8e26..0678c53d6 100644
>> --- a/upload-pack.c
>> +++ b/upload-pack.c
>> @@ -862,9 +862,13 @@ static void receive_needs(struct string_list *wanted_ns_refs)
>>  		} else if (skip_prefix(line, "want ", &arg) &&
>>  			   !get_sha1_hex(arg, sha1_buf)) {
>>  			o = parse_object(sha1_buf);
>> -			if (!o)
>> +			if (!o) {
>> +				packet_write_fmt(1,
>> +						 "ERR upload-pack: not our ref %s",
>> +						 sha1_to_hex(sha1_buf));
>>  				die("git upload-pack: not our ref %s",
>>  				    sha1_to_hex(sha1_buf));
>> +			}
>
> This somehow looks like a good thing to do even in production.  Am I
> mistaken?

Yes, that's true. If this patch set stalls (for whatever reason), I'll 
spin this off into an independent patch.

  reply	other threads:[~2017-01-27  0:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-25 22:02 [RFC 00/14] Allow fetch-pack to send ref names (globs allowed) Jonathan Tan
2017-01-25 22:02 ` [RFC 01/14] upload-pack: move parsing of "want" line Jonathan Tan
2017-01-25 22:02 ` [RFC 02/14] upload-pack: allow ref name and glob requests Jonathan Tan
2017-01-26 22:23   ` Junio C Hamano
2017-01-27  0:35     ` Jonathan Tan
2017-01-27  1:54       ` Junio C Hamano
2017-01-25 22:02 ` [RFC 03/14] upload-pack: test negotiation with changing repo Jonathan Tan
2017-01-26 22:33   ` Junio C Hamano
2017-01-27  0:44     ` Jonathan Tan [this message]
2017-02-22 23:36       ` Junio C Hamano
2017-02-23 18:43         ` [PATCH] upload-pack: report "not our ref" to client Jonathan Tan
2017-02-23 20:14           ` Junio C Hamano
2017-01-25 22:02 ` [RFC 04/14] fetch: refactor the population of hashes Jonathan Tan
2017-01-25 22:02 ` [RFC 05/14] fetch: refactor fetch_refs into two functions Jonathan Tan
2017-01-25 22:02 ` [RFC 06/14] fetch: refactor to make function args narrower Jonathan Tan
2017-01-25 22:03 ` [RFC 07/14] fetch-pack: put shallow info in out param Jonathan Tan
2017-01-25 22:03 ` [RFC 08/14] fetch-pack: check returned refs for matches Jonathan Tan
2017-01-25 22:03 ` [RFC 09/14] transport: put ref oid in out param Jonathan Tan
2017-01-25 22:03 ` [RFC 10/14] fetch-pack: support partial names and globs Jonathan Tan
2017-01-25 22:03 ` [RFC 11/14] fetch-pack: support want-ref Jonathan Tan
2017-01-25 22:03 ` [RFC 12/14] fetch-pack: do not printf after closing stdout Jonathan Tan
2017-01-26  0:50   ` Stefan Beller
2017-01-26 18:18     ` Jonathan Tan
2017-01-25 22:03 ` [RFC 13/14] fetch: send want-ref and receive fetched refs Jonathan Tan
2017-01-25 22:03 ` [RFC 14/14] DONT USE advertise_ref_in_want=1 Jonathan Tan
2017-01-26 22:15 ` [RFC 00/14] Allow fetch-pack to send ref names (globs allowed) Stefan Beller
2017-01-26 23:00 ` Jeff King
2017-01-27  0:26   ` Jonathan Tan
2017-02-07 23:53 ` Jonathan Tan
2017-02-09  0:26   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0c727063-0583-f713-68fb-bd284be696b2@google.com \
    --to=jonathantanmy@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).