Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [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 | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.2.5" /> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [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 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 19 | a { |
| 20 | color: blue; |
| 21 | text-decoration: underline; |
| 22 | } |
| 23 | a:visited { |
| 24 | color: fuchsia; |
| 25 | } |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 26 | |
| 27 | em { |
| 28 | font-style: italic; |
| 29 | } |
| 30 | |
| 31 | strong { |
| 32 | font-weight: bold; |
| 33 | } |
| 34 | |
| 35 | tt { |
| 36 | color: navy; |
| 37 | } |
| 38 | |
| 39 | h1, h2, h3, h4, h5, h6 { |
| 40 | color: #527bbd; |
| 41 | font-family: sans-serif; |
| 42 | margin-top: 1.2em; |
| 43 | margin-bottom: 0.5em; |
| 44 | line-height: 1.3; |
| 45 | } |
| 46 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 47 | h1, h2, h3 { |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 48 | border-bottom: 2px solid silver; |
| 49 | } |
| 50 | h2 { |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 51 | padding-top: 0.5em; |
| 52 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 53 | h3 { |
| 54 | float: left; |
| 55 | } |
| 56 | h3 + * { |
| 57 | clear: left; |
| 58 | } |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 59 | |
| 60 | div.sectionbody { |
| 61 | font-family: serif; |
| 62 | margin-left: 0; |
| 63 | } |
| 64 | |
| 65 | hr { |
| 66 | border: 1px solid silver; |
| 67 | } |
| 68 | |
| 69 | p { |
| 70 | margin-top: 0.5em; |
| 71 | margin-bottom: 0.5em; |
| 72 | } |
| 73 | |
| 74 | pre { |
| 75 | padding: 0; |
| 76 | margin: 0; |
| 77 | } |
| 78 | |
| 79 | span#author { |
| 80 | color: #527bbd; |
| 81 | font-family: sans-serif; |
| 82 | font-weight: bold; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 83 | font-size: 1.1em; |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 84 | } |
| 85 | span#email { |
| 86 | } |
| 87 | span#revision { |
| 88 | font-family: sans-serif; |
| 89 | } |
| 90 | |
| 91 | div#footer { |
| 92 | font-family: sans-serif; |
| 93 | font-size: small; |
| 94 | border-top: 2px solid silver; |
| 95 | padding-top: 0.5em; |
| 96 | margin-top: 4.0em; |
| 97 | } |
| 98 | div#footer-text { |
| 99 | float: left; |
| 100 | padding-bottom: 0.5em; |
| 101 | } |
| 102 | div#footer-badges { |
| 103 | float: right; |
| 104 | padding-bottom: 0.5em; |
| 105 | } |
| 106 | |
| 107 | div#preamble, |
| 108 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 109 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 110 | div.admonitionblock { |
| 111 | margin-right: 10%; |
| 112 | margin-top: 1.5em; |
| 113 | margin-bottom: 1.5em; |
| 114 | } |
| 115 | div.admonitionblock { |
| 116 | margin-top: 2.5em; |
| 117 | margin-bottom: 2.5em; |
| 118 | } |
| 119 | |
| 120 | div.content { /* Block element content. */ |
| 121 | padding: 0; |
| 122 | } |
| 123 | |
| 124 | /* Block element titles. */ |
| 125 | div.title, caption.title { |
| 126 | font-family: sans-serif; |
| 127 | font-weight: bold; |
| 128 | text-align: left; |
| 129 | margin-top: 1.0em; |
| 130 | margin-bottom: 0.5em; |
| 131 | } |
| 132 | div.title + * { |
| 133 | margin-top: 0; |
| 134 | } |
| 135 | |
| 136 | td div.title:first-child { |
| 137 | margin-top: 0.0em; |
| 138 | } |
| 139 | div.content div.title:first-child { |
| 140 | margin-top: 0.0em; |
| 141 | } |
| 142 | div.content + div.title { |
| 143 | margin-top: 0.0em; |
| 144 | } |
| 145 | |
| 146 | div.sidebarblock > div.content { |
| 147 | background: #ffffee; |
| 148 | border: 1px solid silver; |
| 149 | padding: 0.5em; |
| 150 | } |
| 151 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 152 | div.listingblock { |
| 153 | margin-right: 0%; |
| 154 | } |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 155 | div.listingblock > div.content { |
| 156 | border: 1px solid silver; |
| 157 | background: #f4f4f4; |
| 158 | padding: 0.5em; |
| 159 | } |
| 160 | |
| 161 | div.quoteblock > div.content { |
| 162 | padding-left: 2.0em; |
| 163 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 164 | |
| 165 | div.attribution { |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 166 | text-align: right; |
| 167 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 168 | div.verseblock + div.attribution { |
| 169 | text-align: left; |
| 170 | } |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 171 | |
| 172 | div.admonitionblock .icon { |
| 173 | vertical-align: top; |
| 174 | font-size: 1.1em; |
| 175 | font-weight: bold; |
| 176 | text-decoration: underline; |
| 177 | color: #527bbd; |
| 178 | padding-right: 0.5em; |
| 179 | } |
| 180 | div.admonitionblock td.content { |
| 181 | padding-left: 0.5em; |
| 182 | border-left: 2px solid silver; |
| 183 | } |
| 184 | |
| 185 | div.exampleblock > div.content { |
| 186 | border-left: 2px solid silver; |
| 187 | padding: 0.5em; |
| 188 | } |
| 189 | |
| 190 | div.verseblock div.content { |
| 191 | white-space: pre; |
| 192 | } |
| 193 | |
| 194 | div.imageblock div.content { padding-left: 0; } |
| 195 | div.imageblock img { border: 1px solid silver; } |
| 196 | span.image img { border-style: none; } |
| 197 | |
| 198 | dl { |
| 199 | margin-top: 0.8em; |
| 200 | margin-bottom: 0.8em; |
| 201 | } |
| 202 | dt { |
| 203 | margin-top: 0.5em; |
| 204 | margin-bottom: 0; |
| 205 | font-style: italic; |
| 206 | } |
| 207 | dd > *:first-child { |
| 208 | margin-top: 0; |
| 209 | } |
| 210 | |
| 211 | ul, ol { |
| 212 | list-style-position: outside; |
| 213 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 214 | div.olist2 ol { |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 215 | list-style-type: lower-alpha; |
| 216 | } |
| 217 | |
| 218 | div.tableblock > table { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 219 | border: 3px solid #527bbd; |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 220 | } |
| 221 | thead { |
| 222 | font-family: sans-serif; |
| 223 | font-weight: bold; |
| 224 | } |
| 225 | tfoot { |
| 226 | font-weight: bold; |
| 227 | } |
| 228 | |
| 229 | div.hlist { |
| 230 | margin-top: 0.8em; |
| 231 | margin-bottom: 0.8em; |
| 232 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 233 | div.hlist td { |
| 234 | padding-bottom: 5px; |
| 235 | } |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 236 | td.hlist1 { |
| 237 | vertical-align: top; |
| 238 | font-style: italic; |
| 239 | padding-right: 0.8em; |
| 240 | } |
| 241 | td.hlist2 { |
| 242 | vertical-align: top; |
| 243 | } |
| 244 | |
| 245 | @media print { |
| 246 | div#footer-badges { display: none; } |
| 247 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 248 | |
| 249 | div#toctitle { |
| 250 | color: #527bbd; |
| 251 | font-family: sans-serif; |
| 252 | font-size: 1.1em; |
| 253 | font-weight: bold; |
| 254 | margin-top: 1.0em; |
| 255 | margin-bottom: 0.1em; |
| 256 | } |
| 257 | |
| 258 | div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
| 259 | margin-top: 0; |
| 260 | margin-bottom: 0; |
| 261 | } |
| 262 | div.toclevel2 { |
| 263 | margin-left: 2em; |
| 264 | font-size: 0.9em; |
| 265 | } |
| 266 | div.toclevel3 { |
| 267 | margin-left: 4em; |
| 268 | font-size: 0.9em; |
| 269 | } |
| 270 | div.toclevel4 { |
| 271 | margin-left: 6em; |
| 272 | font-size: 0.9em; |
| 273 | } |
| 274 | include1::./stylesheets/xhtml11-manpage.css[] |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 275 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 276 | |
| 277 | div.sidebar-content { |
| 278 | background: #ffffee; |
| 279 | border: 1px solid silver; |
| 280 | padding: 0.5em; |
| 281 | } |
| 282 | div.sidebar-title, div.image-title { |
| 283 | font-family: sans-serif; |
| 284 | font-weight: bold; |
| 285 | margin-top: 0.0em; |
| 286 | margin-bottom: 0.5em; |
| 287 | } |
| 288 | |
| 289 | div.listingblock div.content { |
| 290 | border: 1px solid silver; |
| 291 | background: #f4f4f4; |
| 292 | padding: 0.5em; |
| 293 | } |
| 294 | |
| 295 | div.quoteblock-content { |
| 296 | padding-left: 2.0em; |
| 297 | } |
| 298 | |
| 299 | div.exampleblock-content { |
| 300 | border-left: 2px solid silver; |
| 301 | padding-left: 0.5em; |
| 302 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 303 | |
| 304 | /* IE6 sets dynamically generated links as visited. */ |
| 305 | div#toc a:visited { color: blue; } |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 306 | </style> |
| 307 | <title>git-fast-import(1)</title> |
| 308 | </head> |
| 309 | <body> |
| 310 | <div id="header"> |
| 311 | <h1> |
| 312 | git-fast-import(1) Manual Page |
| 313 | </h1> |
| 314 | <h2>NAME</h2> |
| 315 | <div class="sectionbody"> |
| 316 | <p>git-fast-import - |
Junio C Hamano | 053827f | 2007-02-14 07:23:58 | [diff] [blame] | 317 | Backend for fast Git data importers |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 318 | </p> |
| 319 | </div> |
| 320 | </div> |
| 321 | <h2>SYNOPSIS</h2> |
| 322 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 323 | <div class="para"><p>frontend | <em>git fast-import</em> [options]</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 324 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 325 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 326 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 327 | <div class="para"><p>This program is usually not what the end user wants to run directly. |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 328 | Most end users want to use one of the existing frontend programs, |
| 329 | which parses a specific type of foreign source and feeds the contents |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 330 | stored there to <em>git fast-import</em>.</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 331 | <div class="para"><p>fast-import reads a mixed command/data stream from standard input and |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 332 | writes one or more packfiles directly into the current repository. |
| 333 | When EOF is received on standard input, fast import writes out |
| 334 | updated branch and tag refs, fully updating the current repository |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 335 | with the newly imported data.</p></div> |
| 336 | <div class="para"><p>The fast-import backend itself can import into an empty repository (one that |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 337 | has already been initialized by <em>git init</em>) or incrementally |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 338 | update an existing populated repository. Whether or not incremental |
| 339 | imports are supported from a particular foreign source depends on |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 340 | the frontend program in use.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 341 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 342 | <h2 id="_options">OPTIONS</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 343 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 344 | <div class="vlist"><dl> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 345 | <dt> |
| 346 | --date-format=<fmt> |
| 347 | </dt> |
| 348 | <dd> |
| 349 | <p> |
| 350 | Specify the type of dates the frontend will supply to |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 351 | fast-import within <tt>author</tt>, <tt>committer</tt> and <tt>tagger</tt> commands. |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 352 | See “Date Formats” below for details about which formats |
| 353 | are supported, and their syntax. |
| 354 | </p> |
| 355 | </dd> |
| 356 | <dt> |
| 357 | --force |
| 358 | </dt> |
| 359 | <dd> |
| 360 | <p> |
| 361 | Force updating modified existing branches, even if doing |
| 362 | so would cause commits to be lost (as the new commit does |
| 363 | not contain the old commit). |
| 364 | </p> |
| 365 | </dd> |
| 366 | <dt> |
| 367 | --max-pack-size=<n> |
| 368 | </dt> |
| 369 | <dd> |
| 370 | <p> |
Junio C Hamano | d330432 | 2010-02-05 03:28:27 | [diff] [blame^] | 371 | Maximum size of each output packfile. |
| 372 | The default is 4 GiB as that is the maximum allowed |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 373 | packfile size (due to file format limitations). Some |
| 374 | importers may wish to lower this, such as to ensure the |
| 375 | resulting packfiles fit on CDs. |
| 376 | </p> |
| 377 | </dd> |
| 378 | <dt> |
Junio C Hamano | 5c246f2 | 2010-02-03 07:34:53 | [diff] [blame] | 379 | --big-file-threshold=<n> |
| 380 | </dt> |
| 381 | <dd> |
| 382 | <p> |
| 383 | Maximum size of a blob that fast-import will attempt to |
| 384 | create a delta for, expressed in bytes. The default is 512m |
| 385 | (512 MiB). Some importers may wish to lower this on systems |
| 386 | with constrained memory. |
| 387 | </p> |
| 388 | </dd> |
| 389 | <dt> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 390 | --depth=<n> |
| 391 | </dt> |
| 392 | <dd> |
| 393 | <p> |
| 394 | Maximum delta depth, for blob and tree deltification. |
| 395 | Default is 10. |
| 396 | </p> |
| 397 | </dd> |
| 398 | <dt> |
| 399 | --active-branches=<n> |
| 400 | </dt> |
| 401 | <dd> |
| 402 | <p> |
| 403 | Maximum number of branches to maintain active at once. |
| 404 | See “Memory Utilization” below for details. Default is 5. |
| 405 | </p> |
| 406 | </dd> |
| 407 | <dt> |
| 408 | --export-marks=<file> |
| 409 | </dt> |
| 410 | <dd> |
| 411 | <p> |
| 412 | Dumps the internal marks table to <file> when complete. |
| 413 | Marks are written one per line as <tt>:markid SHA-1</tt>. |
| 414 | Frontends can use this file to validate imports after they |
Junio C Hamano | d15328a | 2007-03-09 09:06:40 | [diff] [blame] | 415 | have been completed, or to save the marks table across |
| 416 | incremental runs. As <file> is only opened and truncated |
| 417 | at checkpoint (or completion) the same path can also be |
| 418 | safely given to --import-marks. |
| 419 | </p> |
| 420 | </dd> |
| 421 | <dt> |
| 422 | --import-marks=<file> |
| 423 | </dt> |
| 424 | <dd> |
| 425 | <p> |
| 426 | Before processing any input, load the marks specified in |
| 427 | <file>. The input file must exist, must be readable, and |
| 428 | must use the same format as produced by --export-marks. |
| 429 | Multiple options may be supplied to import more than one |
| 430 | set of marks. If a mark is defined to different values, |
| 431 | the last file wins. |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 432 | </p> |
| 433 | </dd> |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 434 | <dt> |
Junio C Hamano | 6ce6b6c | 2010-01-18 01:25:50 | [diff] [blame] | 435 | --relative-marks |
| 436 | </dt> |
| 437 | <dd> |
| 438 | <p> |
| 439 | After specifying --relative-marks= the paths specified |
| 440 | with --import-marks= and --export-marks= are relative |
| 441 | to an internal directory in the current repository. |
| 442 | In git-fast-import this means that the paths are relative |
| 443 | to the .git/info/fast-import directory. However, other |
| 444 | importers may use a different location. |
| 445 | </p> |
| 446 | </dd> |
| 447 | <dt> |
| 448 | --no-relative-marks |
| 449 | </dt> |
| 450 | <dd> |
| 451 | <p> |
| 452 | Negates a previous --relative-marks. Allows for combining |
| 453 | relative and non-relative marks by interweaving |
| 454 | --(no-)-relative-marks= with the --(import|export)-marks= |
| 455 | options. |
| 456 | </p> |
| 457 | </dd> |
| 458 | <dt> |
Junio C Hamano | 9dd8bb0 | 2007-02-12 07:15:35 | [diff] [blame] | 459 | --export-pack-edges=<file> |
| 460 | </dt> |
| 461 | <dd> |
| 462 | <p> |
| 463 | After creating a packfile, print a line of data to |
| 464 | <file> listing the filename of the packfile and the last |
| 465 | commit on each branch that was written to that packfile. |
| 466 | This information may be useful after importing projects |
| 467 | whose total object set exceeds the 4 GiB packfile limit, |
| 468 | as these commits can be used as edge points during calls |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 469 | to <em>git pack-objects</em>. |
Junio C Hamano | 9dd8bb0 | 2007-02-12 07:15:35 | [diff] [blame] | 470 | </p> |
| 471 | </dd> |
| 472 | <dt> |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 473 | --quiet |
| 474 | </dt> |
| 475 | <dd> |
| 476 | <p> |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 477 | Disable all non-fatal output, making fast-import silent when it |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 478 | is successful. This option disables the output shown by |
| 479 | --stats. |
| 480 | </p> |
| 481 | </dd> |
| 482 | <dt> |
| 483 | --stats |
| 484 | </dt> |
| 485 | <dd> |
| 486 | <p> |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 487 | Display some basic statistics about the objects fast-import has |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 488 | created, the packfiles they were stored into, and the |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 489 | memory used by fast-import during this run. Showing this output |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 490 | is currently the default, but can be disabled with --quiet. |
| 491 | </p> |
| 492 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 493 | </dl></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 494 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 495 | <h2 id="_performance">Performance</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 496 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 497 | <div class="para"><p>The design of fast-import allows it to import large projects in a minimum |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 498 | amount of memory usage and processing time. Assuming the frontend |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 499 | is able to keep up with fast-import and feed it a constant stream of data, |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 500 | import times for projects holding 10+ years of history and containing |
| 501 | 100,000+ individual commits are generally completed in just 1-2 |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 502 | hours on quite modest (~$2,000 USD) hardware.</p></div> |
| 503 | <div class="para"><p>Most bottlenecks appear to be in foreign source data access (the |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 504 | source just cannot extract revisions fast enough) or disk IO (fast-import |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 505 | writes as fast as the disk will take the data). Imports will run |
| 506 | faster if the source data is stored on a different drive than the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 507 | destination Git repository (due to less IO contention).</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 508 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 509 | <h2 id="_development_cost">Development Cost</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 510 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 511 | <div class="para"><p>A typical frontend for fast-import tends to weigh in at approximately 200 |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 512 | lines of Perl/Python/Ruby code. Most developers have been able to |
| 513 | create working importers in just a couple of hours, even though it |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 514 | is their first exposure to fast-import, and sometimes even to Git. This is |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 515 | an ideal situation, given that most conversion tools are throw-away |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 516 | (use once, and never look back).</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 517 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 518 | <h2 id="_parallel_operation">Parallel Operation</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 519 | <div class="sectionbody"> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 520 | <div class="para"><p>Like <em>git push</em> or <em>git fetch</em>, imports handled by fast-import are safe to |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 521 | run alongside parallel <tt>git repack -a -d</tt> or <tt>git gc</tt> invocations, |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 522 | or any other Git operation (including <em>git prune</em>, as loose objects |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 523 | are never used by fast-import).</p></div> |
| 524 | <div class="para"><p>fast-import does not lock the branch or tag refs it is actively importing. |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 525 | After the import, during its ref update phase, fast-import tests each |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 526 | existing branch ref to verify the update will be a fast-forward |
| 527 | update (the commit stored in the ref is contained in the new |
| 528 | history of the commit to be written). If the update is not a |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 529 | fast-forward update, fast-import will skip updating that ref and instead |
| 530 | prints a warning message. fast-import will always attempt to update all |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 531 | branch refs, and does not stop on the first failure.</p></div> |
Junio C Hamano | 167b138 | 2010-01-31 23:04:31 | [diff] [blame] | 532 | <div class="para"><p>Branch updates can be forced with --force, but it's recommended that |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 533 | this only be used on an otherwise quiet repository. Using --force |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 534 | is not necessary for an initial import into an empty repository.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 535 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 536 | <h2 id="_technical_discussion">Technical Discussion</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 537 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 538 | <div class="para"><p>fast-import tracks a set of branches in memory. Any branch can be created |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 539 | or modified at any point during the import process by sending a |
| 540 | <tt>commit</tt> command on the input stream. This design allows a frontend |
| 541 | program to process an unlimited number of branches simultaneously, |
| 542 | generating commits in the order they are available from the source |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 543 | data. It also simplifies the frontend programs considerably.</p></div> |
| 544 | <div class="para"><p>fast-import does not use or alter the current working directory, or any |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 545 | file within it. (It does however update the current Git repository, |
| 546 | as referenced by <tt>GIT_DIR</tt>.) Therefore an import frontend may use |
| 547 | the working directory for its own purposes, such as extracting file |
| 548 | revisions from the foreign source. This ignorance of the working |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 549 | directory also allows fast-import to run very quickly, as it does not |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 550 | need to perform any costly file update operations when switching |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 551 | between branches.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 552 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 553 | <h2 id="_input_format">Input Format</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 554 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 555 | <div class="para"><p>With the exception of raw file data (which Git does not interpret) |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 556 | the fast-import input format is text (ASCII) based. This text based |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 557 | format simplifies development and debugging of frontend programs, |
| 558 | especially when a higher level language such as Perl, Python or |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 559 | Ruby is being used.</p></div> |
| 560 | <div class="para"><p>fast-import is very strict about its input. Where we say SP below we mean |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 561 | <strong>exactly</strong> one space. Likewise LF means one (and only one) linefeed. |
| 562 | Supplying additional whitespace characters will cause unexpected |
| 563 | results, such as branch names or file names with leading or trailing |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 564 | spaces in their name, or early termination of fast-import when it encounters |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 565 | unexpected input.</p></div> |
| 566 | <h3 id="_stream_comments">Stream Comments</h3><div style="clear:left"></div> |
| 567 | <div class="para"><p>To aid in debugging frontends fast-import ignores any line that |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 568 | begins with <tt>#</tt> (ASCII pound/hash) up to and including the line |
| 569 | ending <tt>LF</tt>. A comment line may contain any sequence of bytes |
| 570 | that does not contain an LF and therefore may be used to include |
| 571 | any detailed debugging information that might be specific to the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 572 | frontend and useful when inspecting a fast-import data stream.</p></div> |
| 573 | <h3 id="_date_formats">Date Formats</h3><div style="clear:left"></div> |
| 574 | <div class="para"><p>The following date formats are supported. A frontend should select |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 575 | the format it will use for this import by passing the format name |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 576 | in the --date-format=<fmt> command line option.</p></div> |
| 577 | <div class="vlist"><dl> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 578 | <dt> |
| 579 | <tt>raw</tt> |
| 580 | </dt> |
| 581 | <dd> |
| 582 | <p> |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 583 | This is the Git native format and is <tt><time> SP <offutc></tt>. |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 584 | It is also fast-import's default format, if --date-format was |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 585 | not specified. |
| 586 | </p> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 587 | <div class="para"><p>The time of the event is specified by <tt><time></tt> as the number of |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 588 | seconds since the UNIX epoch (midnight, Jan 1, 1970, UTC) and is |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 589 | written as an ASCII decimal integer.</p></div> |
| 590 | <div class="para"><p>The local offset is specified by <tt><offutc></tt> as a positive or negative |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 591 | offset from UTC. For example EST (which is 5 hours behind UTC) |
| 592 | would be expressed in <tt><tz></tt> by “-0500” while UTC is “+0000”. |
| 593 | The local offset does not affect <tt><time></tt>; it is used only as an |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 594 | advisement to help formatting routines display the timestamp.</p></div> |
| 595 | <div class="para"><p>If the local offset is not available in the source material, use |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 596 | “+0000”, or the most common local offset. For example many |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 597 | organizations have a CVS repository which has only ever been accessed |
| 598 | by users who are located in the same location and timezone. In this |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 599 | case a reasonable offset from UTC could be assumed.</p></div> |
| 600 | <div class="para"><p>Unlike the <tt>rfc2822</tt> format, this format is very strict. Any |
| 601 | variation in formatting will cause fast-import to reject the value.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 602 | </dd> |
| 603 | <dt> |
| 604 | <tt>rfc2822</tt> |
| 605 | </dt> |
| 606 | <dd> |
| 607 | <p> |
| 608 | This is the standard email format as described by RFC 2822. |
| 609 | </p> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 610 | <div class="para"><p>An example value is “Tue Feb 6 11:22:18 2007 -0500”. The Git |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 611 | parser is accurate, but a little on the lenient side. It is the |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 612 | same parser used by <em>git am</em> when applying patches |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 613 | received from email.</p></div> |
| 614 | <div class="para"><p>Some malformed strings may be accepted as valid dates. In some of |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 615 | these cases Git will still be able to obtain the correct date from |
| 616 | the malformed string. There are also some types of malformed |
| 617 | strings which Git will parse wrong, and yet consider valid. |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 618 | Seriously malformed strings will be rejected.</p></div> |
| 619 | <div class="para"><p>Unlike the <tt>raw</tt> format above, the timezone/UTC offset information |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 620 | contained in an RFC 2822 date string is used to adjust the date |
| 621 | value to UTC prior to storage. Therefore it is important that |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 622 | this information be as accurate as possible.</p></div> |
| 623 | <div class="para"><p>If the source material uses RFC 2822 style dates, |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 624 | the frontend should let fast-import handle the parsing and conversion |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 625 | (rather than attempting to do it itself) as the Git parser has |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 626 | been well tested in the wild.</p></div> |
| 627 | <div class="para"><p>Frontends should prefer the <tt>raw</tt> format if the source material |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 628 | already uses UNIX-epoch format, can be coaxed to give dates in that |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 629 | format, or its format is easily convertible to it, as there is no |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 630 | ambiguity in parsing.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 631 | </dd> |
| 632 | <dt> |
| 633 | <tt>now</tt> |
| 634 | </dt> |
| 635 | <dd> |
| 636 | <p> |
| 637 | Always use the current time and timezone. The literal |
| 638 | <tt>now</tt> must always be supplied for <tt><when></tt>. |
| 639 | </p> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 640 | <div class="para"><p>This is a toy format. The current time and timezone of this system |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 641 | is always copied into the identity string at the time it is being |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 642 | created by fast-import. There is no way to specify a different time or |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 643 | timezone.</p></div> |
Junio C Hamano | 167b138 | 2010-01-31 23:04:31 | [diff] [blame] | 644 | <div class="para"><p>This particular format is supplied as it's short to implement and |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 645 | may be useful to a process that wants to create a new commit |
| 646 | right now, without needing to use a working directory or |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 647 | <em>git update-index</em>.</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 648 | <div class="para"><p>If separate <tt>author</tt> and <tt>committer</tt> commands are used in a <tt>commit</tt> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 649 | the timestamps may not match, as the system clock will be polled |
| 650 | twice (once for each command). The only way to ensure that both |
| 651 | author and committer identity information has the same timestamp |
| 652 | is to omit <tt>author</tt> (thus copying from <tt>committer</tt>) or to use a |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 653 | date format other than <tt>now</tt>.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 654 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 655 | </dl></div> |
| 656 | <h3 id="_commands">Commands</h3><div style="clear:left"></div> |
| 657 | <div class="para"><p>fast-import accepts several commands to update the current repository |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 658 | and control the current import process. More detailed discussion |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 659 | (with examples) of each command follows later.</p></div> |
| 660 | <div class="vlist"><dl> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 661 | <dt> |
| 662 | <tt>commit</tt> |
| 663 | </dt> |
| 664 | <dd> |
| 665 | <p> |
| 666 | Creates a new branch or updates an existing branch by |
| 667 | creating a new commit and updating the branch to point at |
| 668 | the newly created commit. |
| 669 | </p> |
| 670 | </dd> |
| 671 | <dt> |
| 672 | <tt>tag</tt> |
| 673 | </dt> |
| 674 | <dd> |
| 675 | <p> |
| 676 | Creates an annotated tag object from an existing commit or |
| 677 | branch. Lightweight tags are not supported by this command, |
| 678 | as they are not recommended for recording meaningful points |
| 679 | in time. |
| 680 | </p> |
| 681 | </dd> |
| 682 | <dt> |
| 683 | <tt>reset</tt> |
| 684 | </dt> |
| 685 | <dd> |
| 686 | <p> |
| 687 | Reset an existing branch (or a new branch) to a specific |
| 688 | revision. This command must be used to change a branch to |
| 689 | a specific revision without making a commit on it. |
| 690 | </p> |
| 691 | </dd> |
| 692 | <dt> |
| 693 | <tt>blob</tt> |
| 694 | </dt> |
| 695 | <dd> |
| 696 | <p> |
| 697 | Convert raw file data into a blob, for future use in a |
| 698 | <tt>commit</tt> command. This command is optional and is not |
| 699 | needed to perform an import. |
| 700 | </p> |
| 701 | </dd> |
| 702 | <dt> |
| 703 | <tt>checkpoint</tt> |
| 704 | </dt> |
| 705 | <dd> |
| 706 | <p> |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 707 | Forces fast-import to close the current packfile, generate its |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 708 | unique SHA-1 checksum and index, and start a new packfile. |
| 709 | This command is optional and is not needed to perform |
| 710 | an import. |
| 711 | </p> |
| 712 | </dd> |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 713 | <dt> |
| 714 | <tt>progress</tt> |
| 715 | </dt> |
| 716 | <dd> |
| 717 | <p> |
| 718 | Causes fast-import to echo the entire line to its own |
| 719 | standard output. This command is optional and is not needed |
| 720 | to perform an import. |
| 721 | </p> |
| 722 | </dd> |
Junio C Hamano | 6ce6b6c | 2010-01-18 01:25:50 | [diff] [blame] | 723 | <dt> |
| 724 | <tt>feature</tt> |
| 725 | </dt> |
| 726 | <dd> |
| 727 | <p> |
| 728 | Require that fast-import supports the specified feature, or |
| 729 | abort if it does not. |
| 730 | </p> |
| 731 | </dd> |
| 732 | <dt> |
| 733 | <tt>option</tt> |
| 734 | </dt> |
| 735 | <dd> |
| 736 | <p> |
| 737 | Specify any of the options listed under OPTIONS that do not |
| 738 | change stream semantic to suit the frontend's needs. This |
| 739 | command is optional and is not needed to perform an import. |
| 740 | </p> |
| 741 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 742 | </dl></div> |
| 743 | <h3 id="_tt_commit_tt"><tt>commit</tt></h3><div style="clear:left"></div> |
| 744 | <div class="para"><p>Create or update a branch with a new commit, recording one logical |
| 745 | change to the project.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 746 | <div class="literalblock"> |
| 747 | <div class="content"> |
| 748 | <pre><tt> 'commit' SP <ref> LF |
| 749 | mark? |
Junio C Hamano | 6d325df | 2010-01-01 00:02:47 | [diff] [blame] | 750 | ('author' (SP <name>)? SP LT <email> GT SP <when> LF)? |
| 751 | 'committer' (SP <name>)? SP LT <email> GT SP <when> LF |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 752 | data |
| 753 | ('from' SP <committish> LF)? |
| 754 | ('merge' SP <committish> LF)? |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 755 | (filemodify | filedelete | filecopy | filerename | filedeleteall | notemodify)* |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 756 | LF?</tt></pre> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 757 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 758 | <div class="para"><p>where <tt><ref></tt> is the name of the branch to make the commit on. |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 759 | Typically branch names are prefixed with <tt>refs/heads/</tt> in |
| 760 | Git, so importing the CVS branch symbol <tt>RELENG-1_0</tt> would use |
| 761 | <tt>refs/heads/RELENG-1_0</tt> for the value of <tt><ref></tt>. The value of |
| 762 | <tt><ref></tt> must be a valid refname in Git. As <tt>LF</tt> is not valid in |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 763 | a Git refname, no quoting or escaping syntax is supported here.</p></div> |
| 764 | <div class="para"><p>A <tt>mark</tt> command may optionally appear, requesting fast-import to save a |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 765 | reference to the newly created commit for future use by the frontend |
| 766 | (see below for format). It is very common for frontends to mark |
| 767 | every commit they create, thereby allowing future branch creation |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 768 | from any imported commit.</p></div> |
| 769 | <div class="para"><p>The <tt>data</tt> command following <tt>committer</tt> must supply the commit |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 770 | message (see below for <tt>data</tt> command syntax). To import an empty |
| 771 | commit message use a 0 length data. Commit messages are free-form |
| 772 | and are not interpreted by Git. Currently they must be encoded in |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 773 | UTF-8, as fast-import does not permit other encodings to be specified.</p></div> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 774 | <div class="para"><p>Zero or more <tt>filemodify</tt>, <tt>filedelete</tt>, <tt>filecopy</tt>, <tt>filerename</tt>, |
| 775 | <tt>filedeleteall</tt> and <tt>notemodify</tt> commands |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 776 | may be included to update the contents of the branch prior to |
| 777 | creating the commit. These commands may be supplied in any order. |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 778 | However it is recommended that a <tt>filedeleteall</tt> command precede |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 779 | all <tt>filemodify</tt>, <tt>filecopy</tt>, <tt>filerename</tt> and <tt>notemodify</tt> commands in |
| 780 | the same commit, as <tt>filedeleteall</tt> wipes the branch clean (see below).</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 781 | <div class="para"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div> |
| 782 | <h4 id="_tt_author_tt"><tt>author</tt></h4> |
| 783 | <div class="para"><p>An <tt>author</tt> command may optionally appear, if the author information |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 784 | might differ from the committer information. If <tt>author</tt> is omitted |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 785 | then fast-import will automatically use the committer's information for |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 786 | the author portion of the commit. See below for a description of |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 787 | the fields in <tt>author</tt>, as they are identical to <tt>committer</tt>.</p></div> |
| 788 | <h4 id="_tt_committer_tt"><tt>committer</tt></h4> |
| 789 | <div class="para"><p>The <tt>committer</tt> command indicates who made this commit, and when |
| 790 | they made it.</p></div> |
| 791 | <div class="para"><p>Here <tt><name></tt> is the person's display name (for example |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 792 | “Com M Itter”) and <tt><email></tt> is the person's email address |
| 793 | (“cm@example.com”). <tt>LT</tt> and <tt>GT</tt> are the literal less-than (\x3c) |
| 794 | and greater-than (\x3e) symbols. These are required to delimit |
| 795 | the email address from the other fields in the line. Note that |
| 796 | <tt><name></tt> is free-form and may contain any sequence of bytes, except |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 797 | <tt>LT</tt> and <tt>LF</tt>. It is typically UTF-8 encoded.</p></div> |
| 798 | <div class="para"><p>The time of the change is specified by <tt><when></tt> using the date format |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 799 | that was selected by the --date-format=<fmt> command line option. |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 800 | See “Date Formats” above for the set of supported formats, and |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 801 | their syntax.</p></div> |
| 802 | <h4 id="_tt_from_tt"><tt>from</tt></h4> |
| 803 | <div class="para"><p>The <tt>from</tt> command is used to specify the commit to initialize |
Junio C Hamano | 5dad083 | 2007-02-13 05:16:23 | [diff] [blame] | 804 | this branch from. This revision will be the first ancestor of the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 805 | new commit.</p></div> |
| 806 | <div class="para"><p>Omitting the <tt>from</tt> command in the first commit of a new branch |
Junio C Hamano | 5dad083 | 2007-02-13 05:16:23 | [diff] [blame] | 807 | will cause fast-import to create that commit with no ancestor. This |
| 808 | tends to be desired only for the initial commit of a project. |
Junio C Hamano | 25c0b70 | 2008-03-23 09:41:37 | [diff] [blame] | 809 | If the frontend creates all files from scratch when making a new |
| 810 | branch, a <tt>merge</tt> command may be used instead of <tt>from</tt> to start |
| 811 | the commit with an empty tree. |
Junio C Hamano | 5dad083 | 2007-02-13 05:16:23 | [diff] [blame] | 812 | Omitting the <tt>from</tt> command on existing branches is usually desired, |
| 813 | as the current commit on that branch is automatically assumed to |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 814 | be the first ancestor of the new commit.</p></div> |
| 815 | <div class="para"><p>As <tt>LF</tt> is not valid in a Git refname or SHA-1 expression, no |
| 816 | quoting or escaping syntax is supported within <tt><committish></tt>.</p></div> |
| 817 | <div class="para"><p>Here <tt><committish></tt> is any of the following:</p></div> |
| 818 | <div class="ilist"><ul> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 819 | <li> |
| 820 | <p> |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 821 | The name of an existing branch already in fast-import's internal branch |
Junio C Hamano | 167b138 | 2010-01-31 23:04:31 | [diff] [blame] | 822 | table. If fast-import doesn't know the name, it's treated as a SHA-1 |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 823 | expression. |
| 824 | </p> |
| 825 | </li> |
| 826 | <li> |
| 827 | <p> |
| 828 | A mark reference, <tt>:<idnum></tt>, where <tt><idnum></tt> is the mark number. |
| 829 | </p> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 830 | <div class="para"><p>The reason fast-import uses <tt>:</tt> to denote a mark reference is this character |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 831 | is not legal in a Git branch name. The leading <tt>:</tt> makes it easy |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 832 | to distinguish between the mark 42 (<tt>:42</tt>) and the branch 42 (<tt>42</tt> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 833 | or <tt>refs/heads/42</tt>), or an abbreviated SHA-1 which happened to |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 834 | consist only of base-10 digits.</p></div> |
| 835 | <div class="para"><p>Marks must be declared (via <tt>mark</tt>) before they can be used.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 836 | </li> |
| 837 | <li> |
| 838 | <p> |
| 839 | A complete 40 byte or abbreviated commit SHA-1 in hex. |
| 840 | </p> |
| 841 | </li> |
| 842 | <li> |
| 843 | <p> |
| 844 | Any valid Git SHA-1 expression that resolves to a commit. See |
| 845 | “SPECIFYING REVISIONS” in <a href="git-rev-parse.html">git-rev-parse(1)</a> for details. |
| 846 | </p> |
| 847 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 848 | </ul></div> |
| 849 | <div class="para"><p>The special case of restarting an incremental import from the |
| 850 | current branch value should be written as:</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 851 | <div class="listingblock"> |
| 852 | <div class="content"> |
| 853 | <pre><tt> from refs/heads/branch^0</tt></pre> |
| 854 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 855 | <div class="para"><p>The <tt>^0</tt> suffix is necessary as fast-import does not permit a branch to |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 856 | start from itself, and the branch is created in memory before the |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 857 | <tt>from</tt> command is even read from the input. Adding <tt>^0</tt> will force |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 858 | fast-import to resolve the commit through Git's revision parsing library, |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 859 | rather than its internal branch table, thereby loading in the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 860 | existing value of the branch.</p></div> |
| 861 | <h4 id="_tt_merge_tt"><tt>merge</tt></h4> |
| 862 | <div class="para"><p>Includes one additional ancestor commit. If the <tt>from</tt> command is |
Junio C Hamano | 25c0b70 | 2008-03-23 09:41:37 | [diff] [blame] | 863 | omitted when creating a new branch, the first <tt>merge</tt> commit will be |
| 864 | the first ancestor of the current commit, and the branch will start |
| 865 | out with no files. An unlimited number of <tt>merge</tt> commands per |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 866 | commit are permitted by fast-import, thereby establishing an n-way merge. |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 867 | However Git's other tools never create commits with more than 15 |
| 868 | additional ancestors (forming a 16-way merge). For this reason |
| 869 | it is suggested that frontends do not use more than 15 <tt>merge</tt> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 870 | commands per commit; 16, if starting a new, empty branch.</p></div> |
| 871 | <div class="para"><p>Here <tt><committish></tt> is any of the commit specification expressions |
| 872 | also accepted by <tt>from</tt> (see above).</p></div> |
| 873 | <h4 id="_tt_filemodify_tt"><tt>filemodify</tt></h4> |
| 874 | <div class="para"><p>Included in a <tt>commit</tt> command to add a new file or change the |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 875 | content of an existing file. This command has two different means |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 876 | of specifying the content of the file.</p></div> |
| 877 | <div class="vlist"><dl> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 878 | <dt> |
| 879 | External data format |
| 880 | </dt> |
| 881 | <dd> |
| 882 | <p> |
| 883 | The data content for the file was already supplied by a prior |
| 884 | <tt>blob</tt> command. The frontend just needs to connect it. |
| 885 | </p> |
| 886 | <div class="literalblock"> |
| 887 | <div class="content"> |
| 888 | <pre><tt> 'M' SP <mode> SP <dataref> SP <path> LF</tt></pre> |
| 889 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 890 | <div class="para"><p>Here <tt><dataref></tt> can be either a mark reference (<tt>:<idnum></tt>) |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 891 | set by a prior <tt>blob</tt> command, or a full 40-byte SHA-1 of an |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 892 | existing Git blob object.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 893 | </dd> |
| 894 | <dt> |
| 895 | Inline data format |
| 896 | </dt> |
| 897 | <dd> |
| 898 | <p> |
| 899 | The data content for the file has not been supplied yet. |
| 900 | The frontend wants to supply it as part of this modify |
| 901 | command. |
| 902 | </p> |
| 903 | <div class="literalblock"> |
| 904 | <div class="content"> |
| 905 | <pre><tt> 'M' SP <mode> SP 'inline' SP <path> LF |
| 906 | data</tt></pre> |
| 907 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 908 | <div class="para"><p>See below for a detailed description of the <tt>data</tt> command.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 909 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 910 | </dl></div> |
| 911 | <div class="para"><p>In both formats <tt><mode></tt> is the type of file entry, specified |
| 912 | in octal. Git only supports the following modes:</p></div> |
| 913 | <div class="ilist"><ul> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 914 | <li> |
| 915 | <p> |
| 916 | <tt>100644</tt> or <tt>644</tt>: A normal (not-executable) file. The majority |
| 917 | of files in most projects use this mode. If in doubt, this is |
| 918 | what you want. |
| 919 | </p> |
| 920 | </li> |
| 921 | <li> |
| 922 | <p> |
| 923 | <tt>100755</tt> or <tt>755</tt>: A normal, but executable, file. |
| 924 | </p> |
| 925 | </li> |
| 926 | <li> |
| 927 | <p> |
| 928 | <tt>120000</tt>: A symlink, the content of the file will be the link target. |
| 929 | </p> |
| 930 | </li> |
Junio C Hamano | 915cd9b | 2008-07-20 01:24:17 | [diff] [blame] | 931 | <li> |
| 932 | <p> |
| 933 | <tt>160000</tt>: A gitlink, SHA-1 of the object refers to a commit in |
| 934 | another repository. Git links can only be specified by SHA or through |
| 935 | a commit mark. They are used to implement submodules. |
| 936 | </p> |
| 937 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 938 | </ul></div> |
| 939 | <div class="para"><p>In both formats <tt><path></tt> is the complete path of the file to be added |
| 940 | (if not already existing) or modified (if already existing).</p></div> |
| 941 | <div class="para"><p>A <tt><path></tt> string must use UNIX-style directory separators (forward |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 942 | slash <tt>/</tt>), may contain any byte other than <tt>LF</tt>, and must not |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 943 | start with double quote (<tt>"</tt>).</p></div> |
| 944 | <div class="para"><p>If an <tt>LF</tt> or double quote must be encoded into <tt><path></tt> shell-style |
| 945 | quoting should be used, e.g. <tt>"path/with\n and \" in it"</tt>.</p></div> |
| 946 | <div class="para"><p>The value of <tt><path></tt> must be in canonical form. That is it must not:</p></div> |
| 947 | <div class="ilist"><ul> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 948 | <li> |
| 949 | <p> |
| 950 | contain an empty directory component (e.g. <tt>foo//bar</tt> is invalid), |
| 951 | </p> |
| 952 | </li> |
| 953 | <li> |
| 954 | <p> |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 955 | end with a directory separator (e.g. <tt>foo/</tt> is invalid), |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 956 | </p> |
| 957 | </li> |
| 958 | <li> |
| 959 | <p> |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 960 | start with a directory separator (e.g. <tt>/foo</tt> is invalid), |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 961 | </p> |
| 962 | </li> |
| 963 | <li> |
| 964 | <p> |
| 965 | contain the special component <tt>.</tt> or <tt>..</tt> (e.g. <tt>foo/./bar</tt> and |
| 966 | <tt>foo/../bar</tt> are invalid). |
| 967 | </p> |
| 968 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 969 | </ul></div> |
| 970 | <div class="para"><p>It is recommended that <tt><path></tt> always be encoded using UTF-8.</p></div> |
| 971 | <h4 id="_tt_filedelete_tt"><tt>filedelete</tt></h4> |
| 972 | <div class="para"><p>Included in a <tt>commit</tt> command to remove a file or recursively |
Junio C Hamano | 06216df | 2007-07-10 07:49:37 | [diff] [blame] | 973 | delete an entire directory from the branch. If the file or directory |
| 974 | removal makes its parent directory empty, the parent directory will |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 975 | be automatically removed too. This cascades up the tree until the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 976 | first non-empty directory or the root is reached.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 977 | <div class="literalblock"> |
| 978 | <div class="content"> |
| 979 | <pre><tt> 'D' SP <path> LF</tt></pre> |
| 980 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 981 | <div class="para"><p>here <tt><path></tt> is the complete path of the file or subdirectory to |
Junio C Hamano | 06216df | 2007-07-10 07:49:37 | [diff] [blame] | 982 | be removed from the branch. |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 983 | See <tt>filemodify</tt> above for a detailed description of <tt><path></tt>.</p></div> |
| 984 | <h4 id="_tt_filecopy_tt"><tt>filecopy</tt></h4> |
| 985 | <div class="para"><p>Recursively copies an existing file or subdirectory to a different |
Junio C Hamano | c0ea7c6 | 2007-07-15 07:19:06 | [diff] [blame] | 986 | location within the branch. The existing file or directory must |
| 987 | exist. If the destination exists it will be completely replaced |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 988 | by the content copied from the source.</p></div> |
Junio C Hamano | c0ea7c6 | 2007-07-15 07:19:06 | [diff] [blame] | 989 | <div class="literalblock"> |
| 990 | <div class="content"> |
| 991 | <pre><tt> 'C' SP <path> SP <path> LF</tt></pre> |
| 992 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 993 | <div class="para"><p>here the first <tt><path></tt> is the source location and the second |
Junio C Hamano | c0ea7c6 | 2007-07-15 07:19:06 | [diff] [blame] | 994 | <tt><path></tt> is the destination. See <tt>filemodify</tt> above for a detailed |
| 995 | description of what <tt><path></tt> may look like. To use a source path |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 996 | that contains SP the path must be quoted.</p></div> |
| 997 | <div class="para"><p>A <tt>filecopy</tt> command takes effect immediately. Once the source |
Junio C Hamano | c0ea7c6 | 2007-07-15 07:19:06 | [diff] [blame] | 998 | location has been copied to the destination any future commands |
| 999 | applied to the source location will not impact the destination of |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1000 | the copy.</p></div> |
| 1001 | <h4 id="_tt_filerename_tt"><tt>filerename</tt></h4> |
| 1002 | <div class="para"><p>Renames an existing file or subdirectory to a different location |
Junio C Hamano | 06216df | 2007-07-10 07:49:37 | [diff] [blame] | 1003 | within the branch. The existing file or directory must exist. If |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1004 | the destination exists it will be replaced by the source directory.</p></div> |
Junio C Hamano | 06216df | 2007-07-10 07:49:37 | [diff] [blame] | 1005 | <div class="literalblock"> |
| 1006 | <div class="content"> |
| 1007 | <pre><tt> 'R' SP <path> SP <path> LF</tt></pre> |
| 1008 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1009 | <div class="para"><p>here the first <tt><path></tt> is the source location and the second |
Junio C Hamano | 06216df | 2007-07-10 07:49:37 | [diff] [blame] | 1010 | <tt><path></tt> is the destination. See <tt>filemodify</tt> above for a detailed |
| 1011 | description of what <tt><path></tt> may look like. To use a source path |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1012 | that contains SP the path must be quoted.</p></div> |
| 1013 | <div class="para"><p>A <tt>filerename</tt> command takes effect immediately. Once the source |
Junio C Hamano | 06216df | 2007-07-10 07:49:37 | [diff] [blame] | 1014 | location has been renamed to the destination any future commands |
| 1015 | applied to the source location will create new files there and not |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1016 | impact the destination of the rename.</p></div> |
| 1017 | <div class="para"><p>Note that a <tt>filerename</tt> is the same as a <tt>filecopy</tt> followed by a |
Junio C Hamano | c0ea7c6 | 2007-07-15 07:19:06 | [diff] [blame] | 1018 | <tt>filedelete</tt> of the source location. There is a slight performance |
| 1019 | advantage to using <tt>filerename</tt>, but the advantage is so small |
| 1020 | that it is never worth trying to convert a delete/add pair in |
| 1021 | source material into a rename for fast-import. This <tt>filerename</tt> |
| 1022 | command is provided just to simplify frontends that already have |
| 1023 | rename information and don't want bother with decomposing it into a |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1024 | <tt>filecopy</tt> followed by a <tt>filedelete</tt>.</p></div> |
| 1025 | <h4 id="_tt_filedeleteall_tt"><tt>filedeleteall</tt></h4> |
| 1026 | <div class="para"><p>Included in a <tt>commit</tt> command to remove all files (and also all |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1027 | directories) from the branch. This command resets the internal |
| 1028 | branch structure to have no files in it, allowing the frontend |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1029 | to subsequently add all interesting files from scratch.</p></div> |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1030 | <div class="literalblock"> |
| 1031 | <div class="content"> |
| 1032 | <pre><tt> 'deleteall' LF</tt></pre> |
| 1033 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1034 | <div class="para"><p>This command is extremely useful if the frontend does not know |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1035 | (or does not care to know) what files are currently on the branch, |
| 1036 | and therefore cannot generate the proper <tt>filedelete</tt> commands to |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1037 | update the content.</p></div> |
| 1038 | <div class="para"><p>Issuing a <tt>filedeleteall</tt> followed by the needed <tt>filemodify</tt> |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1039 | commands to set the correct content will produce the same results |
| 1040 | as sending only the needed <tt>filemodify</tt> and <tt>filedelete</tt> commands. |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1041 | The <tt>filedeleteall</tt> approach may however require fast-import to use slightly |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1042 | more memory per active branch (less than 1 MiB for even most large |
| 1043 | projects); so frontends that can easily obtain only the affected |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1044 | paths for a commit are encouraged to do so.</p></div> |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 1045 | <h4 id="_tt_notemodify_tt"><tt>notemodify</tt></h4> |
| 1046 | <div class="para"><p>Included in a <tt>commit</tt> command to add a new note (annotating a given |
| 1047 | commit) or change the content of an existing note. This command has |
| 1048 | two different means of specifying the content of the note.</p></div> |
| 1049 | <div class="vlist"><dl> |
| 1050 | <dt> |
| 1051 | External data format |
| 1052 | </dt> |
| 1053 | <dd> |
| 1054 | <p> |
| 1055 | The data content for the note was already supplied by a prior |
| 1056 | <tt>blob</tt> command. The frontend just needs to connect it to the |
| 1057 | commit that is to be annotated. |
| 1058 | </p> |
| 1059 | <div class="literalblock"> |
| 1060 | <div class="content"> |
| 1061 | <pre><tt> 'N' SP <dataref> SP <committish> LF</tt></pre> |
| 1062 | </div></div> |
| 1063 | <div class="para"><p>Here <tt><dataref></tt> can be either a mark reference (<tt>:<idnum></tt>) |
| 1064 | set by a prior <tt>blob</tt> command, or a full 40-byte SHA-1 of an |
| 1065 | existing Git blob object.</p></div> |
| 1066 | </dd> |
| 1067 | <dt> |
| 1068 | Inline data format |
| 1069 | </dt> |
| 1070 | <dd> |
| 1071 | <p> |
| 1072 | The data content for the note has not been supplied yet. |
| 1073 | The frontend wants to supply it as part of this modify |
| 1074 | command. |
| 1075 | </p> |
| 1076 | <div class="literalblock"> |
| 1077 | <div class="content"> |
| 1078 | <pre><tt> 'N' SP 'inline' SP <committish> LF |
| 1079 | data</tt></pre> |
| 1080 | </div></div> |
| 1081 | <div class="para"><p>See below for a detailed description of the <tt>data</tt> command.</p></div> |
| 1082 | </dd> |
| 1083 | </dl></div> |
| 1084 | <div class="para"><p>In both formats <tt><committish></tt> is any of the commit specification |
| 1085 | expressions also accepted by <tt>from</tt> (see above).</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1086 | <h3 id="_tt_mark_tt"><tt>mark</tt></h3><div style="clear:left"></div> |
| 1087 | <div class="para"><p>Arranges for fast-import to save a reference to the current object, allowing |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1088 | the frontend to recall this object at a future point in time, without |
| 1089 | knowing its SHA-1. Here the current object is the object creation |
| 1090 | command the <tt>mark</tt> command appears within. This can be <tt>commit</tt>, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1091 | <tt>tag</tt>, and <tt>blob</tt>, but <tt>commit</tt> is the most common usage.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1092 | <div class="literalblock"> |
| 1093 | <div class="content"> |
| 1094 | <pre><tt> 'mark' SP ':' <idnum> LF</tt></pre> |
| 1095 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1096 | <div class="para"><p>where <tt><idnum></tt> is the number assigned by the frontend to this mark. |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1097 | The value of <tt><idnum></tt> is expressed as an ASCII decimal integer. |
| 1098 | The value 0 is reserved and cannot be used as |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1099 | a mark. Only values greater than or equal to 1 may be used as marks.</p></div> |
| 1100 | <div class="para"><p>New marks are created automatically. Existing marks can be moved |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1101 | to another object simply by reusing the same <tt><idnum></tt> in another |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1102 | <tt>mark</tt> command.</p></div> |
| 1103 | <h3 id="_tt_tag_tt"><tt>tag</tt></h3><div style="clear:left"></div> |
| 1104 | <div class="para"><p>Creates an annotated tag referring to a specific commit. To create |
| 1105 | lightweight (non-annotated) tags see the <tt>reset</tt> command below.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1106 | <div class="literalblock"> |
| 1107 | <div class="content"> |
| 1108 | <pre><tt> 'tag' SP <name> LF |
| 1109 | 'from' SP <committish> LF |
Junio C Hamano | 6d325df | 2010-01-01 00:02:47 | [diff] [blame] | 1110 | 'tagger' (SP <name>)? SP LT <email> GT SP <when> LF |
Junio C Hamano | ea5dae6 | 2007-05-10 23:25:08 | [diff] [blame] | 1111 | data</tt></pre> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1112 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1113 | <div class="para"><p>where <tt><name></tt> is the name of the tag to create.</p></div> |
| 1114 | <div class="para"><p>Tag names are automatically prefixed with <tt>refs/tags/</tt> when stored |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1115 | in Git, so importing the CVS branch symbol <tt>RELENG-1_0-FINAL</tt> would |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1116 | use just <tt>RELENG-1_0-FINAL</tt> for <tt><name></tt>, and fast-import will write the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1117 | corresponding ref as <tt>refs/tags/RELENG-1_0-FINAL</tt>.</p></div> |
| 1118 | <div class="para"><p>The value of <tt><name></tt> must be a valid refname in Git and therefore |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1119 | may contain forward slashes. As <tt>LF</tt> is not valid in a Git refname, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1120 | no quoting or escaping syntax is supported here.</p></div> |
| 1121 | <div class="para"><p>The <tt>from</tt> command is the same as in the <tt>commit</tt> command; see |
| 1122 | above for details.</p></div> |
| 1123 | <div class="para"><p>The <tt>tagger</tt> command uses the same format as <tt>committer</tt> within |
| 1124 | <tt>commit</tt>; again see above for details.</p></div> |
| 1125 | <div class="para"><p>The <tt>data</tt> command following <tt>tagger</tt> must supply the annotated tag |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1126 | message (see below for <tt>data</tt> command syntax). To import an empty |
| 1127 | tag message use a 0 length data. Tag messages are free-form and are |
| 1128 | not interpreted by Git. Currently they must be encoded in UTF-8, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1129 | as fast-import does not permit other encodings to be specified.</p></div> |
| 1130 | <div class="para"><p>Signing annotated tags during import from within fast-import is not |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1131 | supported. Trying to include your own PGP/GPG signature is not |
| 1132 | recommended, as the frontend does not (easily) have access to the |
| 1133 | complete set of bytes which normally goes into such a signature. |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1134 | If signing is required, create lightweight tags from within fast-import with |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1135 | <tt>reset</tt>, then create the annotated versions of those tags offline |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1136 | with the standard <em>git tag</em> process.</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1137 | <h3 id="_tt_reset_tt"><tt>reset</tt></h3><div style="clear:left"></div> |
| 1138 | <div class="para"><p>Creates (or recreates) the named branch, optionally starting from |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1139 | a specific revision. The reset command allows a frontend to issue |
| 1140 | a new <tt>from</tt> command for an existing branch, or to create a new |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1141 | branch from an existing commit without creating a new commit.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1142 | <div class="literalblock"> |
| 1143 | <div class="content"> |
| 1144 | <pre><tt> 'reset' SP <ref> LF |
| 1145 | ('from' SP <committish> LF)? |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1146 | LF?</tt></pre> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1147 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1148 | <div class="para"><p>For a detailed description of <tt><ref></tt> and <tt><committish></tt> see above |
| 1149 | under <tt>commit</tt> and <tt>from</tt>.</p></div> |
| 1150 | <div class="para"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div> |
| 1151 | <div class="para"><p>The <tt>reset</tt> command can also be used to create lightweight |
| 1152 | (non-annotated) tags. For example:</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1153 | <div class="exampleblock"> |
| 1154 | <div class="exampleblock-content"> |
| 1155 | <div class="literalblock"> |
| 1156 | <div class="content"> |
| 1157 | <pre><tt>reset refs/tags/938 |
| 1158 | from :938</tt></pre> |
| 1159 | </div></div> |
| 1160 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1161 | <div class="para"><p>would create the lightweight tag <tt>refs/tags/938</tt> referring to |
| 1162 | whatever commit mark <tt>:938</tt> references.</p></div> |
| 1163 | <h3 id="_tt_blob_tt"><tt>blob</tt></h3><div style="clear:left"></div> |
| 1164 | <div class="para"><p>Requests writing one file revision to the packfile. The revision |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1165 | is not connected to any commit; this connection must be formed in |
| 1166 | a subsequent <tt>commit</tt> command by referencing the blob through an |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1167 | assigned mark.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1168 | <div class="literalblock"> |
| 1169 | <div class="content"> |
| 1170 | <pre><tt> 'blob' LF |
| 1171 | mark? |
| 1172 | data</tt></pre> |
| 1173 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1174 | <div class="para"><p>The mark command is optional here as some frontends have chosen |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1175 | to generate the Git SHA-1 for the blob on their own, and feed that |
Junio C Hamano | 167b138 | 2010-01-31 23:04:31 | [diff] [blame] | 1176 | directly to <tt>commit</tt>. This is typically more work than it's worth |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1177 | however, as marks are inexpensive to store and easy to use.</p></div> |
| 1178 | <h3 id="_tt_data_tt"><tt>data</tt></h3><div style="clear:left"></div> |
| 1179 | <div class="para"><p>Supplies raw data (for use as blob/file content, commit messages, or |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1180 | annotated tag messages) to fast-import. Data can be supplied using an exact |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1181 | byte count or delimited with a terminating line. Real frontends |
| 1182 | intended for production-quality conversions should always use the |
| 1183 | exact byte count format, as it is more robust and performs better. |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1184 | The delimited format is intended primarily for testing fast-import.</p></div> |
| 1185 | <div class="para"><p>Comment lines appearing within the <tt><raw></tt> part of <tt>data</tt> commands |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1186 | are always taken to be part of the body of the data and are therefore |
| 1187 | never ignored by fast-import. This makes it safe to import any |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1188 | file/message content whose lines might start with <tt>#</tt>.</p></div> |
| 1189 | <div class="vlist"><dl> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1190 | <dt> |
| 1191 | Exact byte count format |
| 1192 | </dt> |
| 1193 | <dd> |
| 1194 | <p> |
| 1195 | The frontend must specify the number of bytes of data. |
| 1196 | </p> |
| 1197 | <div class="literalblock"> |
| 1198 | <div class="content"> |
| 1199 | <pre><tt> 'data' SP <count> LF |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1200 | <raw> LF?</tt></pre> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1201 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1202 | <div class="para"><p>where <tt><count></tt> is the exact number of bytes appearing within |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1203 | <tt><raw></tt>. The value of <tt><count></tt> is expressed as an ASCII decimal |
| 1204 | integer. The <tt>LF</tt> on either side of <tt><raw></tt> is not |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1205 | included in <tt><count></tt> and will not be included in the imported data.</p></div> |
| 1206 | <div class="para"><p>The <tt>LF</tt> after <tt><raw></tt> is optional (it used to be required) but |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1207 | recommended. Always including it makes debugging a fast-import |
| 1208 | stream easier as the next command always starts in column 0 |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1209 | of the next line, even if <tt><raw></tt> did not end with an <tt>LF</tt>.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1210 | </dd> |
| 1211 | <dt> |
| 1212 | Delimited format |
| 1213 | </dt> |
| 1214 | <dd> |
| 1215 | <p> |
| 1216 | A delimiter string is used to mark the end of the data. |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1217 | fast-import will compute the length by searching for the delimiter. |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 1218 | This format is primarily useful for testing and is not |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1219 | recommended for real data. |
| 1220 | </p> |
| 1221 | <div class="literalblock"> |
| 1222 | <div class="content"> |
| 1223 | <pre><tt> 'data' SP '<<' <delim> LF |
| 1224 | <raw> LF |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1225 | <delim> LF |
| 1226 | LF?</tt></pre> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1227 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1228 | <div class="para"><p>where <tt><delim></tt> is the chosen delimiter string. The string <tt><delim></tt> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1229 | must not appear on a line by itself within <tt><raw></tt>, as otherwise |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1230 | fast-import will think the data ends earlier than it really does. The <tt>LF</tt> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1231 | immediately trailing <tt><raw></tt> is part of <tt><raw></tt>. This is one of |
| 1232 | the limitations of the delimited format, it is impossible to supply |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1233 | a data chunk which does not have an LF as its last byte.</p></div> |
| 1234 | <div class="para"><p>The <tt>LF</tt> after <tt><delim> LF</tt> is optional (it used to be required).</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1235 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1236 | </dl></div> |
| 1237 | <h3 id="_tt_checkpoint_tt"><tt>checkpoint</tt></h3><div style="clear:left"></div> |
| 1238 | <div class="para"><p>Forces fast-import to close the current packfile, start a new one, and to |
| 1239 | save out all current branch refs, tags and marks.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1240 | <div class="literalblock"> |
| 1241 | <div class="content"> |
| 1242 | <pre><tt> 'checkpoint' LF |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1243 | LF?</tt></pre> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1244 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1245 | <div class="para"><p>Note that fast-import automatically switches packfiles when the current |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1246 | packfile reaches --max-pack-size, or 4 GiB, whichever limit is |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1247 | smaller. During an automatic packfile switch fast-import does not update |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1248 | the branch refs, tags or marks.</p></div> |
| 1249 | <div class="para"><p>As a <tt>checkpoint</tt> can require a significant amount of CPU time and |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1250 | disk IO (to compute the overall pack SHA-1 checksum, generate the |
| 1251 | corresponding index file, and update the refs) it can easily take |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1252 | several minutes for a single <tt>checkpoint</tt> command to complete.</p></div> |
| 1253 | <div class="para"><p>Frontends may choose to issue checkpoints during extremely large |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1254 | and long running imports, or when they need to allow another Git |
| 1255 | process access to a branch. However given that a 30 GiB Subversion |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1256 | repository can be loaded into Git through fast-import in about 3 hours, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1257 | explicit checkpointing may not be necessary.</p></div> |
| 1258 | <div class="para"><p>The <tt>LF</tt> after the command is optional (it used to be required).</p></div> |
| 1259 | <h3 id="_tt_progress_tt"><tt>progress</tt></h3><div style="clear:left"></div> |
| 1260 | <div class="para"><p>Causes fast-import to print the entire <tt>progress</tt> line unmodified to |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1261 | its standard output channel (file descriptor 1) when the command is |
| 1262 | processed from the input stream. The command otherwise has no impact |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1263 | on the current import, or on any of fast-import's internal state.</p></div> |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1264 | <div class="literalblock"> |
| 1265 | <div class="content"> |
| 1266 | <pre><tt> 'progress' SP <any> LF |
| 1267 | LF?</tt></pre> |
| 1268 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1269 | <div class="para"><p>The <tt><any></tt> part of the command may contain any sequence of bytes |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1270 | that does not contain <tt>LF</tt>. The <tt>LF</tt> after the command is optional. |
| 1271 | Callers may wish to process the output through a tool such as sed to |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1272 | remove the leading part of the line, for example:</p></div> |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1273 | <div class="exampleblock"> |
| 1274 | <div class="exampleblock-content"> |
| 1275 | <div class="literalblock"> |
| 1276 | <div class="content"> |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 1277 | <pre><tt>frontend | git fast-import | sed 's/^progress //'</tt></pre> |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1278 | </div></div> |
| 1279 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1280 | <div class="para"><p>Placing a <tt>progress</tt> command immediately after a <tt>checkpoint</tt> will |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1281 | inform the reader when the <tt>checkpoint</tt> has been completed and it |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1282 | can safely access the refs that fast-import updated.</p></div> |
Junio C Hamano | 6ce6b6c | 2010-01-18 01:25:50 | [diff] [blame] | 1283 | <h3 id="_tt_feature_tt"><tt>feature</tt></h3><div style="clear:left"></div> |
| 1284 | <div class="para"><p>Require that fast-import supports the specified feature, or abort if |
| 1285 | it does not.</p></div> |
| 1286 | <div class="literalblock"> |
| 1287 | <div class="content"> |
| 1288 | <pre><tt> 'feature' SP <feature> LF</tt></pre> |
| 1289 | </div></div> |
| 1290 | <div class="para"><p>The <feature> part of the command may be any string matching |
| 1291 | ^[a-zA-Z][a-zA-Z-]*$ and should be understood by fast-import.</p></div> |
| 1292 | <div class="para"><p>Feature work identical as their option counterparts with the |
| 1293 | exception of the import-marks feature, see below.</p></div> |
| 1294 | <div class="para"><p>The following features are currently supported:</p></div> |
| 1295 | <div class="ilist"><ul> |
| 1296 | <li> |
| 1297 | <p> |
| 1298 | date-format |
| 1299 | </p> |
| 1300 | </li> |
| 1301 | <li> |
| 1302 | <p> |
| 1303 | import-marks |
| 1304 | </p> |
| 1305 | </li> |
| 1306 | <li> |
| 1307 | <p> |
| 1308 | export-marks |
| 1309 | </p> |
| 1310 | </li> |
| 1311 | <li> |
| 1312 | <p> |
| 1313 | relative-marks |
| 1314 | </p> |
| 1315 | </li> |
| 1316 | <li> |
| 1317 | <p> |
| 1318 | no-relative-marks |
| 1319 | </p> |
| 1320 | </li> |
| 1321 | <li> |
| 1322 | <p> |
| 1323 | force |
| 1324 | </p> |
| 1325 | </li> |
| 1326 | </ul></div> |
| 1327 | <div class="para"><p>The import-marks behaves differently from when it is specified as |
| 1328 | commandline option in that only one "feature import-marks" is allowed |
| 1329 | per stream. Also, any --import-marks= specified on the commandline |
| 1330 | will override those from the stream (if any).</p></div> |
| 1331 | <h3 id="_tt_option_tt"><tt>option</tt></h3><div style="clear:left"></div> |
| 1332 | <div class="para"><p>Processes the specified option so that git fast-import behaves in a |
| 1333 | way that suits the frontend's needs. |
| 1334 | Note that options specified by the frontend are overridden by any |
| 1335 | options the user may specify to git fast-import itself.</p></div> |
| 1336 | <div class="literalblock"> |
| 1337 | <div class="content"> |
| 1338 | <pre><tt> 'option' SP <option> LF</tt></pre> |
| 1339 | </div></div> |
| 1340 | <div class="para"><p>The <tt><option></tt> part of the command may contain any of the options |
| 1341 | listed in the OPTIONS section that do not change import semantics, |
| 1342 | without the leading <em>--</em> and is treated in the same way.</p></div> |
| 1343 | <div class="para"><p>Option commands must be the first commands on the input (not counting |
| 1344 | feature commands), to give an option command after any non-option |
| 1345 | command is an error.</p></div> |
| 1346 | <div class="para"><p>The following commandline options change import semantics and may therefore |
| 1347 | not be passed as option:</p></div> |
| 1348 | <div class="ilist"><ul> |
| 1349 | <li> |
| 1350 | <p> |
| 1351 | date-format |
| 1352 | </p> |
| 1353 | </li> |
| 1354 | <li> |
| 1355 | <p> |
| 1356 | import-marks |
| 1357 | </p> |
| 1358 | </li> |
| 1359 | <li> |
| 1360 | <p> |
| 1361 | export-marks |
| 1362 | </p> |
| 1363 | </li> |
| 1364 | <li> |
| 1365 | <p> |
| 1366 | force |
| 1367 | </p> |
| 1368 | </li> |
| 1369 | </ul></div> |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1370 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1371 | <h2 id="_crash_reports">Crash Reports</h2> |
Junio C Hamano | 2139193 | 2008-02-16 10:02:54 | [diff] [blame] | 1372 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1373 | <div class="para"><p>If fast-import is supplied invalid input it will terminate with a |
Junio C Hamano | 2139193 | 2008-02-16 10:02:54 | [diff] [blame] | 1374 | non-zero exit status and create a crash report in the top level of |
| 1375 | the Git repository it was importing into. Crash reports contain |
| 1376 | a snapshot of the internal fast-import state as well as the most |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1377 | recent commands that lead up to the crash.</p></div> |
| 1378 | <div class="para"><p>All recent commands (including stream comments, file changes and |
Junio C Hamano | 2139193 | 2008-02-16 10:02:54 | [diff] [blame] | 1379 | progress commands) are shown in the command history within the crash |
| 1380 | report, but raw file data and commit messages are excluded from the |
| 1381 | crash report. This exclusion saves space within the report file |
| 1382 | and reduces the amount of buffering that fast-import must perform |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1383 | during execution.</p></div> |
| 1384 | <div class="para"><p>After writing a crash report fast-import will close the current |
Junio C Hamano | 2139193 | 2008-02-16 10:02:54 | [diff] [blame] | 1385 | packfile and export the marks table. This allows the frontend |
| 1386 | developer to inspect the repository state and resume the import from |
| 1387 | the point where it crashed. The modified branches and tags are not |
| 1388 | updated during a crash, as the import did not complete successfully. |
| 1389 | Branch and tag information can be found in the crash report and |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1390 | must be applied manually if the update is needed.</p></div> |
| 1391 | <div class="para"><p>An example crash:</p></div> |
Junio C Hamano | 2139193 | 2008-02-16 10:02:54 | [diff] [blame] | 1392 | <div class="exampleblock"> |
| 1393 | <div class="exampleblock-content"> |
| 1394 | <div class="literalblock"> |
| 1395 | <div class="content"> |
| 1396 | <pre><tt>$ cat >in <<END_OF_INPUT |
| 1397 | # my very first test commit |
| 1398 | commit refs/heads/master |
| 1399 | committer Shawn O. Pearce <spearce> 19283 -0400 |
| 1400 | # who is that guy anyway? |
| 1401 | data <<EOF |
| 1402 | this is my commit |
| 1403 | EOF |
| 1404 | M 644 inline .gitignore |
| 1405 | data <<EOF |
| 1406 | .gitignore |
| 1407 | EOF |
| 1408 | M 777 inline bob |
| 1409 | END_OF_INPUT</tt></pre> |
| 1410 | </div></div> |
| 1411 | <div class="literalblock"> |
| 1412 | <div class="content"> |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 1413 | <pre><tt>$ git fast-import <in |
Junio C Hamano | 2139193 | 2008-02-16 10:02:54 | [diff] [blame] | 1414 | fatal: Corrupt mode: M 777 inline bob |
| 1415 | fast-import: dumping crash report to .git/fast_import_crash_8434</tt></pre> |
| 1416 | </div></div> |
| 1417 | <div class="literalblock"> |
| 1418 | <div class="content"> |
| 1419 | <pre><tt>$ cat .git/fast_import_crash_8434 |
| 1420 | fast-import crash report: |
| 1421 | fast-import process: 8434 |
| 1422 | parent process : 1391 |
| 1423 | at Sat Sep 1 00:58:12 2007</tt></pre> |
| 1424 | </div></div> |
| 1425 | <div class="literalblock"> |
| 1426 | <div class="content"> |
| 1427 | <pre><tt>fatal: Corrupt mode: M 777 inline bob</tt></pre> |
| 1428 | </div></div> |
| 1429 | <div class="literalblock"> |
| 1430 | <div class="content"> |
| 1431 | <pre><tt>Most Recent Commands Before Crash |
| 1432 | --------------------------------- |
| 1433 | # my very first test commit |
| 1434 | commit refs/heads/master |
| 1435 | committer Shawn O. Pearce <spearce> 19283 -0400 |
| 1436 | # who is that guy anyway? |
| 1437 | data <<EOF |
| 1438 | M 644 inline .gitignore |
| 1439 | data <<EOF |
| 1440 | * M 777 inline bob</tt></pre> |
| 1441 | </div></div> |
| 1442 | <div class="literalblock"> |
| 1443 | <div class="content"> |
| 1444 | <pre><tt>Active Branch LRU |
| 1445 | ----------------- |
| 1446 | active_branches = 1 cur, 5 max</tt></pre> |
| 1447 | </div></div> |
| 1448 | <div class="literalblock"> |
| 1449 | <div class="content"> |
| 1450 | <pre><tt>pos clock name |
| 1451 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1452 | 1) 0 refs/heads/master</tt></pre> |
| 1453 | </div></div> |
| 1454 | <div class="literalblock"> |
| 1455 | <div class="content"> |
| 1456 | <pre><tt>Inactive Branches |
| 1457 | ----------------- |
| 1458 | refs/heads/master: |
| 1459 | status : active loaded dirty |
| 1460 | tip commit : 0000000000000000000000000000000000000000 |
| 1461 | old tree : 0000000000000000000000000000000000000000 |
| 1462 | cur tree : 0000000000000000000000000000000000000000 |
| 1463 | commit clock: 0 |
| 1464 | last pack :</tt></pre> |
| 1465 | </div></div> |
| 1466 | <div class="literalblock"> |
| 1467 | <div class="content"> |
| 1468 | <pre><tt>------------------- |
| 1469 | END OF CRASH REPORT</tt></pre> |
| 1470 | </div></div> |
| 1471 | </div></div> |
| 1472 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1473 | <h2 id="_tips_and_tricks">Tips and Tricks</h2> |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1474 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1475 | <div class="para"><p>The following tips and tricks have been collected from various |
| 1476 | users of fast-import, and are offered here as suggestions.</p></div> |
| 1477 | <h3 id="_use_one_mark_per_commit">Use One Mark Per Commit</h3><div style="clear:left"></div> |
| 1478 | <div class="para"><p>When doing a repository conversion, use a unique mark per commit |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1479 | (<tt>mark :<n></tt>) and supply the --export-marks option on the command |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1480 | line. fast-import will dump a file which lists every mark and the Git |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1481 | object SHA-1 that corresponds to it. If the frontend can tie |
| 1482 | the marks back to the source repository, it is easy to verify the |
| 1483 | accuracy and completeness of the import by comparing each Git |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1484 | commit to the corresponding source revision.</p></div> |
| 1485 | <div class="para"><p>Coming from a system such as Perforce or Subversion this should be |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1486 | quite simple, as the fast-import mark can also be the Perforce changeset |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1487 | number or the Subversion revision number.</p></div> |
| 1488 | <h3 id="_freely_skip_around_branches">Freely Skip Around Branches</h3><div style="clear:left"></div> |
| 1489 | <div class="para"><p>Don't bother trying to optimize the frontend to stick to one branch |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1490 | at a time during an import. Although doing so might be slightly |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1491 | faster for fast-import, it tends to increase the complexity of the frontend |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1492 | code considerably.</p></div> |
| 1493 | <div class="para"><p>The branch LRU builtin to fast-import tends to behave very well, and the |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1494 | cost of activating an inactive branch is so low that bouncing around |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1495 | between branches has virtually no impact on import performance.</p></div> |
| 1496 | <h3 id="_handling_renames">Handling Renames</h3><div style="clear:left"></div> |
| 1497 | <div class="para"><p>When importing a renamed file or directory, simply delete the old |
Junio C Hamano | 9dd8bb0 | 2007-02-12 07:15:35 | [diff] [blame] | 1498 | name(s) and modify the new name(s) during the corresponding commit. |
| 1499 | Git performs rename detection after-the-fact, rather than explicitly |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1500 | during a commit.</p></div> |
| 1501 | <h3 id="_use_tag_fixup_branches">Use Tag Fixup Branches</h3><div style="clear:left"></div> |
| 1502 | <div class="para"><p>Some other SCM systems let the user create a tag from multiple |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1503 | files which are not from the same commit/changeset. Or to create |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1504 | tags which are a subset of the files available in the repository.</p></div> |
| 1505 | <div class="para"><p>Importing these tags as-is in Git is impossible without making at |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1506 | least one commit which “fixes up” the files to match the content |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1507 | of the tag. Use fast-import's <tt>reset</tt> command to reset a dummy branch |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1508 | outside of your normal branch space to the base commit for the tag, |
| 1509 | then commit one or more file fixup commits, and finally tag the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1510 | dummy branch.</p></div> |
| 1511 | <div class="para"><p>For example since all normal branches are stored under <tt>refs/heads/</tt> |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1512 | name the tag fixup branch <tt>TAG_FIXUP</tt>. This way it is impossible for |
| 1513 | the fixup branch used by the importer to have namespace conflicts |
| 1514 | with real branches imported from the source (the name <tt>TAG_FIXUP</tt> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1515 | is not <tt>refs/heads/TAG_FIXUP</tt>).</p></div> |
| 1516 | <div class="para"><p>When committing fixups, consider using <tt>merge</tt> to connect the |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1517 | commit(s) which are supplying file revisions to the fixup branch. |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1518 | Doing so will allow tools such as <em>git blame</em> to track |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1519 | through the real commit history and properly annotate the source |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1520 | files.</p></div> |
| 1521 | <div class="para"><p>After fast-import terminates the frontend will need to do <tt>rm .git/TAG_FIXUP</tt> |
| 1522 | to remove the dummy branch.</p></div> |
| 1523 | <h3 id="_import_now_repack_later">Import Now, Repack Later</h3><div style="clear:left"></div> |
| 1524 | <div class="para"><p>As soon as fast-import completes the Git repository is completely valid |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 1525 | and ready for use. Typically this takes only a very short time, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1526 | even for considerably large projects (100,000+ commits).</p></div> |
| 1527 | <div class="para"><p>However repacking the repository is necessary to improve data |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1528 | locality and access performance. It can also take hours on extremely |
| 1529 | large projects (especially if -f and a large --window parameter is |
| 1530 | used). Since repacking is safe to run alongside readers and writers, |
| 1531 | run the repack in the background and let it finish when it finishes. |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1532 | There is no reason to wait to explore your new Git project!</p></div> |
| 1533 | <div class="para"><p>If you choose to wait for the repack, don't try to run benchmarks |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1534 | or performance tests until repacking is completed. fast-import outputs |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1535 | suboptimal packfiles that are simply never seen in real use |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1536 | situations.</p></div> |
| 1537 | <h3 id="_repacking_historical_data">Repacking Historical Data</h3><div style="clear:left"></div> |
| 1538 | <div class="para"><p>If you are repacking very old imported data (e.g. older than the |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1539 | last year), consider expending some extra CPU time and supplying |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1540 | --window=50 (or higher) when you run <em>git repack</em>. |
Junio C Hamano | dfc4ce7 | 2007-02-07 23:17:29 | [diff] [blame] | 1541 | This will take longer, but will also produce a smaller packfile. |
| 1542 | You only need to expend the effort once, and everyone using your |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1543 | project will benefit from the smaller repository.</p></div> |
| 1544 | <h3 id="_include_some_progress_messages">Include Some Progress Messages</h3><div style="clear:left"></div> |
| 1545 | <div class="para"><p>Every once in a while have your frontend emit a <tt>progress</tt> message |
Junio C Hamano | e52cf78 | 2007-08-19 19:15:52 | [diff] [blame] | 1546 | to fast-import. The contents of the messages are entirely free-form, |
| 1547 | so one suggestion would be to output the current month and year |
| 1548 | each time the current commit date moves into the next month. |
| 1549 | Your users will feel better knowing how much of the data stream |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1550 | has been processed.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1551 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1552 | <h2 id="_packfile_optimization">Packfile Optimization</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1553 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1554 | <div class="para"><p>When packing a blob fast-import always attempts to deltify against the last |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1555 | blob written. Unless specifically arranged for by the frontend, |
| 1556 | this will probably not be a prior version of the same file, so the |
| 1557 | generated delta will not be the smallest possible. The resulting |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1558 | packfile will be compressed, but will not be optimal.</p></div> |
| 1559 | <div class="para"><p>Frontends which have efficient access to all revisions of a |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1560 | single file (for example reading an RCS/CVS ,v file) can choose |
| 1561 | to supply all revisions of that file as a sequence of consecutive |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1562 | <tt>blob</tt> commands. This allows fast-import to deltify the different file |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1563 | revisions against each other, saving space in the final packfile. |
| 1564 | Marks can be used to later identify individual file revisions during |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1565 | a sequence of <tt>commit</tt> commands.</p></div> |
| 1566 | <div class="para"><p>The packfile(s) created by fast-import do not encourage good disk access |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1567 | patterns. This is caused by fast-import writing the data in the order |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1568 | it is received on standard input, while Git typically organizes |
| 1569 | data within packfiles to make the most recent (current tip) data |
| 1570 | appear before historical data. Git also clusters commits together, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1571 | speeding up revision traversal through better cache locality.</p></div> |
| 1572 | <div class="para"><p>For this reason it is strongly recommended that users repack the |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1573 | repository with <tt>git repack -a -d</tt> after fast-import completes, allowing |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1574 | Git to reorganize the packfiles for faster data access. If blob |
| 1575 | deltas are suboptimal (see above) then also adding the <tt>-f</tt> option |
| 1576 | to force recomputation of all deltas can significantly reduce the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1577 | final packfile size (30-50% smaller can be quite typical).</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1578 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1579 | <h2 id="_memory_utilization">Memory Utilization</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1580 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1581 | <div class="para"><p>There are a number of factors which affect how much memory fast-import |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1582 | requires to perform an import. Like critical sections of core |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 1583 | Git, fast-import uses its own memory allocators to amortize any overheads |
| 1584 | associated with malloc. In practice fast-import tends to amortize any |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1585 | malloc overheads to 0, due to its use of large block allocations.</p></div> |
| 1586 | <h3 id="_per_object">per object</h3><div style="clear:left"></div> |
| 1587 | <div class="para"><p>fast-import maintains an in-memory structure for every object written in |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1588 | this execution. On a 32 bit system the structure is 32 bytes, |
| 1589 | on a 64 bit system the structure is 40 bytes (due to the larger |
| 1590 | pointer sizes). Objects in the table are not deallocated until |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1591 | fast-import terminates. Importing 2 million objects on a 32 bit system |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1592 | will require approximately 64 MiB of memory.</p></div> |
| 1593 | <div class="para"><p>The object table is actually a hashtable keyed on the object name |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1594 | (the unique SHA-1). This storage configuration allows fast-import to reuse |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1595 | an existing or already written object and avoid writing duplicates |
| 1596 | to the output packfile. Duplicate blobs are surprisingly common |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1597 | in an import, typically due to branch merges in the source.</p></div> |
| 1598 | <h3 id="_per_mark">per mark</h3><div style="clear:left"></div> |
| 1599 | <div class="para"><p>Marks are stored in a sparse array, using 1 pointer (4 bytes or 8 |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1600 | bytes, depending on pointer size) per mark. Although the array |
| 1601 | is sparse, frontends are still strongly encouraged to use marks |
| 1602 | between 1 and n, where n is the total number of marks required for |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1603 | this import.</p></div> |
| 1604 | <h3 id="_per_branch">per branch</h3><div style="clear:left"></div> |
| 1605 | <div class="para"><p>Branches are classified as active and inactive. The memory usage |
| 1606 | of the two classes is significantly different.</p></div> |
| 1607 | <div class="para"><p>Inactive branches are stored in a structure which uses 96 or 120 |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1608 | bytes (32 bit or 64 bit systems, respectively), plus the length of |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1609 | the branch name (typically under 200 bytes), per branch. fast-import will |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1610 | easily handle as many as 10,000 inactive branches in under 2 MiB |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1611 | of memory.</p></div> |
| 1612 | <div class="para"><p>Active branches have the same overhead as inactive branches, but |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1613 | also contain copies of every tree that has been recently modified on |
| 1614 | that branch. If subtree <tt>include</tt> has not been modified since the |
| 1615 | branch became active, its contents will not be loaded into memory, |
| 1616 | but if subtree <tt>src</tt> has been modified by a commit since the branch |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1617 | became active, then its contents will be loaded in memory.</p></div> |
| 1618 | <div class="para"><p>As active branches store metadata about the files contained on that |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1619 | branch, their in-memory storage size can grow to a considerable size |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1620 | (see below).</p></div> |
| 1621 | <div class="para"><p>fast-import automatically moves active branches to inactive status based on |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1622 | a simple least-recently-used algorithm. The LRU chain is updated on |
| 1623 | each <tt>commit</tt> command. The maximum number of active branches can be |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1624 | increased or decreased on the command line with --active-branches=.</p></div> |
| 1625 | <h3 id="_per_active_tree">per active tree</h3><div style="clear:left"></div> |
| 1626 | <div class="para"><p>Trees (aka directories) use just 12 bytes of memory on top of the |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1627 | memory required for their entries (see “per active file” below). |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 1628 | The cost of a tree is virtually 0, as its overhead amortizes out |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1629 | over the individual file entries.</p></div> |
| 1630 | <h3 id="_per_active_file_entry">per active file entry</h3><div style="clear:left"></div> |
| 1631 | <div class="para"><p>Files (and pointers to subtrees) within active trees require 52 or 64 |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1632 | bytes (32/64 bit platforms) per entry. To conserve space, file and |
| 1633 | tree names are pooled in a common string table, allowing the filename |
| 1634 | “Makefile” to use just 16 bytes (after including the string header |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1635 | overhead) no matter how many times it occurs within the project.</p></div> |
| 1636 | <div class="para"><p>The active branch LRU, when coupled with the filename string pool |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1637 | and lazy loading of subtrees, allows fast-import to efficiently import |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1638 | projects with 2,000+ branches and 45,114+ files in a very limited |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1639 | memory footprint (less than 2.7 MiB per active branch).</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1640 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1641 | <h2 id="_author">Author</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1642 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1643 | <div class="para"><p>Written by Shawn O. Pearce <spearce@spearce.org>.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1644 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1645 | <h2 id="_documentation">Documentation</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1646 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1647 | <div class="para"><p>Documentation by Shawn O. Pearce <spearce@spearce.org>.</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1648 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1649 | <h2 id="_git">GIT</h2> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1650 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1651 | <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1652 | </div> |
| 1653 | <div id="footer"> |
| 1654 | <div id="footer-text"> |
Junio C Hamano | d330432 | 2010-02-05 03:28:27 | [diff] [blame^] | 1655 | Last updated 2010-02-05 03:28:09 UTC |
Junio C Hamano | df60f44 | 2007-02-07 05:52:37 | [diff] [blame] | 1656 | </div> |
| 1657 | </div> |
| 1658 | </body> |
| 1659 | </html> |