git/check-ref-format.c
Junio C Hamano 652d5dc6c0 git-check-ref-format: reject funny ref names.
Update check_ref_format() function to reject ref names that:

 * has a path component that begins with a ".", or
 * has a double dots "..", or
 * has ASCII control character, "~", "^", ":" or SP, anywhere, or
 * ends with a "/".

Use it in 'git-checkout -b', 'git-branch', and 'git-tag' to make sure
that newly created refs are well-formed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-15 17:10:14 -07:00

18 lines
248 B
C

/*
* GIT - The information manager from hell
*/
#include "cache.h"
#include "refs.h"
#include <stdio.h>
int main(int ac, char **av)
{
if (ac != 2)
usage("git-check-ref-format refname");
if (check_ref_format(av[1]))
exit(1);
return 0;
}