|
|
@ -2360,20 +2360,17 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms |
|
|
|
struct ref_lock *lock; |
|
|
|
struct ref_lock *lock; |
|
|
|
struct stat loginfo; |
|
|
|
struct stat loginfo; |
|
|
|
int log = !lstat(git_path("logs/%s", oldrefname), &loginfo); |
|
|
|
int log = !lstat(git_path("logs/%s", oldrefname), &loginfo); |
|
|
|
const char *symref = NULL; |
|
|
|
|
|
|
|
struct strbuf err = STRBUF_INIT; |
|
|
|
struct strbuf err = STRBUF_INIT; |
|
|
|
|
|
|
|
|
|
|
|
if (log && S_ISLNK(loginfo.st_mode)) |
|
|
|
if (log && S_ISLNK(loginfo.st_mode)) |
|
|
|
return error("reflog for %s is a symlink", oldrefname); |
|
|
|
return error("reflog for %s is a symlink", oldrefname); |
|
|
|
|
|
|
|
|
|
|
|
symref = resolve_ref_unsafe(oldrefname, RESOLVE_REF_READING, |
|
|
|
if (!resolve_ref_unsafe(oldrefname, RESOLVE_REF_READING, orig_sha1, &flag)) |
|
|
|
orig_sha1, &flag); |
|
|
|
return error("refname %s not found", oldrefname); |
|
|
|
|
|
|
|
|
|
|
|
if (flag & REF_ISSYMREF) |
|
|
|
if (flag & REF_ISSYMREF) |
|
|
|
return error("refname %s is a symbolic ref, renaming it is not supported", |
|
|
|
return error("refname %s is a symbolic ref, renaming it is not supported", |
|
|
|
oldrefname); |
|
|
|
oldrefname); |
|
|
|
if (!symref) |
|
|
|
|
|
|
|
return error("refname %s not found", oldrefname); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!rename_ref_available(oldrefname, newrefname)) |
|
|
|
if (!rename_ref_available(oldrefname, newrefname)) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
|
|