From: Tay Ray Chuan <rctay89@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] don't append 'opaquelocktoken:' in PUT and MOVE
Date: Sat, 07 Feb 2009 23:12:57 +0800 [thread overview]
Message-ID: <498DA4F9.20104@gmail.com> (raw)
In 753bc91 ("Remove the requirement opaquelocktoken uri scheme"), the
lock token is guaranteed to be prefixed with the string
'opaquelocktoken:', which propagated down to file path creation
operations in the remote repository, namely, in start_put (and
consequently start_move).
These file operations may not be successful, due to the colon ':'
character in the file path (specifically, in Windows).
This patch ensures that the lock token sans 'opaquelocktoken:' is used
instead in start_put.
Note on tests: In the second grep, we check that Apache returns status
20* (ie. the request was successful), but in the first we do not do
so, since file creation by PUSH/MOVE is not guaranteed to succeed (see
above).
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
http-push.c | 2 +-
t/t5540-http-push.sh | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/http-push.c b/http-push.c
index eefd64c..10df94a 100644
--- a/http-push.c
+++ b/http-push.c
@@ -558,7 +558,7 @@ static void start_put(struct transfer_request *request)
append_remote_object_url(&buf, remote->url, hex, 0);
strbuf_addstr(&buf, "_");
- strbuf_addstr(&buf, request->lock->token);
+ strbuf_addstr(&buf, request->lock->token + 16);
request->url = strbuf_detach(&buf, NULL);
slot = get_active_slot();
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index c236b5e..544dea8 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -94,6 +94,15 @@ test_expect_success 'MKCOL sends directory names with trailing slashes' '
'
+test_expect_success 'PUT and MOVE sends object to URLs without "opaquelocktoken:"' '
+
+ !(grep -P "\"(?:PUT|MOVE) .+objects/[\da-z]{2}/[\da-z]{38}_opaquelocktoken:[\da-z\-]{36} HTTP/[0-9.]+\"" \
+ < "$HTTPD_ROOT_PATH"/access.log) &&
+ grep -P "\"(?:PUT|MOVE) .+objects/[\da-z]{2}/[\da-z]{38}_[\da-z\-]{36} HTTP/[0-9.]+\" 20\d" \
+ < "$HTTPD_ROOT_PATH"/access.log
+
+'
+
stop_httpd
test_done
--
1.6.1.2.278.g9a9e.dirty
next reply other threads:[~2009-02-07 15:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-07 15:12 Tay Ray Chuan [this message]
2009-02-07 17:03 ` [PATCH] don't append 'opaquelocktoken:' in PUT and MOVE Johannes Schindelin
2009-02-07 17:52 ` Tay Ray Chuan
2009-02-07 18:04 ` Johannes Schindelin
2009-02-07 18:38 ` Tay Ray Chuan
2009-02-07 18:57 ` Johannes Schindelin
2009-02-07 19:00 ` Tay Ray Chuan
2009-02-07 19:43 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=498DA4F9.20104@gmail.com \
--to=rctay89@gmail.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).