Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 2 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 7.0.2" /> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | <style type="text/css"> |
| 8 | /* Debug borders */ |
| 9 | p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { |
| 10 | /* |
| 11 | border: 1px solid red; |
| 12 | */ |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | margin: 1em 5% 1em 5%; |
| 17 | } |
| 18 | |
| 19 | a { color: blue; } |
| 20 | a:visited { color: fuchsia; } |
| 21 | |
| 22 | em { |
| 23 | font-style: italic; |
| 24 | } |
| 25 | |
| 26 | strong { |
| 27 | font-weight: bold; |
| 28 | } |
| 29 | |
| 30 | tt { |
| 31 | color: navy; |
| 32 | } |
| 33 | |
| 34 | h1, h2, h3, h4, h5, h6 { |
| 35 | color: #527bbd; |
| 36 | font-family: sans-serif; |
| 37 | margin-top: 1.2em; |
| 38 | margin-bottom: 0.5em; |
| 39 | line-height: 1.3; |
| 40 | } |
| 41 | |
| 42 | h1 { |
| 43 | border-bottom: 2px solid silver; |
| 44 | } |
| 45 | h2 { |
| 46 | border-bottom: 2px solid silver; |
| 47 | padding-top: 0.5em; |
| 48 | } |
| 49 | |
| 50 | div.sectionbody { |
| 51 | font-family: serif; |
| 52 | margin-left: 0; |
| 53 | } |
| 54 | |
| 55 | hr { |
| 56 | border: 1px solid silver; |
| 57 | } |
| 58 | |
| 59 | p { |
| 60 | margin-top: 0.5em; |
| 61 | margin-bottom: 0.5em; |
| 62 | } |
| 63 | |
| 64 | pre { |
| 65 | padding: 0; |
| 66 | margin: 0; |
| 67 | } |
| 68 | |
| 69 | span#author { |
| 70 | color: #527bbd; |
| 71 | font-family: sans-serif; |
| 72 | font-weight: bold; |
| 73 | font-size: 1.2em; |
| 74 | } |
| 75 | span#email { |
| 76 | } |
| 77 | span#revision { |
| 78 | font-family: sans-serif; |
| 79 | } |
| 80 | |
| 81 | div#footer { |
| 82 | font-family: sans-serif; |
| 83 | font-size: small; |
| 84 | border-top: 2px solid silver; |
| 85 | padding-top: 0.5em; |
| 86 | margin-top: 4.0em; |
| 87 | } |
| 88 | div#footer-text { |
| 89 | float: left; |
| 90 | padding-bottom: 0.5em; |
| 91 | } |
| 92 | div#footer-badges { |
| 93 | float: right; |
| 94 | padding-bottom: 0.5em; |
| 95 | } |
| 96 | |
| 97 | div#preamble, |
| 98 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 99 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 100 | div.admonitionblock { |
| 101 | margin-right: 10%; |
| 102 | margin-top: 1.5em; |
| 103 | margin-bottom: 1.5em; |
| 104 | } |
| 105 | div.admonitionblock { |
| 106 | margin-top: 2.5em; |
| 107 | margin-bottom: 2.5em; |
| 108 | } |
| 109 | |
| 110 | div.content { /* Block element content. */ |
| 111 | padding: 0; |
| 112 | } |
| 113 | |
| 114 | /* Block element titles. */ |
| 115 | div.title, caption.title { |
| 116 | font-family: sans-serif; |
| 117 | font-weight: bold; |
| 118 | text-align: left; |
| 119 | margin-top: 1.0em; |
| 120 | margin-bottom: 0.5em; |
| 121 | } |
| 122 | div.title + * { |
| 123 | margin-top: 0; |
| 124 | } |
| 125 | |
| 126 | td div.title:first-child { |
| 127 | margin-top: 0.0em; |
| 128 | } |
| 129 | div.content div.title:first-child { |
| 130 | margin-top: 0.0em; |
| 131 | } |
| 132 | div.content + div.title { |
| 133 | margin-top: 0.0em; |
| 134 | } |
| 135 | |
| 136 | div.sidebarblock > div.content { |
| 137 | background: #ffffee; |
| 138 | border: 1px solid silver; |
| 139 | padding: 0.5em; |
| 140 | } |
| 141 | |
| 142 | div.listingblock > div.content { |
| 143 | border: 1px solid silver; |
| 144 | background: #f4f4f4; |
| 145 | padding: 0.5em; |
| 146 | } |
| 147 | |
| 148 | div.quoteblock > div.content { |
| 149 | padding-left: 2.0em; |
| 150 | } |
| 151 | div.quoteblock .attribution { |
| 152 | text-align: right; |
| 153 | } |
| 154 | |
| 155 | div.admonitionblock .icon { |
| 156 | vertical-align: top; |
| 157 | font-size: 1.1em; |
| 158 | font-weight: bold; |
| 159 | text-decoration: underline; |
| 160 | color: #527bbd; |
| 161 | padding-right: 0.5em; |
| 162 | } |
| 163 | div.admonitionblock td.content { |
| 164 | padding-left: 0.5em; |
| 165 | border-left: 2px solid silver; |
| 166 | } |
| 167 | |
| 168 | div.exampleblock > div.content { |
| 169 | border-left: 2px solid silver; |
| 170 | padding: 0.5em; |
| 171 | } |
| 172 | |
| 173 | div.verseblock div.content { |
| 174 | white-space: pre; |
| 175 | } |
| 176 | |
| 177 | div.imageblock div.content { padding-left: 0; } |
| 178 | div.imageblock img { border: 1px solid silver; } |
| 179 | span.image img { border-style: none; } |
| 180 | |
| 181 | dl { |
| 182 | margin-top: 0.8em; |
| 183 | margin-bottom: 0.8em; |
| 184 | } |
| 185 | dt { |
| 186 | margin-top: 0.5em; |
| 187 | margin-bottom: 0; |
| 188 | font-style: italic; |
| 189 | } |
| 190 | dd > *:first-child { |
| 191 | margin-top: 0; |
| 192 | } |
| 193 | |
| 194 | ul, ol { |
| 195 | list-style-position: outside; |
| 196 | } |
| 197 | ol.olist2 { |
| 198 | list-style-type: lower-alpha; |
| 199 | } |
| 200 | |
| 201 | div.tableblock > table { |
| 202 | border-color: #527bbd; |
| 203 | border-width: 3px; |
| 204 | } |
| 205 | thead { |
| 206 | font-family: sans-serif; |
| 207 | font-weight: bold; |
| 208 | } |
| 209 | tfoot { |
| 210 | font-weight: bold; |
| 211 | } |
| 212 | |
| 213 | div.hlist { |
| 214 | margin-top: 0.8em; |
| 215 | margin-bottom: 0.8em; |
| 216 | } |
| 217 | td.hlist1 { |
| 218 | vertical-align: top; |
| 219 | font-style: italic; |
| 220 | padding-right: 0.8em; |
| 221 | } |
| 222 | td.hlist2 { |
| 223 | vertical-align: top; |
| 224 | } |
| 225 | |
| 226 | @media print { |
| 227 | div#footer-badges { display: none; } |
| 228 | } |
| 229 | include::./stylesheets/xhtml11-manpage.css[] |
| 230 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 231 | |
| 232 | div.sidebar-content { |
| 233 | background: #ffffee; |
| 234 | border: 1px solid silver; |
| 235 | padding: 0.5em; |
| 236 | } |
| 237 | div.sidebar-title, div.image-title { |
| 238 | font-family: sans-serif; |
| 239 | font-weight: bold; |
| 240 | margin-top: 0.0em; |
| 241 | margin-bottom: 0.5em; |
| 242 | } |
| 243 | |
| 244 | div.listingblock div.content { |
| 245 | border: 1px solid silver; |
| 246 | background: #f4f4f4; |
| 247 | padding: 0.5em; |
| 248 | } |
| 249 | |
| 250 | div.quoteblock-content { |
| 251 | padding-left: 2.0em; |
| 252 | } |
| 253 | |
| 254 | div.exampleblock-content { |
| 255 | border-left: 2px solid silver; |
| 256 | padding-left: 0.5em; |
| 257 | } |
| 258 | </style> |
| 259 | <title>git-receive-pack(1)</title> |
| 260 | </head> |
| 261 | <body> |
| 262 | <div id="header"> |
| 263 | <h1> |
| 264 | git-receive-pack(1) Manual Page |
| 265 | </h1> |
| 266 | <h2>NAME</h2> |
| 267 | <div class="sectionbody"> |
| 268 | <p>git-receive-pack - |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 269 | Receive what is pushed into the repository |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 270 | </p> |
| 271 | </div> |
| 272 | </div> |
| 273 | <h2>SYNOPSIS</h2> |
| 274 | <div class="sectionbody"> |
| 275 | <p><em>git-receive-pack</em> <directory></p> |
| 276 | </div> |
| 277 | <h2>DESCRIPTION</h2> |
| 278 | <div class="sectionbody"> |
| 279 | <p>Invoked by <em>git-send-pack</em> and updates the repository with the |
| 280 | information fed from the remote end.</p> |
| 281 | <p>This command is usually not invoked directly by the end user. |
| 282 | The UI for the protocol is on the <em>git-send-pack</em> side, and the |
| 283 | program pair is meant to be used to push updates to remote |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 284 | repository. For pull operations, see <em>git-fetch-pack</em>.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 285 | <p>The command allows for creation and fast forwarding of sha1 refs |
| 286 | (heads/tags) on the remote end (strictly speaking, it is the |
| 287 | local end receive-pack runs, but to the user who is sitting at |
| 288 | the send-pack end, it is updating the remote. Confused?)</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 289 | <p>There are other real-world examples of using update and |
| 290 | post-update hooks found in the Documentation/howto directory.</p> |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 291 | <p>git-receive-pack honours the receive.denyNonFastForwards config |
| 292 | option, which tells it if updates to a ref should be denied if they |
| 293 | are not fast-forwards.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 294 | </div> |
| 295 | <h2>OPTIONS</h2> |
| 296 | <div class="sectionbody"> |
| 297 | <dl> |
| 298 | <dt> |
| 299 | <directory> |
| 300 | </dt> |
| 301 | <dd> |
| 302 | <p> |
| 303 | The repository to sync into. |
| 304 | </p> |
| 305 | </dd> |
| 306 | </dl> |
| 307 | </div> |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 308 | <h2>pre-receive Hook</h2> |
| 309 | <div class="sectionbody"> |
| 310 | <p>Before any ref is updated, if $GIT_DIR/hooks/pre-receive file exists |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 311 | and is executable, it will be invoked once with no parameters. The |
| 312 | standard input of the hook will be one line per ref to be updated:</p> |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 313 | <div class="literalblock"> |
| 314 | <div class="content"> |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 315 | <pre><tt>sha1-old SP sha1-new SP refname LF</tt></pre> |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 316 | </div></div> |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 317 | <p>The refname value is relative to $GIT_DIR; e.g. for the master |
| 318 | head this is "refs/heads/master". The two sha1 values before |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 319 | each refname are the object names for the refname before and after |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 320 | the update. Refs to be created will have sha1-old equal to 0{40}, |
| 321 | while refs to be deleted will have sha1-new equal to 0{40}, otherwise |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 322 | sha1-old and sha1-new should be valid objects in the repository.</p> |
| 323 | <p>This hook is called before any refname is updated and before any |
| 324 | fast-forward checks are performed.</p> |
| 325 | <p>If the pre-receive hook exits with a non-zero exit status no updates |
| 326 | will be performed, and the update, post-receive and post-update |
| 327 | hooks will not be invoked either. This can be useful to quickly |
| 328 | bail out if the update is not to be supported.</p> |
| 329 | </div> |
| 330 | <h2>update Hook</h2> |
| 331 | <div class="sectionbody"> |
| 332 | <p>Before each ref is updated, if $GIT_DIR/hooks/update file exists |
| 333 | and is executable, it is invoked once per ref, with three parameters:</p> |
| 334 | <div class="literalblock"> |
| 335 | <div class="content"> |
| 336 | <pre><tt>$GIT_DIR/hooks/update refname sha1-old sha1-new</tt></pre> |
| 337 | </div></div> |
| 338 | <p>The refname parameter is relative to $GIT_DIR; e.g. for the master |
| 339 | head this is "refs/heads/master". The two sha1 arguments are |
| 340 | the object names for the refname before and after the update. |
| 341 | Note that the hook is called before the refname is updated, |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 342 | so either sha1-old is 0{40} (meaning there is no such ref yet), |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 343 | or it should match what is recorded in refname.</p> |
| 344 | <p>The hook should exit with non-zero status if it wants to disallow |
| 345 | updating the named ref. Otherwise it should exit with zero.</p> |
| 346 | <p>Successful execution (a zero exit status) of this hook does not |
| 347 | ensure the ref will actully be updated, it is only a prerequisite. |
| 348 | As such it is not a good idea to send notices (e.g. email) from |
| 349 | this hook. Consider using the post-receive hook instead.</p> |
| 350 | </div> |
| 351 | <h2>post-receive Hook</h2> |
| 352 | <div class="sectionbody"> |
| 353 | <p>After all refs were updated (or attempted to be updated), if any |
| 354 | ref update was successful, and if $GIT_DIR/hooks/post-receive |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 355 | file exists and is executable, it will be invoke once with no |
| 356 | parameters. The standard input of the hook will be one line |
| 357 | for each successfully updated ref:</p> |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 358 | <div class="literalblock"> |
| 359 | <div class="content"> |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 360 | <pre><tt>sha1-old SP sha1-new SP refname LF</tt></pre> |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 361 | </div></div> |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 362 | <p>The refname value is relative to $GIT_DIR; e.g. for the master |
| 363 | head this is "refs/heads/master". The two sha1 values before |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 364 | each refname are the object names for the refname before and after |
| 365 | the update. Refs that were created will have sha1-old equal to |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 366 | 0{40}, while refs that were deleted will have sha1-new equal to |
| 367 | 0{40}, otherwise sha1-old and sha1-new should be valid objects in |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 368 | the repository.</p> |
| 369 | <p>Using this hook, it is easy to generate mails describing the updates |
| 370 | to the repository. This example script sends one mail message per |
| 371 | ref listing the commits pushed to the repository:</p> |
| 372 | <div class="literalblock"> |
| 373 | <div class="content"> |
| 374 | <pre><tt>#!/bin/sh |
| 375 | # mail out commit update information. |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 376 | while read oval nval ref |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 377 | do |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 378 | if expr "$oval" : '0*$' >/dev/null |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 379 | then |
| 380 | echo "Created a new ref, with the following commits:" |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 381 | git-rev-list --pretty "$nval" |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 382 | else |
| 383 | echo "New commits:" |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 384 | git-rev-list --pretty "$nval" "^$oval" |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 385 | fi | |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 386 | mail -s "Changes to ref $ref" commit-list@mydomain |
Junio C Hamano | abcd65d | 2007-03-08 02:43:00 | [diff] [blame] | 387 | done |
| 388 | exit 0</tt></pre> |
| 389 | </div></div> |
| 390 | <p>The exit code from this hook invocation is ignored, however a |
| 391 | non-zero exit code will generate an error message.</p> |
| 392 | <p>Note that it is possible for refname to not have sha1-new when this |
| 393 | hook runs. This can easily occur if another user modifies the ref |
| 394 | after it was updated by receive-pack, but before the hook was able |
| 395 | to evaluate it. It is recommended that hooks rely on sha1-new |
| 396 | rather than the current value of refname.</p> |
| 397 | </div> |
| 398 | <h2>post-update Hook</h2> |
| 399 | <div class="sectionbody"> |
| 400 | <p>After all other processing, if at least one ref was updated, and |
| 401 | if $GIT_DIR/hooks/post-update file exists and is executable, then |
| 402 | post-update will called with the list of refs that have been updated. |
| 403 | This can be used to implement any repository wide cleanup tasks.</p> |
| 404 | <p>The exit code from this hook invocation is ignored; the only thing |
| 405 | left for git-receive-pack to do at that point is to exit itself |
| 406 | anyway.</p> |
| 407 | <p>This hook can be used, for example, to run "git-update-server-info" |
| 408 | if the repository is packed and is served via a dumb transport.</p> |
| 409 | <div class="literalblock"> |
| 410 | <div class="content"> |
| 411 | <pre><tt>#!/bin/sh |
| 412 | exec git-update-server-info</tt></pre> |
| 413 | </div></div> |
| 414 | </div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 415 | <h2>SEE ALSO</h2> |
| 416 | <div class="sectionbody"> |
| 417 | <p><a href="git-send-pack.html">git-send-pack(1)</a></p> |
| 418 | </div> |
| 419 | <h2>Author</h2> |
| 420 | <div class="sectionbody"> |
| 421 | <p>Written by Linus Torvalds <torvalds@osdl.org></p> |
| 422 | </div> |
| 423 | <h2>Documentation</h2> |
| 424 | <div class="sectionbody"> |
| 425 | <p>Documentation by Junio C Hamano.</p> |
| 426 | </div> |
| 427 | <h2>GIT</h2> |
| 428 | <div class="sectionbody"> |
| 429 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 430 | </div> |
| 431 | <div id="footer"> |
| 432 | <div id="footer-text"> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 433 | Last updated 03-Jul-2007 07:03:43 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 434 | </div> |
| 435 | </div> |
| 436 | </body> |
| 437 | </html> |