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