struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *old_sha1)
{
+ if (check_ref_format(ref) == -1)
+ return NULL;
return lock_ref_sha1_basic(ref, old_sha1, NULL);
}
if (logmsg && read_ref(ref_target, old_sha1))
hashclr(old_sha1);
+ if (safe_create_leading_directories(git_HEAD) < 0)
+ return error("unable to create directory for %s", git_HEAD);
+
#ifndef NO_SYMLINK_HEAD
if (prefer_symlink_refs) {
unlink(git_HEAD);
!message || message[0] != ' ' ||
(message[1] != '+' && message[1] != '-') ||
!isdigit(message[2]) || !isdigit(message[3]) ||
- !isdigit(message[4]) || !isdigit(message[5]) ||
- message[6] != '\t')
+ !isdigit(message[4]) || !isdigit(message[5]))
continue; /* corrupt? */
email_end[1] = '\0';
tz = strtol(message + 1, NULL, 10);
- message += 7;
+ if (message[6] != '\t')
+ message += 6;
+ else
+ message += 7;
ret = fn(osha1, nsha1, buf+82, timestamp, tz, message, cb_data);
if (ret)
break;
static int do_for_each_reflog(const char *base, each_ref_fn fn, void *cb_data)
{
DIR *dir = opendir(git_path("logs/%s", base));
- int retval = errno;
+ int retval = 0;
if (dir) {
struct dirent *de;
free(log);
closedir(dir);
}
+ else if (*base)
+ return errno;
return retval;
}