updated git doc
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-sh-setup.xml
blobb9ff2eb2ea6d1af0401e0967a4a75bbabf6ccce8
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-sh-setup(1)">\r
5 <articleinfo>\r
6     <title>git-sh-setup(1)</title>\r
7 <indexterm>\r
8 <primary>git-sh-setup(1)</primary>\r
9 </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-sh-setup - Common git shell script setup code</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <blockquote>\r
18 <literallayout><emphasis>. "$(git --exec-path)/git-sh-setup"</emphasis></literallayout>\r
19 </blockquote>\r
20 </simplesect>\r
21 <simplesect id="_description">\r
22 <title>DESCRIPTION</title>\r
23 <simpara>This is not a command the end user would want to run.  Ever.\r
24 This documentation is meant for people who are studying the\r
25 Porcelain-ish scripts and/or are writing new ones.</simpara>\r
26 <simpara>The <emphasis>git sh-setup</emphasis> scriptlet is designed to be sourced (using\r
27 <emphasis>.</emphasis>) by other shell scripts to set up some variables pointing at\r
28 the normal git directories and a few helper shell functions.</simpara>\r
29 <simpara>Before sourcing it, your script should set up a few variables;\r
30 <emphasis>USAGE</emphasis> (and <emphasis>LONG_USAGE</emphasis>, if any) is used to define message\r
31 given by <emphasis>usage()</emphasis> shell function.  <emphasis>SUBDIRECTORY_OK</emphasis> can be set\r
32 if the script can run from a subdirectory of the working tree\r
33 (some commands do not).</simpara>\r
34 <simpara>The scriptlet sets <emphasis>GIT_DIR</emphasis> and <emphasis>GIT_OBJECT_DIRECTORY</emphasis> shell\r
35 variables, but does <emphasis role="strong">not</emphasis> export them to the environment.</simpara>\r
36 </simplesect>\r
37 <simplesect id="_functions">\r
38 <title>FUNCTIONS</title>\r
39 <variablelist>\r
40 <varlistentry>\r
41 <term>\r
42 die\r
43 </term>\r
44 <listitem>\r
45 <simpara>\r
46         exit after emitting the supplied error message to the\r
47         standard error stream.\r
48 </simpara>\r
49 </listitem>\r
50 </varlistentry>\r
51 <varlistentry>\r
52 <term>\r
53 usage\r
54 </term>\r
55 <listitem>\r
56 <simpara>\r
57         die with the usage message.\r
58 </simpara>\r
59 </listitem>\r
60 </varlistentry>\r
61 <varlistentry>\r
62 <term>\r
63 set_reflog_action\r
64 </term>\r
65 <listitem>\r
66 <simpara>\r
67         set the message that will be recorded to describe the\r
68         end-user action in the reflog, when the script updates a\r
69         ref.\r
70 </simpara>\r
71 </listitem>\r
72 </varlistentry>\r
73 <varlistentry>\r
74 <term>\r
75 git_editor\r
76 </term>\r
77 <listitem>\r
78 <simpara>\r
79         runs an editor of user's choice (GIT_EDITOR, core.editor, VISUAL or\r
80         EDITOR) on a given file, but error out if no editor is specified\r
81         and the terminal is dumb.\r
82 </simpara>\r
83 </listitem>\r
84 </varlistentry>\r
85 <varlistentry>\r
86 <term>\r
87 is_bare_repository\r
88 </term>\r
89 <listitem>\r
90 <simpara>\r
91         outputs <emphasis>true</emphasis> or <emphasis>false</emphasis> to the standard output stream\r
92         to indicate if the repository is a bare repository\r
93         (i.e. without an associated working tree).\r
94 </simpara>\r
95 </listitem>\r
96 </varlistentry>\r
97 <varlistentry>\r
98 <term>\r
99 cd_to_toplevel\r
100 </term>\r
101 <listitem>\r
102 <simpara>\r
103         runs chdir to the toplevel of the working tree.\r
104 </simpara>\r
105 </listitem>\r
106 </varlistentry>\r
107 <varlistentry>\r
108 <term>\r
109 require_work_tree\r
110 </term>\r
111 <listitem>\r
112 <simpara>\r
113         checks if the current directory is within the working tree\r
114         of the repository, and otherwise dies.\r
115 </simpara>\r
116 </listitem>\r
117 </varlistentry>\r
118 <varlistentry>\r
119 <term>\r
120 require_work_tree_exists\r
121 </term>\r
122 <listitem>\r
123 <simpara>\r
124         checks if the working tree associated with the repository\r
125         exists, and otherwise dies.  Often done before calling\r
126         cd_to_toplevel, which is impossible to do if there is no\r
127         working tree.\r
128 </simpara>\r
129 </listitem>\r
130 </varlistentry>\r
131 <varlistentry>\r
132 <term>\r
133 require_clean_work_tree &lt;action&gt; [&lt;hint&gt;]\r
134 </term>\r
135 <listitem>\r
136 <simpara>\r
137         checks that the working tree and index associated with the\r
138         repository have no uncommitted changes to tracked files.\r
139         Otherwise it emits an error message of the form <emphasis>Cannot\r
140         &lt;action&gt;: &lt;reason&gt;. &lt;hint&gt;</emphasis>, and dies.  Example:\r
141 </simpara>\r
142 <screen>require_clean_work_tree rebase "Please commit or stash them."</screen>\r
143 </listitem>\r
144 </varlistentry>\r
145 <varlistentry>\r
146 <term>\r
147 get_author_ident_from_commit\r
148 </term>\r
149 <listitem>\r
150 <simpara>\r
151         outputs code for use with eval to set the GIT_AUTHOR_NAME,\r
152         GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit.\r
153 </simpara>\r
154 </listitem>\r
155 </varlistentry>\r
156 </variablelist>\r
157 </simplesect>\r
158 <simplesect id="_git">\r
159 <title>GIT</title>\r
160 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
161 </simplesect>\r
162 </article>\r