]> git.ipfire.org Git - thirdparty/git.git/commit - http-push.c
http-push: fix webdav lock leak.
authorGrégoire Barbier <gb@gbarbier.org>
Sat, 19 Jan 2008 15:22:47 +0000 (16:22 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 20 Jan 2008 23:17:58 +0000 (15:17 -0800)
commit9116de5957423d553fce5857a835284a0527d037
tree6fc04eac5a6a0dc17bc4e024864a8663768f7428
parent0a61779994aa3de41d57bb85bd88a2f56c7ba7d8
http-push: fix webdav lock leak.

Releasing webdav lock even if push fails because of bad (or no)
reference on command line.

To reproduce the issue that this patch fixes, prepare a test repository
availlable over http+webdav, say at http://myhost/myrepo.git/

Then:

  $ git clone http://myhost/myrepo.git/
  $ cd myrepo
  $ git push http
  Fetching remote heads...
    refs/
    refs/heads/
    refs/tags/
  No refs in common and none specified; doing nothing.
  $ git push http
  Fetching remote heads...
    refs/
    refs/heads/
    refs/tags/
  No refs in common and none specified; doing nothing.
  $

Finally, you look at the web server logs, and will find one LOCK query
and no UNLOCK query, of course the second one will be in 423 return
code instead of 200:

1.2.3.4 - gb [19/Jan/2008:14:24:56 +0100] "LOCK /myrepo.git/info/refs HTTP/1.1" 200 465
(...)
1.2.3.4 - gb [19/Jan/2008:14:25:10 +0100] "LOCK /myrepo.git/info/refs HTTP/1.1" 423 363

With this patch, there would have be two UNLOCKs in addition of the LOCKs

From the user's point of view:

- If you realize that you should have typed e.g. "git push http
  master" instead of "git push http", you will have to wait for 10
  minutes for the lock to expire by its own.

- Furthermore, if somebody else is dumb enough to type "git push http"
  while you need to push "master" branch, then you'll need too to wait
  for 10 minutes too.

Signed-off-by: Gr\e.A\eNigoire Barbier <gb@gbarbier.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c