Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-sh-setup(1) |
| 2 | =============== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 6 | git-sh-setup - Common git shell script setup code |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
Junio C Hamano | bb8e996 | 2008-06-30 09:05:08 | [diff] [blame] | 10 | '. "$(git --exec-path)/git-sh-setup"' |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 11 | |
| 12 | DESCRIPTION |
| 13 | ----------- |
| 14 | |
Junio C Hamano | f9771f6 | 2007-01-17 17:42:30 | [diff] [blame] | 15 | This is not a command the end user would want to run. Ever. |
| 16 | This documentation is meant for people who are studying the |
| 17 | Porcelain-ish scripts and/or are writing new ones. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 18 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 19 | The 'git-sh-setup' scriptlet is designed to be sourced (using |
Junio C Hamano | f9771f6 | 2007-01-17 17:42:30 | [diff] [blame] | 20 | `.`) by other shell scripts to set up some variables pointing at |
| 21 | the normal git directories and a few helper shell functions. |
| 22 | |
| 23 | Before sourcing it, your script should set up a few variables; |
| 24 | `USAGE` (and `LONG_USAGE`, if any) is used to define message |
| 25 | given by `usage()` shell function. `SUBDIRECTORY_OK` can be set |
| 26 | if the script can run from a subdirectory of the working tree |
| 27 | (some commands do not). |
| 28 | |
| 29 | The scriptlet sets `GIT_DIR` and `GIT_OBJECT_DIRECTORY` shell |
| 30 | variables, but does *not* export them to the environment. |
| 31 | |
| 32 | FUNCTIONS |
| 33 | --------- |
| 34 | |
| 35 | die:: |
| 36 | exit after emitting the supplied error message to the |
| 37 | standard error stream. |
| 38 | |
| 39 | usage:: |
| 40 | die with the usage message. |
| 41 | |
| 42 | set_reflog_action:: |
| 43 | set the message that will be recorded to describe the |
| 44 | end-user action in the reflog, when the script updates a |
| 45 | ref. |
| 46 | |
Junio C Hamano | 91baf10 | 2007-12-31 09:44:26 | [diff] [blame] | 47 | git_editor:: |
| 48 | runs an editor of user's choice (GIT_EDITOR, core.editor, VISUAL or |
| 49 | EDITOR) on a given file, but error out if no editor is specified |
| 50 | and the terminal is dumb. |
| 51 | |
Junio C Hamano | f9771f6 | 2007-01-17 17:42:30 | [diff] [blame] | 52 | is_bare_repository:: |
| 53 | outputs `true` or `false` to the standard output stream |
| 54 | to indicate if the repository is a bare repository |
| 55 | (i.e. without an associated working tree). |
| 56 | |
| 57 | cd_to_toplevel:: |
| 58 | runs chdir to the toplevel of the working tree. |
| 59 | |
| 60 | require_work_tree:: |
| 61 | checks if the repository is a bare repository, and dies |
| 62 | if so. Used by scripts that require working tree |
| 63 | (e.g. `checkout`). |
| 64 | |
Junio C Hamano | 91baf10 | 2007-12-31 09:44:26 | [diff] [blame] | 65 | get_author_ident_from_commit:: |
| 66 | outputs code for use with eval to set the GIT_AUTHOR_NAME, |
| 67 | GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit. |
| 68 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 69 | |
| 70 | Author |
| 71 | ------ |
| 72 | Written by Linus Torvalds <torvalds@osdl.org> |
| 73 | |
| 74 | Documentation |
| 75 | -------------- |
| 76 | Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>. |
| 77 | |
| 78 | GIT |
| 79 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 80 | Part of the linkgit:git[1] suite |