walker.c: use ref transaction for ref updates
commit2c2beb6abe836f1ef466869aa2e621d6c2673fdf
authorRonnie Sahlberg <sahlberg@google.com>
Thu, 17 Apr 2014 18:31:06 +0000 (17 11:31 -0700)
committerJonathan Nieder <jrnieder@gmail.com>
Tue, 2 Sep 2014 20:44:22 +0000 (2 13:44 -0700)
tree55d8c147f8a2fa8db357502bf91d1362b77e9004
parentc102e5726d06974b8fd362eab057a6d258aa2456
walker.c: use ref transaction for ref updates

Switch to using ref transactions in walker_fetch(). As part of the refactoring
to use ref transactions we also fix a potential memory leak where in the
original code if write_ref_sha1() would fail we would end up returning from
the function without free()ing the msg string.

Note that this function is only called when fetching from a remote HTTP
repository onto the local (most of the time single-user) repository which
likely means that the type of collisions that the previous locking would
protect against and cause the fetch to fail for are even more rare.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
walker.c