summaryrefslogtreecommitdiff
path: root/update-ref.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2005-11-14 23:10:59 +0100
committerJunio C Hamano <junkio@cox.net>2005-11-14 17:15:32 -0800
commit08db81a9f1e4072790f0257f5398e8408e3d6816 (patch)
tree918b707153ab79e498576de81fb9b89bc07ac7ac /update-ref.c
parent7acab8f16785151f9b6d9bbd8a9b0a8b76b26fba (diff)
downloadgit-08db81a9f1e4072790f0257f5398e8408e3d6816.tar.gz
allow git-update-ref create refs with slashes in names
Make git-update-ref create references with slashes in them. git-branch and git-checkout already support such reference names. git-branch can use git-update-ref to create the references in a more formal manner now. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'update-ref.c')
-rw-r--r--update-ref.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/update-ref.c b/update-ref.c
index d79dc52fd7..e6fbddbab6 100644
--- a/update-ref.c
+++ b/update-ref.c
@@ -19,7 +19,8 @@ static int re_verify(const char *path, unsigned char *oldsha1, unsigned char *cu
int main(int argc, char **argv)
{
char *hex;
- const char *refname, *value, *oldval, *path, *lockpath;
+ const char *refname, *value, *oldval, *path;
+ char *lockpath;
unsigned char sha1[20], oldsha1[20], currsha1[20];
int fd, written;
@@ -49,6 +50,8 @@ int main(int argc, char **argv)
}
path = strdup(path);
lockpath = mkpath("%s.lock", path);
+ if (safe_create_leading_directories(lockpath) < 0)
+ die("Unable to create all of %s", lockpath);
fd = open(lockpath, O_CREAT | O_EXCL | O_WRONLY, 0666);
if (fd < 0)