diff --git a/builtin-update-ref.c b/builtin-update-ref.c
index f2506fa9762bd9d868076710f38dfc9137186828..5ee960bf41c4518b6c5530acb123a7ed668538fc 100644 (file)
--- a/builtin-update-ref.c
+++ b/builtin-update-ref.c
int i, delete;
delete = 0;
- setup_ident();
git_config(git_default_config);
for (i = 1; i < argc; i++) {
msg = argv[++i];
if (!*msg)
die("Refusing to perform update with empty message.");
+ if (strchr(msg, '\n'))
+ die("Refusing to perform update with \\n in message.");
continue;
}
if (!strcmp("-d", argv[i])) {
lock = lock_any_ref_for_update(refname, oldval ? oldsha1 : NULL);
if (!lock)
- return 1;
+ die("%s: cannot lock the ref", refname);
if (write_ref_sha1(lock, sha1, msg) < 0)
- return 1;
-
- /* write_ref_sha1 always unlocks the ref, no need to do it explicitly */
+ die("%s: cannot update the ref", refname);
return 0;
}