@@ -95,13 +95,15 @@ refname::
95
95
The name of the ref (the part after $GIT_DIR/).
96
96
For a non-ambiguous short name of the ref append `:short`.
97
97
The option core.warnAmbiguousRefs is used to select the strict
98
- abbreviation mode. If `lstrip=<N>` is appended, strips `<N>`
99
- slash-separated path components from the front of the refname
100
- (e.g. `%(refname:lstrip=2)` turns `refs/tags/foo` into `foo`.
98
+ abbreviation mode. If `lstrip=<N>` (`rstrip=<N>`) is appended, strips `<N>`
99
+ slash-separated path components from the front (back) of the refname
100
+ (e.g. `%(refname:lstrip=2)` turns `refs/tags/foo` into `foo` and
101
+ `%(refname:rstrip=2)` turns `refs/tags/foo` into `refs`).
101
102
If `<N>` is a negative number, strip as many path components as
102
- necessary from the left to leave `-<N>` path components
103
+ necessary from the specified end to leave `-<N>` path components
103
104
(e.g. `%(refname:lstrip=-2)` turns
104
- `refs/tags/foo` into `tags/foo`). When the ref does not have
105
+ `refs/tags/foo` into `tags/foo` and `%(refname:rstrip=-1)`
106
+ turns `refs/tags/foo` into `refs`). When the ref does not have
105
107
enough components, the result becomes an empty string if
106
108
stripping with positive <N>, or it becomes the full refname if
107
109
stripping with negative <N>. Neither is an error.
@@ -121,22 +123,23 @@ objectname::
121
123
122
124
upstream::
123
125
The name of a local ref which can be considered ``upstream''
124
- from the displayed ref. Respects `:short` and `:lstrip` in the
125
- same way as `refname` above. Additionally respects `:track`
126
- to show "[ahead N, behind M]" and `:trackshort` to show the
127
- terse version: ">" (ahead), "<" (behind), "<>" (ahead and
128
- behind), or "=" (in sync). `:track` also prints "[gone]"
129
- whenever unknown upstream ref is encountered. Append
130
- `:track,nobracket` to show tracking information without
131
- brackets (i.e "ahead N, behind M"). Has no effect if the ref
132
- does not have tracking information associated with it. All
133
- the options apart from `nobracket` are mutually exclusive, but
134
- if used together the last option is selected.
126
+ from the displayed ref. Respects `:short`, `:lstrip` and
127
+ `:rstrip` in the same way as `refname` above. Additionally
128
+ respects `:track` to show "[ahead N, behind M]" and
129
+ `:trackshort` to show the terse version: ">" (ahead), "<"
130
+ (behind), "<>" (ahead and behind), or "=" (in sync). `:track`
131
+ also prints "[gone]" whenever unknown upstream ref is
132
+ encountered. Append `:track,nobracket` to show tracking
133
+ information without brackets (i.e "ahead N, behind M"). Has
134
+ no effect if the ref does not have tracking information
135
+ associated with it. All the options apart from `nobracket`
136
+ are mutually exclusive, but if used together the last option
137
+ is selected.
135
138
136
139
push::
137
140
The name of a local ref which represents the `@{push}`
138
141
location for the displayed ref. Respects `:short`, `:lstrip`,
139
- `:track`, and `:trackshort` options as `upstream`
142
+ `:rstrip`, `: track`, and `:trackshort` options as `upstream`
140
143
does. Produces an empty string if no `@{push}` ref is
141
144
configured.
142
145
178
181
179
182
symref::
180
183
The ref which the given symbolic ref refers to. If not a
181
- symbolic ref, nothing is printed. Respects the `:short` and
182
- `:lstrip` options in the same way as `refname` above.
184
+ symbolic ref, nothing is printed. Respects the `:short`,
185
+ `:lstrip` and `:rstrip` options in the same way as `refname`
186
+ above.
183
187
184
188
In addition to the above, for commit and tag objects, the header
185
189
field names (`tree`, `parent`, `object`, `type`, and `tag`) can
0 commit comments