From: David Turner Date: Thu, 18 Feb 2016 05:17:35 GMT Subject: [PATCH v5 12/27] refs: forbid cross-backend ref renames Message-ID: <1455772670-21142-13-git-send-email-dturner@twopensource.com> In-Reply-To: <1455772670-21142-1-git-send-email-dturner@twopensource.com> This would be pretty weird, but since it will break, we should prevent it. Signed-off-by: David Turner --- refs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/refs.c b/refs.c index f5754f2..8eb04da 100644 --- a/refs.c +++ b/refs.c @@ -1306,5 +1306,11 @@ int delete_refs(struct string_list *refnames) int rename_ref(const char *oldref, const char *newref, const char *logmsg) { + if ((ref_type(oldref) == REF_TYPE_NORMAL) != + (ref_type(newref) == REF_TYPE_NORMAL)) { + error(_("Both ref arguments to rename_ref must be normal " + "(or both must be per-worktree/pseudorefs)")); + return -1; + } return the_refs_backend->rename_ref(oldref, newref, logmsg); } -- 2.4.2.767.g62658d5-twtrsrc