CheckoutOptions describes how a checkout operation should be performed.
| 346 | |
| 347 | // CheckoutOptions describes how a checkout operation should be performed. |
| 348 | type CheckoutOptions struct { |
| 349 | // Hash is the hash of a commit or tag to be checked out. If used, HEAD |
| 350 | // will be in detached mode. If Create is not used, Branch and Hash are |
| 351 | // mutually exclusive. |
| 352 | Hash plumbing.Hash |
| 353 | // Branch to be checked out, if Branch and Hash are empty is set to `master`. |
| 354 | Branch plumbing.ReferenceName |
| 355 | // Create a new branch named Branch and start it at Hash. |
| 356 | Create bool |
| 357 | // Force, if true when switching branches, proceed even if the index or the |
| 358 | // working tree differs from HEAD. This is used to throw away local changes |
| 359 | Force bool |
| 360 | // Keep, if true when switching branches, local changes (the index or the |
| 361 | // working tree changes) will be kept so that they can be committed to the |
| 362 | // target branch. Force and Keep are mutually exclusive, should not be both |
| 363 | // set to true. |
| 364 | Keep bool |
| 365 | // SparseCheckoutDirectories |
| 366 | SparseCheckoutDirectories []string |
| 367 | } |
| 368 | |
| 369 | // Validate validates the fields and sets the default values. |
| 370 | func (o *CheckoutOptions) Validate() error { |
nothing calls this directly
no outgoing calls
no test coverage detected