Commit cb078d5194e67e093cdd53b235bc1bd837490ca3

Alexander Ovchinnikov 2021-08-05T14:02:54

Check if default branch matches refspec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/clone.c b/src/clone.c
index 962cf12..e29a4aa 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -285,6 +285,9 @@ static int update_head_to_branch(
 	if ((retcode = git_remote_default_branch(&default_branch, remote)) < 0)
 		goto cleanup;
 
+	if (!git_remote__matching_refspec(remote, git_buf_cstr(&default_branch)))
+		goto cleanup;
+
 	retcode = update_remote_head(repo, remote, &default_branch, reflog_message);
 
 cleanup: