Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 3 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 5 | <head> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 6 | <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> |
Junio C Hamano | a85030a | 2022-07-27 16:48:21 | [diff] [blame] | 7 | <meta name="generator" content="AsciiDoc 10.2.0" /> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 8 | <title>githooks(5)</title> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 9 | <style type="text/css"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 10 | /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ |
| 11 | |
| 12 | /* Default font. */ |
| 13 | body { |
| 14 | font-family: Georgia,serif; |
| 15 | } |
| 16 | |
| 17 | /* Title font. */ |
| 18 | h1, h2, h3, h4, h5, h6, |
| 19 | div.title, caption.title, |
| 20 | thead, p.table.header, |
| 21 | #toctitle, |
| 22 | #author, #revnumber, #revdate, #revremark, |
| 23 | #footer { |
| 24 | font-family: Arial,Helvetica,sans-serif; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | body { |
| 28 | margin: 1em 5% 1em 5%; |
| 29 | } |
| 30 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 31 | a { |
| 32 | color: blue; |
| 33 | text-decoration: underline; |
| 34 | } |
| 35 | a:visited { |
| 36 | color: fuchsia; |
| 37 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 38 | |
| 39 | em { |
| 40 | font-style: italic; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 41 | color: navy; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | strong { |
| 45 | font-weight: bold; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 46 | color: #083194; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 47 | } |
| 48 | |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 49 | h1, h2, h3, h4, h5, h6 { |
| 50 | color: #527bbd; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 51 | margin-top: 1.2em; |
| 52 | margin-bottom: 0.5em; |
| 53 | line-height: 1.3; |
| 54 | } |
| 55 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 56 | h1, h2, h3 { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 57 | border-bottom: 2px solid silver; |
| 58 | } |
| 59 | h2 { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 60 | padding-top: 0.5em; |
| 61 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 62 | h3 { |
| 63 | float: left; |
| 64 | } |
| 65 | h3 + * { |
| 66 | clear: left; |
| 67 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 68 | h5 { |
| 69 | font-size: 1.0em; |
| 70 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 71 | |
| 72 | div.sectionbody { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 73 | margin-left: 0; |
| 74 | } |
| 75 | |
| 76 | hr { |
| 77 | border: 1px solid silver; |
| 78 | } |
| 79 | |
| 80 | p { |
| 81 | margin-top: 0.5em; |
| 82 | margin-bottom: 0.5em; |
| 83 | } |
| 84 | |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 85 | ul, ol, li > p { |
| 86 | margin-top: 0; |
| 87 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 88 | ul > li { color: #aaa; } |
| 89 | ul > li > * { color: black; } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 90 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 91 | .monospaced, code, pre { |
| 92 | font-family: "Courier New", Courier, monospace; |
| 93 | font-size: inherit; |
| 94 | color: navy; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 95 | padding: 0; |
| 96 | margin: 0; |
| 97 | } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 98 | pre { |
| 99 | white-space: pre-wrap; |
| 100 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 101 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 102 | #author { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 103 | color: #527bbd; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 104 | font-weight: bold; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 105 | font-size: 1.1em; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 106 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 107 | #email { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 108 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 109 | #revnumber, #revdate, #revremark { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 110 | } |
| 111 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 112 | #footer { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 113 | font-size: small; |
| 114 | border-top: 2px solid silver; |
| 115 | padding-top: 0.5em; |
| 116 | margin-top: 4.0em; |
| 117 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 118 | #footer-text { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 119 | float: left; |
| 120 | padding-bottom: 0.5em; |
| 121 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 122 | #footer-badges { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 123 | float: right; |
| 124 | padding-bottom: 0.5em; |
| 125 | } |
| 126 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 127 | #preamble { |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 128 | margin-top: 1.5em; |
| 129 | margin-bottom: 1.5em; |
| 130 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 131 | div.imageblock, div.exampleblock, div.verseblock, |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 132 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 133 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 134 | margin-top: 1.0em; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 135 | margin-bottom: 1.5em; |
| 136 | } |
| 137 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 138 | margin-top: 2.0em; |
| 139 | margin-bottom: 2.0em; |
| 140 | margin-right: 10%; |
| 141 | color: #606060; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | div.content { /* Block element content. */ |
| 145 | padding: 0; |
| 146 | } |
| 147 | |
| 148 | /* Block element titles. */ |
| 149 | div.title, caption.title { |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 150 | color: #527bbd; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 151 | font-weight: bold; |
| 152 | text-align: left; |
| 153 | margin-top: 1.0em; |
| 154 | margin-bottom: 0.5em; |
| 155 | } |
| 156 | div.title + * { |
| 157 | margin-top: 0; |
| 158 | } |
| 159 | |
| 160 | td div.title:first-child { |
| 161 | margin-top: 0.0em; |
| 162 | } |
| 163 | div.content div.title:first-child { |
| 164 | margin-top: 0.0em; |
| 165 | } |
| 166 | div.content + div.title { |
| 167 | margin-top: 0.0em; |
| 168 | } |
| 169 | |
| 170 | div.sidebarblock > div.content { |
| 171 | background: #ffffee; |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 172 | border: 1px solid #dddddd; |
| 173 | border-left: 4px solid #f0f0f0; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 174 | padding: 0.5em; |
| 175 | } |
| 176 | |
| 177 | div.listingblock > div.content { |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 178 | border: 1px solid #dddddd; |
| 179 | border-left: 5px solid #f0f0f0; |
| 180 | background: #f8f8f8; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 181 | padding: 0.5em; |
| 182 | } |
| 183 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 184 | div.quoteblock, div.verseblock { |
| 185 | padding-left: 1.0em; |
| 186 | margin-left: 1.0em; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 187 | margin-right: 10%; |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 188 | border-left: 5px solid #f0f0f0; |
| 189 | color: #888; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 190 | } |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 191 | |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 192 | div.quoteblock > div.attribution { |
| 193 | padding-top: 0.5em; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 194 | text-align: right; |
| 195 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 196 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 197 | div.verseblock > pre.content { |
| 198 | font-family: inherit; |
| 199 | font-size: inherit; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 200 | } |
| 201 | div.verseblock > div.attribution { |
| 202 | padding-top: 0.75em; |
| 203 | text-align: left; |
| 204 | } |
| 205 | /* DEPRECATED: Pre version 8.2.7 verse style literal block. */ |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 206 | div.verseblock + div.attribution { |
| 207 | text-align: left; |
| 208 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 209 | |
| 210 | div.admonitionblock .icon { |
| 211 | vertical-align: top; |
| 212 | font-size: 1.1em; |
| 213 | font-weight: bold; |
| 214 | text-decoration: underline; |
| 215 | color: #527bbd; |
| 216 | padding-right: 0.5em; |
| 217 | } |
| 218 | div.admonitionblock td.content { |
| 219 | padding-left: 0.5em; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 220 | border-left: 3px solid #dddddd; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | div.exampleblock > div.content { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 224 | border-left: 3px solid #dddddd; |
| 225 | padding-left: 0.5em; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 226 | } |
| 227 | |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 228 | div.imageblock div.content { padding-left: 0; } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 229 | span.image img { border-style: none; vertical-align: text-bottom; } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 230 | a.image:visited { color: white; } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 231 | |
| 232 | dl { |
| 233 | margin-top: 0.8em; |
| 234 | margin-bottom: 0.8em; |
| 235 | } |
| 236 | dt { |
| 237 | margin-top: 0.5em; |
| 238 | margin-bottom: 0; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 239 | font-style: normal; |
| 240 | color: navy; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 241 | } |
| 242 | dd > *:first-child { |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 243 | margin-top: 0.1em; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | ul, ol { |
| 247 | list-style-position: outside; |
| 248 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 249 | ol.arabic { |
| 250 | list-style-type: decimal; |
| 251 | } |
| 252 | ol.loweralpha { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 253 | list-style-type: lower-alpha; |
| 254 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 255 | ol.upperalpha { |
| 256 | list-style-type: upper-alpha; |
| 257 | } |
| 258 | ol.lowerroman { |
| 259 | list-style-type: lower-roman; |
| 260 | } |
| 261 | ol.upperroman { |
| 262 | list-style-type: upper-roman; |
| 263 | } |
| 264 | |
| 265 | div.compact ul, div.compact ol, |
| 266 | div.compact p, div.compact p, |
| 267 | div.compact div, div.compact div { |
| 268 | margin-top: 0.1em; |
| 269 | margin-bottom: 0.1em; |
| 270 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 271 | |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 272 | tfoot { |
| 273 | font-weight: bold; |
| 274 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 275 | td > div.verse { |
| 276 | white-space: pre; |
| 277 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 278 | |
| 279 | div.hdlist { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 280 | margin-top: 0.8em; |
| 281 | margin-bottom: 0.8em; |
| 282 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 283 | div.hdlist tr { |
| 284 | padding-bottom: 15px; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 285 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 286 | dt.hdlist1.strong, td.hdlist1.strong { |
| 287 | font-weight: bold; |
| 288 | } |
| 289 | td.hdlist1 { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 290 | vertical-align: top; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 291 | font-style: normal; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 292 | padding-right: 0.8em; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 293 | color: navy; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 294 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 295 | td.hdlist2 { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 296 | vertical-align: top; |
| 297 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 298 | div.hdlist.compact tr { |
| 299 | margin: 0; |
| 300 | padding-bottom: 0; |
| 301 | } |
| 302 | |
| 303 | .comment { |
| 304 | background: yellow; |
| 305 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 306 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 307 | .footnote, .footnoteref { |
| 308 | font-size: 0.8em; |
| 309 | } |
| 310 | |
| 311 | span.footnote, span.footnoteref { |
| 312 | vertical-align: super; |
| 313 | } |
| 314 | |
| 315 | #footnotes { |
| 316 | margin: 20px 0 20px 0; |
| 317 | padding: 7px 0 0 0; |
| 318 | } |
| 319 | |
| 320 | #footnotes div.footnote { |
| 321 | margin: 0 0 5px 0; |
| 322 | } |
| 323 | |
| 324 | #footnotes hr { |
| 325 | border: none; |
| 326 | border-top: 1px solid silver; |
| 327 | height: 1px; |
| 328 | text-align: left; |
| 329 | margin-left: 0; |
| 330 | width: 20%; |
| 331 | min-width: 100px; |
| 332 | } |
| 333 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 334 | div.colist td { |
| 335 | padding-right: 0.5em; |
| 336 | padding-bottom: 0.3em; |
| 337 | vertical-align: top; |
| 338 | } |
| 339 | div.colist td img { |
| 340 | margin-top: 0.3em; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 341 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 342 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 343 | @media print { |
| 344 | #footer-badges { display: none; } |
| 345 | } |
| 346 | |
| 347 | #toc { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 348 | margin-bottom: 2.5em; |
| 349 | } |
| 350 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 351 | #toctitle { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 352 | color: #527bbd; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 353 | font-size: 1.1em; |
| 354 | font-weight: bold; |
| 355 | margin-top: 1.0em; |
| 356 | margin-bottom: 0.1em; |
| 357 | } |
| 358 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 359 | div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 360 | margin-top: 0; |
| 361 | margin-bottom: 0; |
| 362 | } |
| 363 | div.toclevel2 { |
| 364 | margin-left: 2em; |
| 365 | font-size: 0.9em; |
| 366 | } |
| 367 | div.toclevel3 { |
| 368 | margin-left: 4em; |
| 369 | font-size: 0.9em; |
| 370 | } |
| 371 | div.toclevel4 { |
| 372 | margin-left: 6em; |
| 373 | font-size: 0.9em; |
| 374 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 375 | |
| 376 | span.aqua { color: aqua; } |
| 377 | span.black { color: black; } |
| 378 | span.blue { color: blue; } |
| 379 | span.fuchsia { color: fuchsia; } |
| 380 | span.gray { color: gray; } |
| 381 | span.green { color: green; } |
| 382 | span.lime { color: lime; } |
| 383 | span.maroon { color: maroon; } |
| 384 | span.navy { color: navy; } |
| 385 | span.olive { color: olive; } |
| 386 | span.purple { color: purple; } |
| 387 | span.red { color: red; } |
| 388 | span.silver { color: silver; } |
| 389 | span.teal { color: teal; } |
| 390 | span.white { color: white; } |
| 391 | span.yellow { color: yellow; } |
| 392 | |
| 393 | span.aqua-background { background: aqua; } |
| 394 | span.black-background { background: black; } |
| 395 | span.blue-background { background: blue; } |
| 396 | span.fuchsia-background { background: fuchsia; } |
| 397 | span.gray-background { background: gray; } |
| 398 | span.green-background { background: green; } |
| 399 | span.lime-background { background: lime; } |
| 400 | span.maroon-background { background: maroon; } |
| 401 | span.navy-background { background: navy; } |
| 402 | span.olive-background { background: olive; } |
| 403 | span.purple-background { background: purple; } |
| 404 | span.red-background { background: red; } |
| 405 | span.silver-background { background: silver; } |
| 406 | span.teal-background { background: teal; } |
| 407 | span.white-background { background: white; } |
| 408 | span.yellow-background { background: yellow; } |
| 409 | |
| 410 | span.big { font-size: 2em; } |
| 411 | span.small { font-size: 0.6em; } |
| 412 | |
| 413 | span.underline { text-decoration: underline; } |
| 414 | span.overline { text-decoration: overline; } |
| 415 | span.line-through { text-decoration: line-through; } |
| 416 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 417 | div.unbreakable { page-break-inside: avoid; } |
| 418 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 419 | |
| 420 | /* |
| 421 | * xhtml11 specific |
| 422 | * |
| 423 | * */ |
| 424 | |
| 425 | div.tableblock { |
| 426 | margin-top: 1.0em; |
| 427 | margin-bottom: 1.5em; |
| 428 | } |
| 429 | div.tableblock > table { |
| 430 | border: 3px solid #527bbd; |
| 431 | } |
| 432 | thead, p.table.header { |
| 433 | font-weight: bold; |
| 434 | color: #527bbd; |
| 435 | } |
| 436 | p.table { |
| 437 | margin-top: 0; |
| 438 | } |
Junio C Hamano | 725b0da | 2020-01-22 22:02:40 | [diff] [blame] | 439 | /* Because the table frame attribute is overridden by CSS in most browsers. */ |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 440 | div.tableblock > table[frame="void"] { |
| 441 | border-style: none; |
| 442 | } |
| 443 | div.tableblock > table[frame="hsides"] { |
| 444 | border-left-style: none; |
| 445 | border-right-style: none; |
| 446 | } |
| 447 | div.tableblock > table[frame="vsides"] { |
| 448 | border-top-style: none; |
| 449 | border-bottom-style: none; |
| 450 | } |
| 451 | |
| 452 | |
| 453 | /* |
| 454 | * html5 specific |
| 455 | * |
| 456 | * */ |
| 457 | |
| 458 | table.tableblock { |
| 459 | margin-top: 1.0em; |
| 460 | margin-bottom: 1.5em; |
| 461 | } |
| 462 | thead, p.tableblock.header { |
| 463 | font-weight: bold; |
| 464 | color: #527bbd; |
| 465 | } |
| 466 | p.tableblock { |
| 467 | margin-top: 0; |
| 468 | } |
| 469 | table.tableblock { |
| 470 | border-width: 3px; |
| 471 | border-spacing: 0px; |
| 472 | border-style: solid; |
| 473 | border-color: #527bbd; |
| 474 | border-collapse: collapse; |
| 475 | } |
| 476 | th.tableblock, td.tableblock { |
| 477 | border-width: 1px; |
| 478 | padding: 4px; |
| 479 | border-style: solid; |
| 480 | border-color: #527bbd; |
| 481 | } |
| 482 | |
| 483 | table.tableblock.frame-topbot { |
| 484 | border-left-style: hidden; |
| 485 | border-right-style: hidden; |
| 486 | } |
| 487 | table.tableblock.frame-sides { |
| 488 | border-top-style: hidden; |
| 489 | border-bottom-style: hidden; |
| 490 | } |
| 491 | table.tableblock.frame-none { |
| 492 | border-style: hidden; |
| 493 | } |
| 494 | |
| 495 | th.tableblock.halign-left, td.tableblock.halign-left { |
| 496 | text-align: left; |
| 497 | } |
| 498 | th.tableblock.halign-center, td.tableblock.halign-center { |
| 499 | text-align: center; |
| 500 | } |
| 501 | th.tableblock.halign-right, td.tableblock.halign-right { |
| 502 | text-align: right; |
| 503 | } |
| 504 | |
| 505 | th.tableblock.valign-top, td.tableblock.valign-top { |
| 506 | vertical-align: top; |
| 507 | } |
| 508 | th.tableblock.valign-middle, td.tableblock.valign-middle { |
| 509 | vertical-align: middle; |
| 510 | } |
| 511 | th.tableblock.valign-bottom, td.tableblock.valign-bottom { |
| 512 | vertical-align: bottom; |
| 513 | } |
| 514 | |
| 515 | |
| 516 | /* |
| 517 | * manpage specific |
| 518 | * |
| 519 | * */ |
| 520 | |
| 521 | body.manpage h1 { |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 522 | padding-top: 0.5em; |
| 523 | padding-bottom: 0.5em; |
| 524 | border-top: 2px solid silver; |
| 525 | border-bottom: 2px solid silver; |
| 526 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 527 | body.manpage h2 { |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 528 | border-style: none; |
| 529 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 530 | body.manpage div.sectionbody { |
| 531 | margin-left: 3em; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 532 | } |
| 533 | |
| 534 | @media print { |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 535 | body.manpage div#toc { display: none; } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 536 | } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 537 | |
| 538 | |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 539 | </style> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 540 | <script type="text/javascript"> |
| 541 | /*<![CDATA[*/ |
Junio C Hamano | 2b15318 | 2021-12-15 21:00:31 | [diff] [blame] | 542 | var asciidoc = { // Namespace. |
| 543 | |
| 544 | ///////////////////////////////////////////////////////////////////// |
| 545 | // Table Of Contents generator |
| 546 | ///////////////////////////////////////////////////////////////////// |
| 547 | |
| 548 | /* Author: Mihai Bazon, September 2002 |
| 549 | * http://students.infoiasi.ro/~mishoo |
| 550 | * |
| 551 | * Table Of Content generator |
| 552 | * Version: 0.4 |
| 553 | * |
| 554 | * Feel free to use this script under the terms of the GNU General Public |
| 555 | * License, as long as you do not remove or alter this notice. |
| 556 | */ |
| 557 | |
| 558 | /* modified by Troy D. Hanson, September 2006. License: GPL */ |
| 559 | /* modified by Stuart Rackham, 2006, 2009. License: GPL */ |
| 560 | |
| 561 | // toclevels = 1..4. |
| 562 | toc: function (toclevels) { |
| 563 | |
| 564 | function getText(el) { |
| 565 | var text = ""; |
| 566 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 567 | if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. |
| 568 | text += i.data; |
| 569 | else if (i.firstChild != null) |
| 570 | text += getText(i); |
| 571 | } |
| 572 | return text; |
| 573 | } |
| 574 | |
| 575 | function TocEntry(el, text, toclevel) { |
| 576 | this.element = el; |
| 577 | this.text = text; |
| 578 | this.toclevel = toclevel; |
| 579 | } |
| 580 | |
| 581 | function tocEntries(el, toclevels) { |
| 582 | var result = new Array; |
| 583 | var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); |
| 584 | // Function that scans the DOM tree for header elements (the DOM2 |
| 585 | // nodeIterator API would be a better technique but not supported by all |
| 586 | // browsers). |
| 587 | var iterate = function (el) { |
| 588 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 589 | if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { |
| 590 | var mo = re.exec(i.tagName); |
| 591 | if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { |
| 592 | result[result.length] = new TocEntry(i, getText(i), mo[1]-1); |
| 593 | } |
| 594 | iterate(i); |
| 595 | } |
| 596 | } |
| 597 | } |
| 598 | iterate(el); |
| 599 | return result; |
| 600 | } |
| 601 | |
| 602 | var toc = document.getElementById("toc"); |
| 603 | if (!toc) { |
| 604 | return; |
| 605 | } |
| 606 | |
| 607 | // Delete existing TOC entries in case we're reloading the TOC. |
| 608 | var tocEntriesToRemove = []; |
| 609 | var i; |
| 610 | for (i = 0; i < toc.childNodes.length; i++) { |
| 611 | var entry = toc.childNodes[i]; |
| 612 | if (entry.nodeName.toLowerCase() == 'div' |
| 613 | && entry.getAttribute("class") |
| 614 | && entry.getAttribute("class").match(/^toclevel/)) |
| 615 | tocEntriesToRemove.push(entry); |
| 616 | } |
| 617 | for (i = 0; i < tocEntriesToRemove.length; i++) { |
| 618 | toc.removeChild(tocEntriesToRemove[i]); |
| 619 | } |
| 620 | |
| 621 | // Rebuild TOC entries. |
| 622 | var entries = tocEntries(document.getElementById("content"), toclevels); |
| 623 | for (var i = 0; i < entries.length; ++i) { |
| 624 | var entry = entries[i]; |
| 625 | if (entry.element.id == "") |
| 626 | entry.element.id = "_toc_" + i; |
| 627 | var a = document.createElement("a"); |
| 628 | a.href = "#" + entry.element.id; |
| 629 | a.appendChild(document.createTextNode(entry.text)); |
| 630 | var div = document.createElement("div"); |
| 631 | div.appendChild(a); |
| 632 | div.className = "toclevel" + entry.toclevel; |
| 633 | toc.appendChild(div); |
| 634 | } |
| 635 | if (entries.length == 0) |
| 636 | toc.parentNode.removeChild(toc); |
| 637 | }, |
| 638 | |
| 639 | |
| 640 | ///////////////////////////////////////////////////////////////////// |
| 641 | // Footnotes generator |
| 642 | ///////////////////////////////////////////////////////////////////// |
| 643 | |
| 644 | /* Based on footnote generation code from: |
| 645 | * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html |
| 646 | */ |
| 647 | |
| 648 | footnotes: function () { |
| 649 | // Delete existing footnote entries in case we're reloading the footnodes. |
| 650 | var i; |
| 651 | var noteholder = document.getElementById("footnotes"); |
| 652 | if (!noteholder) { |
| 653 | return; |
| 654 | } |
| 655 | var entriesToRemove = []; |
| 656 | for (i = 0; i < noteholder.childNodes.length; i++) { |
| 657 | var entry = noteholder.childNodes[i]; |
| 658 | if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") |
| 659 | entriesToRemove.push(entry); |
| 660 | } |
| 661 | for (i = 0; i < entriesToRemove.length; i++) { |
| 662 | noteholder.removeChild(entriesToRemove[i]); |
| 663 | } |
| 664 | |
| 665 | // Rebuild footnote entries. |
| 666 | var cont = document.getElementById("content"); |
| 667 | var spans = cont.getElementsByTagName("span"); |
| 668 | var refs = {}; |
| 669 | var n = 0; |
| 670 | for (i=0; i<spans.length; i++) { |
| 671 | if (spans[i].className == "footnote") { |
| 672 | n++; |
| 673 | var note = spans[i].getAttribute("data-note"); |
| 674 | if (!note) { |
| 675 | // Use [\s\S] in place of . so multi-line matches work. |
| 676 | // Because JavaScript has no s (dotall) regex flag. |
| 677 | note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; |
| 678 | spans[i].innerHTML = |
| 679 | "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + |
| 680 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 681 | spans[i].setAttribute("data-note", note); |
| 682 | } |
| 683 | noteholder.innerHTML += |
| 684 | "<div class='footnote' id='_footnote_" + n + "'>" + |
| 685 | "<a href='#_footnoteref_" + n + "' title='Return to text'>" + |
| 686 | n + "</a>. " + note + "</div>"; |
| 687 | var id =spans[i].getAttribute("id"); |
| 688 | if (id != null) refs["#"+id] = n; |
| 689 | } |
| 690 | } |
| 691 | if (n == 0) |
| 692 | noteholder.parentNode.removeChild(noteholder); |
| 693 | else { |
| 694 | // Process footnoterefs. |
| 695 | for (i=0; i<spans.length; i++) { |
| 696 | if (spans[i].className == "footnoteref") { |
| 697 | var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); |
| 698 | href = href.match(/#.*/)[0]; // Because IE return full URL. |
| 699 | n = refs[href]; |
| 700 | spans[i].innerHTML = |
| 701 | "[<a href='#_footnote_" + n + |
| 702 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 703 | } |
| 704 | } |
| 705 | } |
| 706 | }, |
| 707 | |
| 708 | install: function(toclevels) { |
| 709 | var timerId; |
| 710 | |
| 711 | function reinstall() { |
| 712 | asciidoc.footnotes(); |
| 713 | if (toclevels) { |
| 714 | asciidoc.toc(toclevels); |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | function reinstallAndRemoveTimer() { |
| 719 | clearInterval(timerId); |
| 720 | reinstall(); |
| 721 | } |
| 722 | |
| 723 | timerId = setInterval(reinstall, 500); |
| 724 | if (document.addEventListener) |
| 725 | document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); |
| 726 | else |
| 727 | window.onload = reinstallAndRemoveTimer; |
| 728 | } |
| 729 | |
| 730 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 731 | asciidoc.install(); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 732 | /*]]>*/ |
| 733 | </script> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 734 | </head> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 735 | <body class="manpage"> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 736 | <div id="header"> |
| 737 | <h1> |
| 738 | githooks(5) Manual Page |
| 739 | </h1> |
| 740 | <h2>NAME</h2> |
| 741 | <div class="sectionbody"> |
| 742 | <p>githooks - |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 743 | Hooks used by Git |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 744 | </p> |
| 745 | </div> |
| 746 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 747 | <div id="content"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 748 | <div class="sect1"> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 749 | <h2 id="_synopsis">SYNOPSIS</h2> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 750 | <div class="sectionbody"> |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 751 | <div class="paragraph"><p>$GIT_DIR/hooks/* (or `git config core.hooksPath`/*)</p></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 752 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 753 | </div> |
| 754 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 755 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 756 | <div class="sectionbody"> |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 757 | <div class="paragraph"><p>Hooks are programs you can place in a hooks directory to trigger |
| 758 | actions at certain points in git’s execution. Hooks that don’t have |
| 759 | the executable bit set are ignored.</p></div> |
| 760 | <div class="paragraph"><p>By default the hooks directory is <code>$GIT_DIR/hooks</code>, but that can be |
| 761 | changed via the <code>core.hooksPath</code> configuration variable (see |
| 762 | <a href="git-config.html">git-config(1)</a>).</p></div> |
| 763 | <div class="paragraph"><p>Before Git invokes a hook, it changes its working directory to either |
Junio C Hamano | 4c60d9a | 2017-05-04 14:36:22 | [diff] [blame] | 764 | $GIT_DIR in a bare repository or the root of the working tree in a non-bare |
| 765 | repository. An exception are hooks triggered during a push (<em>pre-receive</em>, |
| 766 | <em>update</em>, <em>post-receive</em>, <em>post-update</em>, <em>push-to-checkout</em>) which are always |
| 767 | executed in $GIT_DIR.</p></div> |
Junio C Hamano | a75aada | 2023-01-22 01:54:30 | [diff] [blame] | 768 | <div class="paragraph"><p>Environment variables, such as <code>GIT_DIR</code>, <code>GIT_WORK_TREE</code>, etc., are exported |
| 769 | so that Git commands run by the hook can correctly locate the repository. If |
| 770 | your hook needs to invoke Git commands in a foreign repository or in a |
| 771 | different working tree of the same repository, then it should clear these |
| 772 | environment variables so they do not interfere with Git operations at the |
| 773 | foreign location. For example:</p></div> |
| 774 | <div class="listingblock"> |
| 775 | <div class="content"> |
| 776 | <pre><code>local_desc=$(git describe) |
| 777 | foreign_desc=$(unset $(git rev-parse --local-env-vars); git -C ../foreign-repo describe)</code></pre> |
| 778 | </div></div> |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 779 | <div class="paragraph"><p>Hooks can get their arguments via the environment, command-line |
| 780 | arguments, and stdin. See the documentation for each hook below for |
| 781 | details.</p></div> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 782 | <div class="paragraph"><p><code>git init</code> may copy hooks to the new repository, depending on its |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 783 | configuration. See the "TEMPLATE DIRECTORY" section in |
| 784 | <a href="git-init.html">git-init(1)</a> for details. When the rest of this document refers |
| 785 | to "default hooks" it’s talking about the default template shipped |
| 786 | with Git.</p></div> |
| 787 | <div class="paragraph"><p>The currently supported hooks are described below.</p></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 788 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 789 | </div> |
| 790 | <div class="sect1"> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 791 | <h2 id="_hooks">HOOKS</h2> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 792 | <div class="sectionbody"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 793 | <div class="sect2"> |
| 794 | <h3 id="_applypatch_msg">applypatch-msg</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 795 | <div class="paragraph"><p>This hook is invoked by <a href="git-am.html">git-am(1)</a>. It takes a single |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 796 | parameter, the name of the file that holds the proposed commit |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 797 | log message. Exiting with a non-zero status causes <code>git am</code> to abort |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 798 | before applying the patch.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 799 | <div class="paragraph"><p>The hook is allowed to edit the message file in place, and can |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 800 | be used to normalize the message into some project standard |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 801 | format. It can also be used to refuse the commit after inspecting |
| 802 | the message file.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 803 | <div class="paragraph"><p>The default <em>applypatch-msg</em> hook, when enabled, runs the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 804 | <em>commit-msg</em> hook, if the latter is enabled.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 805 | </div> |
| 806 | <div class="sect2"> |
| 807 | <h3 id="_pre_applypatch">pre-applypatch</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 808 | <div class="paragraph"><p>This hook is invoked by <a href="git-am.html">git-am(1)</a>. It takes no parameter, and is |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 809 | invoked after the patch is applied, but before a commit is made.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 810 | <div class="paragraph"><p>If it exits with non-zero status, then the working tree will not be |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 811 | committed after applying the patch.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 812 | <div class="paragraph"><p>It can be used to inspect the current working tree and refuse to |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 813 | make a commit if it does not pass certain test.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 814 | <div class="paragraph"><p>The default <em>pre-applypatch</em> hook, when enabled, runs the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 815 | <em>pre-commit</em> hook, if the latter is enabled.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 816 | </div> |
| 817 | <div class="sect2"> |
| 818 | <h3 id="_post_applypatch">post-applypatch</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 819 | <div class="paragraph"><p>This hook is invoked by <a href="git-am.html">git-am(1)</a>. It takes no parameter, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 820 | and is invoked after the patch is applied and a commit is made.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 821 | <div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 822 | the outcome of <code>git am</code>.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 823 | </div> |
| 824 | <div class="sect2"> |
| 825 | <h3 id="_pre_commit">pre-commit</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 826 | <div class="paragraph"><p>This hook is invoked by <a href="git-commit.html">git-commit(1)</a>, and can be bypassed |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 827 | with the <code>--no-verify</code> option. It takes no parameters, and is |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 828 | invoked before obtaining the proposed commit log message and |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 829 | making a commit. Exiting with a non-zero status from this script |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 830 | causes the <code>git commit</code> command to abort before creating a commit.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 831 | <div class="paragraph"><p>The default <em>pre-commit</em> hook, when enabled, catches introduction |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 832 | of lines with trailing whitespaces and aborts the commit when |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 833 | such a line is found.</p></div> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 834 | <div class="paragraph"><p>All the <code>git commit</code> hooks are invoked with the environment |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 835 | variable <code>GIT_EDITOR=:</code> if the command will not bring up an editor |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 836 | to modify the commit message.</p></div> |
Junio C Hamano | 11f1537 | 2019-03-07 03:17:00 | [diff] [blame] | 837 | <div class="paragraph"><p>The default <em>pre-commit</em> hook, when enabled—and with the |
| 838 | <code>hooks.allownonascii</code> config option unset or set to false—prevents |
| 839 | the use of non-ASCII filenames.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 840 | </div> |
| 841 | <div class="sect2"> |
Junio C Hamano | cb70539 | 2019-09-18 19:30:01 | [diff] [blame] | 842 | <h3 id="_pre_merge_commit">pre-merge-commit</h3> |
| 843 | <div class="paragraph"><p>This hook is invoked by <a href="git-merge.html">git-merge(1)</a>, and can be bypassed |
| 844 | with the <code>--no-verify</code> option. It takes no parameters, and is |
| 845 | invoked after the merge has been carried out successfully and before |
| 846 | obtaining the proposed commit log message to |
| 847 | make a commit. Exiting with a non-zero status from this script |
| 848 | causes the <code>git merge</code> command to abort before creating a commit.</p></div> |
| 849 | <div class="paragraph"><p>The default <em>pre-merge-commit</em> hook, when enabled, runs the |
| 850 | <em>pre-commit</em> hook, if the latter is enabled.</p></div> |
| 851 | <div class="paragraph"><p>This hook is invoked with the environment variable |
| 852 | <code>GIT_EDITOR=:</code> if the command will not bring up an editor |
| 853 | to modify the commit message.</p></div> |
| 854 | <div class="paragraph"><p>If the merge cannot be carried out automatically, the conflicts |
| 855 | need to be resolved and the result committed separately (see |
| 856 | <a href="git-merge.html">git-merge(1)</a>). At that point, this hook will not be executed, |
| 857 | but the <em>pre-commit</em> hook will, if it is enabled.</p></div> |
| 858 | </div> |
| 859 | <div class="sect2"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 860 | <h3 id="_prepare_commit_msg">prepare-commit-msg</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 861 | <div class="paragraph"><p>This hook is invoked by <a href="git-commit.html">git-commit(1)</a> right after preparing the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 862 | default log message, and before the editor is started.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 863 | <div class="paragraph"><p>It takes one to three parameters. The first is the name of the file |
Junio C Hamano | bd53dbf | 2009-01-18 18:26:37 | [diff] [blame] | 864 | that contains the commit log message. The second is the source of the commit |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 865 | message, and can be: <code>message</code> (if a <code>-m</code> or <code>-F</code> option was |
| 866 | given); <code>template</code> (if a <code>-t</code> option was given or the |
| 867 | configuration option <code>commit.template</code> is set); <code>merge</code> (if the |
| 868 | commit is a merge or a <code>.git/MERGE_MSG</code> file exists); <code>squash</code> |
| 869 | (if a <code>.git/SQUASH_MSG</code> file exists); or <code>commit</code>, followed by |
Junio C Hamano | 458281a | 2021-03-22 21:20:26 | [diff] [blame] | 870 | a commit object name (if a <code>-c</code>, <code>-C</code> or <code>--amend</code> option was given).</p></div> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 871 | <div class="paragraph"><p>If the exit status is non-zero, <code>git commit</code> will abort.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 872 | <div class="paragraph"><p>The purpose of the hook is to edit the message file in place, and |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 873 | it is not suppressed by the <code>--no-verify</code> option. A non-zero exit |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 874 | means a failure of the hook and aborts the commit. It should not |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 875 | be used as replacement for pre-commit hook.</p></div> |
Junio C Hamano | 4b2a6c1 | 2017-08-22 18:32:37 | [diff] [blame] | 876 | <div class="paragraph"><p>The sample <code>prepare-commit-msg</code> hook that comes with Git removes the |
| 877 | help message found in the commented portion of the commit template.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 878 | </div> |
| 879 | <div class="sect2"> |
| 880 | <h3 id="_commit_msg">commit-msg</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 881 | <div class="paragraph"><p>This hook is invoked by <a href="git-commit.html">git-commit(1)</a> and <a href="git-merge.html">git-merge(1)</a>, and can be |
Junio C Hamano | ef75f37 | 2017-09-29 04:22:33 | [diff] [blame] | 882 | bypassed with the <code>--no-verify</code> option. It takes a single parameter, |
| 883 | the name of the file that holds the proposed commit log message. |
| 884 | Exiting with a non-zero status causes the command to abort.</p></div> |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 885 | <div class="paragraph"><p>The hook is allowed to edit the message file in place, and can be used |
| 886 | to normalize the message into some project standard format. It |
| 887 | can also be used to refuse the commit after inspecting the message |
| 888 | file.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 889 | <div class="paragraph"><p>The default <em>commit-msg</em> hook, when enabled, detects duplicate |
Junio C Hamano | df3d3cd | 2020-11-02 22:05:05 | [diff] [blame] | 890 | <code>Signed-off-by</code> trailers, and aborts the commit if one is found.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 891 | </div> |
| 892 | <div class="sect2"> |
| 893 | <h3 id="_post_commit">post-commit</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 894 | <div class="paragraph"><p>This hook is invoked by <a href="git-commit.html">git-commit(1)</a>. It takes no parameters, and is |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 895 | invoked after a commit is made.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 896 | <div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 897 | the outcome of <code>git commit</code>.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 898 | </div> |
| 899 | <div class="sect2"> |
| 900 | <h3 id="_pre_rebase">pre-rebase</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 901 | <div class="paragraph"><p>This hook is called by <a href="git-rebase.html">git-rebase(1)</a> and can be used to prevent a |
Junio C Hamano | 947ab82 | 2013-03-19 23:07:29 | [diff] [blame] | 902 | branch from getting rebased. The hook may be called with one or |
| 903 | two parameters. The first parameter is the upstream from which |
| 904 | the series was forked. The second parameter is the branch being |
| 905 | rebased, and is not set when rebasing the current branch.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 906 | </div> |
| 907 | <div class="sect2"> |
| 908 | <h3 id="_post_checkout">post-checkout</h3> |
Junio C Hamano | c9f11c2 | 2019-07-10 02:54:04 | [diff] [blame] | 909 | <div class="paragraph"><p>This hook is invoked when a <a href="git-checkout.html">git-checkout(1)</a> or |
| 910 | <a href="git-switch.html">git-switch(1)</a> is run after having updated the |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 911 | worktree. The hook is given three parameters: the ref of the previous HEAD, |
| 912 | the ref of the new HEAD (which may or may not have changed), and a flag |
| 913 | indicating whether the checkout was a branch checkout (changing branches, |
| 914 | flag=1) or a file checkout (retrieving a file from the index, flag=0). |
Junio C Hamano | 558abd2 | 2020-09-03 20:22:34 | [diff] [blame] | 915 | This hook cannot affect the outcome of <code>git switch</code> or <code>git checkout</code>, |
| 916 | other than that the hook’s exit status becomes the exit status of |
| 917 | these two commands.</p></div> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 918 | <div class="paragraph"><p>It is also run after <a href="git-clone.html">git-clone(1)</a>, unless the <code>--no-checkout</code> (<code>-n</code>) option is |
Junio C Hamano | 36a5672 | 2009-03-28 08:55:34 | [diff] [blame] | 919 | used. The first parameter given to the hook is the null-ref, the second the |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 920 | ref of the new HEAD and the flag is always 1. Likewise for <code>git worktree add</code> |
| 921 | unless <code>--no-checkout</code> is used.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 922 | <div class="paragraph"><p>This hook can be used to perform repository validity checks, auto-display |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 923 | differences from the previous HEAD if different, or set working dir metadata |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 924 | properties.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 925 | </div> |
| 926 | <div class="sect2"> |
| 927 | <h3 id="_post_merge">post-merge</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 928 | <div class="paragraph"><p>This hook is invoked by <a href="git-merge.html">git-merge(1)</a>, which happens when a <code>git pull</code> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 929 | is done on a local repository. The hook takes a single parameter, a status |
| 930 | flag specifying whether or not the merge being done was a squash merge. |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 931 | This hook cannot affect the outcome of <code>git merge</code> and is not executed, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 932 | if the merge failed due to conflicts.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 933 | <div class="paragraph"><p>This hook can be used in conjunction with a corresponding pre-commit hook to |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 934 | save and restore any form of metadata associated with the working tree |
Junio C Hamano | fb5ffde | 2014-11-04 22:38:56 | [diff] [blame] | 935 | (e.g.: permissions/ownership, ACLS, etc). See contrib/hooks/setgitperms.perl |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 936 | for an example of how to do this.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 937 | </div> |
| 938 | <div class="sect2"> |
Junio C Hamano | 36d5229 | 2013-01-25 21:32:36 | [diff] [blame] | 939 | <h3 id="_pre_push">pre-push</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 940 | <div class="paragraph"><p>This hook is called by <a href="git-push.html">git-push(1)</a> and can be used to prevent |
| 941 | a push from taking place. The hook is called with two parameters |
| 942 | which provide the name and location of the destination remote, if a |
| 943 | named remote is not being used both values will be the same.</p></div> |
Junio C Hamano | 36d5229 | 2013-01-25 21:32:36 | [diff] [blame] | 944 | <div class="paragraph"><p>Information about what is to be pushed is provided on the hook’s standard |
| 945 | input with lines of the form:</p></div> |
| 946 | <div class="literalblock"> |
| 947 | <div class="content"> |
Junio C Hamano | 458281a | 2021-03-22 21:20:26 | [diff] [blame] | 948 | <pre><code><local ref> SP <local object name> SP <remote ref> SP <remote object name> LF</code></pre> |
Junio C Hamano | 36d5229 | 2013-01-25 21:32:36 | [diff] [blame] | 949 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 950 | <div class="paragraph"><p>For instance, if the command <code>git push origin master:foreign</code> were run the |
Junio C Hamano | 36d5229 | 2013-01-25 21:32:36 | [diff] [blame] | 951 | hook would receive a line like the following:</p></div> |
| 952 | <div class="literalblock"> |
| 953 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 954 | <pre><code>refs/heads/master 67890 refs/heads/foreign 12345</code></pre> |
Junio C Hamano | 36d5229 | 2013-01-25 21:32:36 | [diff] [blame] | 955 | </div></div> |
Junio C Hamano | 458281a | 2021-03-22 21:20:26 | [diff] [blame] | 956 | <div class="paragraph"><p>although the full object name would be supplied. If the foreign ref does not |
| 957 | yet exist the <code><remote object name></code> will be the all-zeroes object name. If a |
| 958 | ref is to be deleted, the <code><local ref></code> will be supplied as <code>(delete)</code> and the |
| 959 | <code><local object name></code> will be the all-zeroes object name. If the local commit |
| 960 | was specified by something other than a name which could be expanded (such as |
| 961 | <code>HEAD~</code>, or an object name) it will be supplied as it was originally given.</p></div> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 962 | <div class="paragraph"><p>If this hook exits with a non-zero status, <code>git push</code> will abort without |
Junio C Hamano | 36d5229 | 2013-01-25 21:32:36 | [diff] [blame] | 963 | pushing anything. Information about why the push is rejected may be sent |
| 964 | to the user by writing to standard error.</p></div> |
| 965 | </div> |
| 966 | <div class="sect2"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 967 | <h3 id="pre-receive">pre-receive</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 968 | <div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to |
| 969 | <code>git push</code> and updates reference(s) in its repository. |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 970 | Just before starting to update refs on the remote repository, the |
| 971 | pre-receive hook is invoked. Its exit status determines the success |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 972 | or failure of the update.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 973 | <div class="paragraph"><p>This hook executes once for the receive operation. It takes no |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 974 | arguments, but for each ref to be updated it receives on standard |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 975 | input a line of the format:</p></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 976 | <div class="literalblock"> |
| 977 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 978 | <pre><code><old-value> SP <new-value> SP <ref-name> LF</code></pre> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 979 | </div></div> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 980 | <div class="paragraph"><p>where <code><old-value></code> is the old object name stored in the ref, |
| 981 | <code><new-value></code> is the new object name to be stored in the ref and |
| 982 | <code><ref-name></code> is the full name of the ref. |
Junio C Hamano | 458281a | 2021-03-22 21:20:26 | [diff] [blame] | 983 | When creating a new ref, <code><old-value></code> is the all-zeroes object name.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 984 | <div class="paragraph"><p>If the hook exits with non-zero status, none of the refs will be |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 985 | updated. If the hook exits with zero, updating of individual refs can |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 986 | still be prevented by the <a href="#update"><em>update</em></a> hook.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 987 | <div class="paragraph"><p>Both standard output and standard error output are forwarded to |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 988 | <code>git send-pack</code> on the other end, so you can simply <code>echo</code> messages |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 989 | for the user.</p></div> |
Junio C Hamano | e48a113 | 2016-08-03 22:40:21 | [diff] [blame] | 990 | <div class="paragraph"><p>The number of push options given on the command line of |
| 991 | <code>git push --push-option=...</code> can be read from the environment |
| 992 | variable <code>GIT_PUSH_OPTION_COUNT</code>, and the options themselves are |
| 993 | found in <code>GIT_PUSH_OPTION_0</code>, <code>GIT_PUSH_OPTION_1</code>,… |
| 994 | If it is negotiated to not use the push options phase, the |
| 995 | environment variables will not be set. If the client selects |
| 996 | to use push options, but doesn’t transmit any, the count variable |
| 997 | will be set to zero, <code>GIT_PUSH_OPTION_COUNT=0</code>.</p></div> |
Junio C Hamano | e25cc81 | 2017-04-24 06:17:43 | [diff] [blame] | 998 | <div class="paragraph"><p>See the section on "Quarantine Environment" in |
| 999 | <a href="git-receive-pack.html">git-receive-pack(1)</a> for some caveats.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1000 | </div> |
| 1001 | <div class="sect2"> |
| 1002 | <h3 id="update">update</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1003 | <div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to |
| 1004 | <code>git push</code> and updates reference(s) in its repository. |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1005 | Just before updating the ref on the remote repository, the update hook |
| 1006 | is invoked. Its exit status determines the success or failure of |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1007 | the ref update.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1008 | <div class="paragraph"><p>The hook executes once for each ref to be updated, and takes |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1009 | three parameters:</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1010 | <div class="ulist"><ul> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1011 | <li> |
| 1012 | <p> |
| 1013 | the name of the ref being updated, |
| 1014 | </p> |
| 1015 | </li> |
| 1016 | <li> |
| 1017 | <p> |
| 1018 | the old object name stored in the ref, |
| 1019 | </p> |
| 1020 | </li> |
| 1021 | <li> |
| 1022 | <p> |
Junio C Hamano | 826f5c4 | 2014-02-07 20:33:30 | [diff] [blame] | 1023 | and the new object name to be stored in the ref. |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1024 | </p> |
| 1025 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1026 | </ul></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1027 | <div class="paragraph"><p>A zero exit from the update hook allows the ref to be updated. |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1028 | Exiting with a non-zero status prevents <code>git receive-pack</code> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1029 | from updating that ref.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1030 | <div class="paragraph"><p>This hook can be used to prevent <em>forced</em> update on certain refs by |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1031 | making sure that the object name is a commit object that is a |
| 1032 | descendant of the commit object named by the old object name. |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 1033 | That is, to enforce a "fast-forward only" policy.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1034 | <div class="paragraph"><p>It could also be used to log the old..new status. However, it |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1035 | does not know the entire set of branches, so it would end up |
| 1036 | firing one e-mail per ref when used naively, though. The |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1037 | <a href="#post-receive"><em>post-receive</em></a> hook is more suited to that.</p></div> |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 1038 | <div class="paragraph"><p>In an environment that restricts the users' access only to git |
| 1039 | commands over the wire, this hook can be used to implement access |
| 1040 | control without relying on filesystem ownership and group |
| 1041 | membership. See <a href="git-shell.html">git-shell(1)</a> for how you might use the login |
| 1042 | shell to restrict the user’s access to only git commands.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1043 | <div class="paragraph"><p>Both standard output and standard error output are forwarded to |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1044 | <code>git send-pack</code> on the other end, so you can simply <code>echo</code> messages |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1045 | for the user.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1046 | <div class="paragraph"><p>The default <em>update</em> hook, when enabled—and with |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1047 | <code>hooks.allowunannotated</code> config option unset or set to false—prevents |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1048 | unannotated tags to be pushed.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1049 | </div> |
| 1050 | <div class="sect2"> |
Junio C Hamano | c562f6d | 2020-09-25 22:50:12 | [diff] [blame] | 1051 | <h3 id="proc-receive">proc-receive</h3> |
| 1052 | <div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a>. If the server has |
| 1053 | set the multi-valued config variable <code>receive.procReceiveRefs</code>, and the |
| 1054 | commands sent to <em>receive-pack</em> have matching reference names, these |
| 1055 | commands will be executed by this hook, instead of by the internal |
| 1056 | <code>execute_commands()</code> function. This hook is responsible for updating |
| 1057 | the relevant references and reporting the results back to <em>receive-pack</em>.</p></div> |
| 1058 | <div class="paragraph"><p>This hook executes once for the receive operation. It takes no |
| 1059 | arguments, but uses a pkt-line format protocol to communicate with |
| 1060 | <em>receive-pack</em> to read commands, push-options and send results. In the |
| 1061 | following example for the protocol, the letter <em>S</em> stands for |
| 1062 | <em>receive-pack</em> and the letter <em>H</em> stands for this hook.</p></div> |
| 1063 | <div class="literalblock"> |
| 1064 | <div class="content"> |
| 1065 | <pre><code># Version and features negotiation. |
| 1066 | S: PKT-LINE(version=1\0push-options atomic...) |
| 1067 | S: flush-pkt |
| 1068 | H: PKT-LINE(version=1\0push-options...) |
| 1069 | H: flush-pkt</code></pre> |
| 1070 | </div></div> |
| 1071 | <div class="literalblock"> |
| 1072 | <div class="content"> |
| 1073 | <pre><code># Send commands from server to the hook. |
| 1074 | S: PKT-LINE(<old-oid> <new-oid> <ref>) |
| 1075 | S: ... ... |
| 1076 | S: flush-pkt |
| 1077 | # Send push-options only if the 'push-options' feature is enabled. |
| 1078 | S: PKT-LINE(push-option) |
| 1079 | S: ... ... |
| 1080 | S: flush-pkt</code></pre> |
| 1081 | </div></div> |
| 1082 | <div class="literalblock"> |
| 1083 | <div class="content"> |
| 1084 | <pre><code># Receive result from the hook. |
| 1085 | # OK, run this command successfully. |
| 1086 | H: PKT-LINE(ok <ref>) |
| 1087 | # NO, I reject it. |
| 1088 | H: PKT-LINE(ng <ref> <reason>) |
| 1089 | # Fall through, let 'receive-pack' to execute it. |
| 1090 | H: PKT-LINE(ok <ref>) |
| 1091 | H: PKT-LINE(option fall-through) |
| 1092 | # OK, but has an alternate reference. The alternate reference name |
| 1093 | # and other status can be given in option directives. |
| 1094 | H: PKT-LINE(ok <ref>) |
| 1095 | H: PKT-LINE(option refname <refname>) |
| 1096 | H: PKT-LINE(option old-oid <old-oid>) |
| 1097 | H: PKT-LINE(option new-oid <new-oid>) |
| 1098 | H: PKT-LINE(option forced-update) |
| 1099 | H: ... ... |
| 1100 | H: flush-pkt</code></pre> |
| 1101 | </div></div> |
| 1102 | <div class="paragraph"><p>Each command for the <em>proc-receive</em> hook may point to a pseudo-reference |
| 1103 | and always has a zero-old as its old-oid, while the <em>proc-receive</em> hook |
| 1104 | may update an alternate reference and the alternate reference may exist |
| 1105 | already with a non-zero old-oid. For this case, this hook will use |
| 1106 | "option" directives to report extended attributes for the reference given |
| 1107 | by the leading "ok" directive.</p></div> |
| 1108 | <div class="paragraph"><p>The report of the commands of this hook should have the same order as |
| 1109 | the input. The exit status of the <em>proc-receive</em> hook only determines |
| 1110 | the success or failure of the group of commands sent to it, unless |
| 1111 | atomic push is in use.</p></div> |
| 1112 | </div> |
| 1113 | <div class="sect2"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1114 | <h3 id="post-receive">post-receive</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1115 | <div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to |
| 1116 | <code>git push</code> and updates reference(s) in its repository. |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1117 | It executes on the remote repository once after all the refs have |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1118 | been updated.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1119 | <div class="paragraph"><p>This hook executes once for the receive operation. It takes no |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1120 | arguments, but gets the same information as the |
| 1121 | <a href="#pre-receive"><em>pre-receive</em></a> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1122 | hook does on its standard input.</p></div> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1123 | <div class="paragraph"><p>This hook does not affect the outcome of <code>git receive-pack</code>, as it |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1124 | is called after the real work is done.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1125 | <div class="paragraph"><p>This supersedes the <a href="#post-update"><em>post-update</em></a> hook in that it gets |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1126 | both old and new values of all the refs in addition to their |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1127 | names.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1128 | <div class="paragraph"><p>Both standard output and standard error output are forwarded to |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1129 | <code>git send-pack</code> on the other end, so you can simply <code>echo</code> messages |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1130 | for the user.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1131 | <div class="paragraph"><p>The default <em>post-receive</em> hook is empty, but there is |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1132 | a sample script <code>post-receive-email</code> provided in the <code>contrib/hooks</code> |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 1133 | directory in Git distribution, which implements sending commit |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1134 | emails.</p></div> |
Junio C Hamano | e48a113 | 2016-08-03 22:40:21 | [diff] [blame] | 1135 | <div class="paragraph"><p>The number of push options given on the command line of |
| 1136 | <code>git push --push-option=...</code> can be read from the environment |
| 1137 | variable <code>GIT_PUSH_OPTION_COUNT</code>, and the options themselves are |
| 1138 | found in <code>GIT_PUSH_OPTION_0</code>, <code>GIT_PUSH_OPTION_1</code>,… |
| 1139 | If it is negotiated to not use the push options phase, the |
| 1140 | environment variables will not be set. If the client selects |
| 1141 | to use push options, but doesn’t transmit any, the count variable |
| 1142 | will be set to zero, <code>GIT_PUSH_OPTION_COUNT=0</code>.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1143 | </div> |
| 1144 | <div class="sect2"> |
| 1145 | <h3 id="post-update">post-update</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1146 | <div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to |
| 1147 | <code>git push</code> and updates reference(s) in its repository. |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1148 | It executes on the remote repository once after all the refs have |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1149 | been updated.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1150 | <div class="paragraph"><p>It takes a variable number of parameters, each of which is the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1151 | name of ref that was actually updated.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1152 | <div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1153 | the outcome of <code>git receive-pack</code>.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1154 | <div class="paragraph"><p>The <em>post-update</em> hook can tell what are the heads that were pushed, |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1155 | but it does not know what their original and updated values are, |
| 1156 | so it is a poor place to do log old..new. The |
| 1157 | <a href="#post-receive"><em>post-receive</em></a> hook does get both original and |
| 1158 | updated values of the refs. You might consider it instead if you need |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1159 | them.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1160 | <div class="paragraph"><p>When enabled, the default <em>post-update</em> hook runs |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1161 | <code>git update-server-info</code> to keep the information used by dumb |
Junio C Hamano | 88bf571 | 2017-09-10 08:39:23 | [diff] [blame] | 1162 | transports (e.g., HTTP) up to date. If you are publishing |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 1163 | a Git repository that is accessible via HTTP, you should |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1164 | probably enable this hook.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1165 | <div class="paragraph"><p>Both standard output and standard error output are forwarded to |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1166 | <code>git send-pack</code> on the other end, so you can simply <code>echo</code> messages |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1167 | for the user.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1168 | </div> |
| 1169 | <div class="sect2"> |
Junio C Hamano | c93f321 | 2020-07-24 23:16:19 | [diff] [blame] | 1170 | <h3 id="_reference_transaction">reference-transaction</h3> |
Junio C Hamano | a891178 | 2020-07-07 05:35:57 | [diff] [blame] | 1171 | <div class="paragraph"><p>This hook is invoked by any Git command that performs reference |
| 1172 | updates. It executes whenever a reference transaction is prepared, |
Junio C Hamano | 458281a | 2021-03-22 21:20:26 | [diff] [blame] | 1173 | committed or aborted and may thus get called multiple times. The hook |
| 1174 | does not cover symbolic references (but that may change in the future).</p></div> |
Junio C Hamano | a891178 | 2020-07-07 05:35:57 | [diff] [blame] | 1175 | <div class="paragraph"><p>The hook takes exactly one argument, which is the current state the |
| 1176 | given reference transaction is in:</p></div> |
| 1177 | <div class="ulist"><ul> |
| 1178 | <li> |
| 1179 | <p> |
| 1180 | "prepared": All reference updates have been queued to the |
| 1181 | transaction and references were locked on disk. |
| 1182 | </p> |
| 1183 | </li> |
| 1184 | <li> |
| 1185 | <p> |
| 1186 | "committed": The reference transaction was committed and all |
| 1187 | references now have their respective new value. |
| 1188 | </p> |
| 1189 | </li> |
| 1190 | <li> |
| 1191 | <p> |
| 1192 | "aborted": The reference transaction was aborted, no changes |
| 1193 | were performed and the locks have been released. |
| 1194 | </p> |
| 1195 | </li> |
| 1196 | </ul></div> |
| 1197 | <div class="paragraph"><p>For each reference update that was added to the transaction, the hook |
| 1198 | receives on standard input a line of the format:</p></div> |
| 1199 | <div class="literalblock"> |
| 1200 | <div class="content"> |
| 1201 | <pre><code><old-value> SP <new-value> SP <ref-name> LF</code></pre> |
| 1202 | </div></div> |
Junio C Hamano | 458281a | 2021-03-22 21:20:26 | [diff] [blame] | 1203 | <div class="paragraph"><p>where <code><old-value></code> is the old object name passed into the reference |
| 1204 | transaction, <code><new-value></code> is the new object name to be stored in the |
| 1205 | ref and <code><ref-name></code> is the full name of the ref. When force updating |
| 1206 | the reference regardless of its current value or when the reference is |
| 1207 | to be created anew, <code><old-value></code> is the all-zeroes object name. To |
| 1208 | distinguish these cases, you can inspect the current value of |
| 1209 | <code><ref-name></code> via <code>git rev-parse</code>.</p></div> |
Junio C Hamano | a891178 | 2020-07-07 05:35:57 | [diff] [blame] | 1210 | <div class="paragraph"><p>The exit status of the hook is ignored for any state except for the |
| 1211 | "prepared" state. In the "prepared" state, a non-zero exit status will |
| 1212 | cause the transaction to be aborted. The hook will not be called with |
| 1213 | "aborted" state in that case.</p></div> |
| 1214 | </div> |
| 1215 | <div class="sect2"> |
Junio C Hamano | 6bb32e6 | 2015-02-17 22:11:26 | [diff] [blame] | 1216 | <h3 id="_push_to_checkout">push-to-checkout</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1217 | <div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to |
| 1218 | <code>git push</code> and updates reference(s) in its repository, and when |
Junio C Hamano | 6bb32e6 | 2015-02-17 22:11:26 | [diff] [blame] | 1219 | the push tries to update the branch that is currently checked out |
| 1220 | and the <code>receive.denyCurrentBranch</code> configuration variable is set to |
| 1221 | <code>updateInstead</code>. Such a push by default is refused if the working |
| 1222 | tree and the index of the remote repository has any difference from |
| 1223 | the currently checked out commit; when both the working tree and the |
| 1224 | index match the current commit, they are updated to match the newly |
| 1225 | pushed tip of the branch. This hook is to be used to override the |
| 1226 | default behaviour.</p></div> |
| 1227 | <div class="paragraph"><p>The hook receives the commit with which the tip of the current |
| 1228 | branch is going to be updated. It can exit with a non-zero status |
| 1229 | to refuse the push (when it does so, it must not modify the index or |
| 1230 | the working tree). Or it can make any necessary changes to the |
| 1231 | working tree and to the index to bring them to the desired state |
| 1232 | when the tip of the current branch is updated to the new commit, and |
| 1233 | exit with a zero status.</p></div> |
| 1234 | <div class="paragraph"><p>For example, the hook can simply run <code>git read-tree -u -m HEAD "$1"</code> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1235 | in order to emulate <code>git fetch</code> that is run in the reverse direction |
| 1236 | with <code>git push</code>, as the two-tree form of <code>git read-tree -u -m</code> is |
Junio C Hamano | c9f11c2 | 2019-07-10 02:54:04 | [diff] [blame] | 1237 | essentially the same as <code>git switch</code> or <code>git checkout</code> |
| 1238 | that switches branches while |
Junio C Hamano | 6bb32e6 | 2015-02-17 22:11:26 | [diff] [blame] | 1239 | keeping the local changes in the working tree that do not interfere |
| 1240 | with the difference between the branches.</p></div> |
| 1241 | </div> |
| 1242 | <div class="sect2"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1243 | <h3 id="_pre_auto_gc">pre-auto-gc</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1244 | <div class="paragraph"><p>This hook is invoked by <code>git gc --auto</code> (see <a href="git-gc.html">git-gc(1)</a>). It |
| 1245 | takes no parameter, and exiting with non-zero status from this script |
| 1246 | causes the <code>git gc --auto</code> to abort.</p></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1247 | </div> |
| 1248 | <div class="sect2"> |
| 1249 | <h3 id="_post_rewrite">post-rewrite</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1250 | <div class="paragraph"><p>This hook is invoked by commands that rewrite commits |
| 1251 | (<a href="git-commit.html">git-commit(1)</a> when called with <code>--amend</code> and |
Junio C Hamano | a885831 | 2019-09-30 05:07:45 | [diff] [blame] | 1252 | <a href="git-rebase.html">git-rebase(1)</a>; however, full-history (re)writing tools like |
| 1253 | <a href="git-fast-import.html">git-fast-import(1)</a> or |
| 1254 | <a href="https://github.com/newren/git-filter-repo">git-filter-repo</a> typically |
| 1255 | do not call it!). Its first argument denotes the command it was |
| 1256 | invoked by: currently one of <code>amend</code> or <code>rebase</code>. Further |
| 1257 | command-dependent arguments may be passed in the future.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1258 | <div class="paragraph"><p>The hook receives a list of the rewritten commits on stdin, in the |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 1259 | format</p></div> |
| 1260 | <div class="literalblock"> |
| 1261 | <div class="content"> |
Junio C Hamano | 458281a | 2021-03-22 21:20:26 | [diff] [blame] | 1262 | <pre><code><old-object-name> SP <new-object-name> [ SP <extra-info> ] LF</code></pre> |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 1263 | </div></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1264 | <div class="paragraph"><p>The <em>extra-info</em> is again command-dependent. If it is empty, the |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 1265 | preceding SP is also omitted. Currently, no commands pass any |
| 1266 | <em>extra-info</em>.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1267 | <div class="paragraph"><p>The hook always runs after the automatic note copying (see |
Junio C Hamano | 96fdfa1 | 2016-03-21 20:52:39 | [diff] [blame] | 1268 | "notes.rewrite.<command>" in <a href="git-config.html">git-config(1)</a>) has happened, and |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 1269 | thus has access to these notes.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1270 | <div class="paragraph"><p>The following command-specific comments apply:</p></div> |
| 1271 | <div class="dlist"><dl> |
| 1272 | <dt class="hdlist1"> |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 1273 | rebase |
| 1274 | </dt> |
| 1275 | <dd> |
| 1276 | <p> |
| 1277 | For the <em>squash</em> and <em>fixup</em> operation, all commits that were |
| 1278 | squashed are listed as being rewritten to the squashed commit. |
| 1279 | This means that there will be several lines sharing the same |
Junio C Hamano | 458281a | 2021-03-22 21:20:26 | [diff] [blame] | 1280 | <em>new-object-name</em>. |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 1281 | </p> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 1282 | <div class="paragraph"><p>The commits are guaranteed to be listed in the order that they were |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 1283 | processed by rebase.</p></div> |
| 1284 | </dd> |
| 1285 | </dl></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1286 | </div> |
Junio C Hamano | d88ba73 | 2017-05-30 04:14:20 | [diff] [blame] | 1287 | <div class="sect2"> |
| 1288 | <h3 id="_sendemail_validate">sendemail-validate</h3> |
Junio C Hamano | 7ab2d20 | 2023-05-10 18:59:24 | [diff] [blame^] | 1289 | <div class="paragraph"><p>This hook is invoked by <a href="git-send-email.html">git-send-email(1)</a>.</p></div> |
| 1290 | <div class="paragraph"><p>It takes these command line arguments. They are, |
| 1291 | 1. the name of the file which holds the contents of the email to be sent. |
| 1292 | 2. The name of the file which holds the SMTP headers of the email.</p></div> |
| 1293 | <div class="paragraph"><p>The SMTP headers are passed in the exact same way as they are passed to the |
| 1294 | user’s Mail Transport Agent (MTA). In effect, the email given to the user’s |
| 1295 | MTA, is the contents of $2 followed by the contents of $1.</p></div> |
| 1296 | <div class="paragraph"><p>An example of a few common headers is shown below. Take notice of the |
| 1297 | capitalization and multi-line tab structure.</p></div> |
| 1298 | <div class="literalblock"> |
| 1299 | <div class="content"> |
| 1300 | <pre><code>From: Example <from@example.com> |
| 1301 | To: to@example.com |
| 1302 | Cc: cc@example.com, |
| 1303 | A <author@example.com>, |
| 1304 | One <one@example.com>, |
| 1305 | two@example.com |
| 1306 | Subject: PATCH-STRING</code></pre> |
| 1307 | </div></div> |
| 1308 | <div class="paragraph"><p>Exiting with a non-zero status causes <code>git send-email</code> to abort |
| 1309 | before sending any e-mails.</p></div> |
Junio C Hamano | 9f24e83 | 2023-04-25 21:41:32 | [diff] [blame] | 1310 | <div class="paragraph"><p>The following environment variables are set when executing the hook.</p></div> |
| 1311 | <div class="dlist"><dl> |
| 1312 | <dt class="hdlist1"> |
| 1313 | <code>GIT_SENDEMAIL_FILE_COUNTER</code> |
| 1314 | </dt> |
| 1315 | <dd> |
| 1316 | <p> |
| 1317 | A 1-based counter incremented by one for every file holding an e-mail |
| 1318 | to be sent (excluding any FIFOs). This counter does not follow the |
| 1319 | patch series counter scheme. It will always start at 1 and will end at |
| 1320 | GIT_SENDEMAIL_FILE_TOTAL. |
| 1321 | </p> |
| 1322 | </dd> |
| 1323 | <dt class="hdlist1"> |
| 1324 | <code>GIT_SENDEMAIL_FILE_TOTAL</code> |
| 1325 | </dt> |
| 1326 | <dd> |
| 1327 | <p> |
| 1328 | The total number of files that will be sent (excluding any FIFOs). This |
| 1329 | counter does not follow the patch series counter scheme. It will always |
| 1330 | be equal to the number of files being sent, whether there is a cover |
| 1331 | letter or not. |
| 1332 | </p> |
| 1333 | </dd> |
| 1334 | </dl></div> |
| 1335 | <div class="paragraph"><p>These variables may for instance be used to validate patch series.</p></div> |
| 1336 | <div class="paragraph"><p>The sample <code>sendemail-validate</code> hook that comes with Git checks that all sent |
| 1337 | patches (excluding the cover letter) can be applied on top of the upstream |
| 1338 | repository default branch without conflicts. Some placeholders are left for |
| 1339 | additional validation steps to be performed after all patches of a given series |
| 1340 | have been applied.</p></div> |
Junio C Hamano | d88ba73 | 2017-05-30 04:14:20 | [diff] [blame] | 1341 | </div> |
Junio C Hamano | d710560 | 2017-11-21 05:32:50 | [diff] [blame] | 1342 | <div class="sect2"> |
| 1343 | <h3 id="_fsmonitor_watchman">fsmonitor-watchman</h3> |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1344 | <div class="paragraph"><p>This hook is invoked when the configuration option <code>core.fsmonitor</code> is |
Junio C Hamano | fc6646b | 2020-02-14 23:35:16 | [diff] [blame] | 1345 | set to <code>.git/hooks/fsmonitor-watchman</code> or <code>.git/hooks/fsmonitor-watchmanv2</code> |
| 1346 | depending on the version of the hook to use.</p></div> |
| 1347 | <div class="paragraph"><p>Version 1 takes two arguments, a version (1) and the time in elapsed |
| 1348 | nanoseconds since midnight, January 1, 1970.</p></div> |
| 1349 | <div class="paragraph"><p>Version 2 takes two arguments, a version (2) and a token that is used |
| 1350 | for identifying changes since the token. For watchman this would be |
| 1351 | a clock id. This version must output to stdout the new token followed |
| 1352 | by a NUL before the list of files.</p></div> |
Junio C Hamano | d710560 | 2017-11-21 05:32:50 | [diff] [blame] | 1353 | <div class="paragraph"><p>The hook should output to stdout the list of all files in the working |
| 1354 | directory that may have changed since the requested time. The logic |
| 1355 | should be inclusive so that it does not miss any potential changes. |
| 1356 | The paths should be relative to the root of the working directory |
| 1357 | and be separated by a single NUL.</p></div> |
| 1358 | <div class="paragraph"><p>It is OK to include files which have not actually changed. All changes |
| 1359 | including newly-created and deleted files should be included. When |
| 1360 | files are renamed, both the old and the new name should be included.</p></div> |
| 1361 | <div class="paragraph"><p>Git will limit what files it checks for changes as well as which |
| 1362 | directories are checked for untracked files based on the path names |
| 1363 | given.</p></div> |
| 1364 | <div class="paragraph"><p>An optimized way to tell git "all files have changed" is to return |
Junio C Hamano | b9d9d90 | 2018-05-23 07:07:42 | [diff] [blame] | 1365 | the filename <code>/</code>.</p></div> |
Junio C Hamano | d710560 | 2017-11-21 05:32:50 | [diff] [blame] | 1366 | <div class="paragraph"><p>The exit status determines whether git will use the data from the |
| 1367 | hook to limit its search. On error, it will fall back to verifying |
| 1368 | all files and folders.</p></div> |
| 1369 | </div> |
Junio C Hamano | bfd91f4 | 2018-08-17 22:21:16 | [diff] [blame] | 1370 | <div class="sect2"> |
Junio C Hamano | 67bf224 | 2020-04-22 21:41:44 | [diff] [blame] | 1371 | <h3 id="_p4_changelist">p4-changelist</h3> |
| 1372 | <div class="paragraph"><p>This hook is invoked by <code>git-p4 submit</code>.</p></div> |
| 1373 | <div class="paragraph"><p>The <code>p4-changelist</code> hook is executed after the changelist |
| 1374 | message has been edited by the user. It can be bypassed with the |
| 1375 | <code>--no-verify</code> option. It takes a single parameter, the name |
| 1376 | of the file that holds the proposed changelist text. Exiting |
| 1377 | with a non-zero status causes the command to abort.</p></div> |
| 1378 | <div class="paragraph"><p>The hook is allowed to edit the changelist file and can be used |
| 1379 | to normalize the text into some project standard format. It can |
| 1380 | also be used to refuse the Submit after inspect the message file.</p></div> |
| 1381 | <div class="paragraph"><p>Run <code>git-p4 submit --help</code> for details.</p></div> |
| 1382 | </div> |
| 1383 | <div class="sect2"> |
| 1384 | <h3 id="_p4_prepare_changelist">p4-prepare-changelist</h3> |
| 1385 | <div class="paragraph"><p>This hook is invoked by <code>git-p4 submit</code>.</p></div> |
| 1386 | <div class="paragraph"><p>The <code>p4-prepare-changelist</code> hook is executed right after preparing |
| 1387 | the default changelist message and before the editor is started. |
| 1388 | It takes one parameter, the name of the file that contains the |
| 1389 | changelist text. Exiting with a non-zero status from the script |
| 1390 | will abort the process.</p></div> |
| 1391 | <div class="paragraph"><p>The purpose of the hook is to edit the message file in place, |
Junio C Hamano | d5cfc8f | 2021-01-16 00:14:51 | [diff] [blame] | 1392 | and it is not suppressed by the <code>--no-verify</code> option. This hook |
Junio C Hamano | 67bf224 | 2020-04-22 21:41:44 | [diff] [blame] | 1393 | is called even if <code>--prepare-p4-only</code> is set.</p></div> |
| 1394 | <div class="paragraph"><p>Run <code>git-p4 submit --help</code> for details.</p></div> |
| 1395 | </div> |
| 1396 | <div class="sect2"> |
| 1397 | <h3 id="_p4_post_changelist">p4-post-changelist</h3> |
| 1398 | <div class="paragraph"><p>This hook is invoked by <code>git-p4 submit</code>.</p></div> |
| 1399 | <div class="paragraph"><p>The <code>p4-post-changelist</code> hook is invoked after the submit has |
Junio C Hamano | ee43d18 | 2020-11-11 22:10:41 | [diff] [blame] | 1400 | successfully occurred in P4. It takes no parameters and is meant |
Junio C Hamano | 67bf224 | 2020-04-22 21:41:44 | [diff] [blame] | 1401 | primarily for notification and cannot affect the outcome of the |
| 1402 | git p4 submit action.</p></div> |
| 1403 | <div class="paragraph"><p>Run <code>git-p4 submit --help</code> for details.</p></div> |
| 1404 | </div> |
| 1405 | <div class="sect2"> |
Junio C Hamano | bfd91f4 | 2018-08-17 22:21:16 | [diff] [blame] | 1406 | <h3 id="_p4_pre_submit">p4-pre-submit</h3> |
| 1407 | <div class="paragraph"><p>This hook is invoked by <code>git-p4 submit</code>. It takes no parameters and nothing |
| 1408 | from standard input. Exiting with non-zero status from this script prevent |
Junio C Hamano | 67bf224 | 2020-04-22 21:41:44 | [diff] [blame] | 1409 | <code>git-p4 submit</code> from launching. It can be bypassed with the <code>--no-verify</code> |
| 1410 | command line option. Run <code>git-p4 submit --help</code> for details.</p></div> |
Junio C Hamano | bfd91f4 | 2018-08-17 22:21:16 | [diff] [blame] | 1411 | </div> |
Junio C Hamano | 2ba1471 | 2019-04-25 10:12:27 | [diff] [blame] | 1412 | <div class="sect2"> |
| 1413 | <h3 id="_post_index_change">post-index-change</h3> |
| 1414 | <div class="paragraph"><p>This hook is invoked when the index is written in read-cache.c |
| 1415 | do_write_locked_index.</p></div> |
| 1416 | <div class="paragraph"><p>The first parameter passed to the hook is the indicator for the |
| 1417 | working directory being updated. "1" meaning working directory |
| 1418 | was updated or "0" when the working directory was not updated.</p></div> |
| 1419 | <div class="paragraph"><p>The second parameter passed to the hook is the indicator for whether |
| 1420 | or not the index was updated and the skip-worktree bit could have |
| 1421 | changed. "1" meaning skip-worktree bits could have been updated |
| 1422 | and "0" meaning they were not.</p></div> |
| 1423 | <div class="paragraph"><p>Only one parameter should be set to "1" when the hook runs. The hook |
| 1424 | running passing "1", "1" should not be possible.</p></div> |
| 1425 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1426 | </div> |
| 1427 | </div> |
| 1428 | <div class="sect1"> |
Junio C Hamano | f1fc6ca | 2022-02-17 01:32:33 | [diff] [blame] | 1429 | <h2 id="_see_also">SEE ALSO</h2> |
| 1430 | <div class="sectionbody"> |
| 1431 | <div class="paragraph"><p><a href="git-hook.html">git-hook(1)</a></p></div> |
| 1432 | </div> |
| 1433 | </div> |
| 1434 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1435 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1436 | <div class="sectionbody"> |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1437 | <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1438 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 1439 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1440 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 1441 | <div id="footnotes"><hr /></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1442 | <div id="footer"> |
| 1443 | <div id="footer-text"> |
Junio C Hamano | 2ef0ba3 | 2018-01-26 23:13:53 | [diff] [blame] | 1444 | Last updated |
Junio C Hamano | 7ab2d20 | 2023-05-10 18:59:24 | [diff] [blame^] | 1445 | 2023-05-10 11:57:07 PDT |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1446 | </div> |
| 1447 | </div> |
| 1448 | </body> |
| 1449 | </html> |