File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -263,8 +263,10 @@ static bool tag_name_is_valid(const char *tag_name)
263263 /*
264264 * Discourage tag name starting with dash,
265265 * https://github.com/git/git/commit/4f0accd638b8d2
266+ * and refuse to use HEAD as a tagname,
267+ * https://github.com/git/git/commit/bbd445d5efd415
266268 */
267- return tag_name [0 ] != '-' ;
269+ return tag_name [0 ] != '-' && git__strcmp ( tag_name , "HEAD" ) ;
268270}
269271
270272static int git_tag_create__internal (
Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ void test_refs_tags_name__is_name_valid(void)
1111{
1212 cl_assert_equal_i (true, name_is_valid ("sometag" ));
1313 cl_assert_equal_i (true, name_is_valid ("test/sometag" ));
14+ cl_assert_equal_i (true, name_is_valid ("test/HEAD" ));
1415
1516 cl_assert_equal_i (false, name_is_valid ("" ));
1617 cl_assert_equal_i (false, name_is_valid ("-dash" ));
18+ cl_assert_equal_i (false, name_is_valid ("HEAD" ));
1719}
You can’t perform that action at this time.
0 commit comments