Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-check-ref-format(1) |
| 2 | ======================= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 6 | git-check-ref-format - Make sure ref name is well formed |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
| 10 | 'git-check-ref-format' <refname> |
| 11 | |
| 12 | DESCRIPTION |
| 13 | ----------- |
| 14 | Checks if a given 'refname' is acceptable, and exits non-zero if |
| 15 | it is not. |
| 16 | |
| 17 | A reference is used in git to specify branches and tags. A |
| 18 | branch head is stored under `$GIT_DIR/refs/heads` directory, and |
| 19 | a tag is stored under `$GIT_DIR/refs/tags` directory. git |
| 20 | imposes the following rules on how refs are named: |
| 21 | |
Junio C Hamano | 33db437 | 2006-06-07 19:51:45 | [diff] [blame] | 22 | . It can include slash `/` for hierarchical (directory) |
| 23 | grouping, but no slash-separated component can begin with a |
| 24 | dot `.`; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 25 | |
| 26 | . It cannot have two consecutive dots `..` anywhere; |
| 27 | |
| 28 | . It cannot have ASCII control character (i.e. bytes whose |
| 29 | values are lower than \040, or \177 `DEL`), space, tilde `~`, |
| 30 | caret `{caret}`, colon `:`, question-mark `?`, asterisk `*`, |
| 31 | or open bracket `[` anywhere; |
| 32 | |
| 33 | . It cannot end with a slash `/`. |
| 34 | |
| 35 | These rules makes it easy for shell script based tools to parse |
| 36 | refnames, pathname expansion by the shell when a refname is used |
| 37 | unquoted (by mistake), and also avoids ambiguities in certain |
| 38 | refname expressions (see gitlink:git-rev-parse[1]). Namely: |
| 39 | |
| 40 | . double-dot `..` are often used as in `ref1..ref2`, and in some |
| 41 | context this notation means `{caret}ref1 ref2` (i.e. not in |
| 42 | ref1 and in ref2). |
| 43 | |
| 44 | . tilde `~` and caret `{caret}` are used to introduce postfix |
| 45 | 'nth parent' and 'peel onion' operation. |
| 46 | |
| 47 | . colon `:` is used as in `srcref:dstref` to mean "use srcref\'s |
| 48 | value and store it in dstref" in fetch and push operations. |
Junio C Hamano | b2f5edd | 2006-05-21 10:50:09 | [diff] [blame] | 49 | It may also be used to select a specific object such as with |
| 50 | gitlink:git-cat-file[1] "git-cat-file blob v1.3.3:refs.c". |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 51 | |
| 52 | |
| 53 | GIT |
| 54 | --- |
| 55 | Part of the gitlink:git[7] suite |