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