]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-sh-setup.txt
autoconf: Add tests for memmem, strtoumax and mkdtemp functions
[thirdparty/git.git] / Documentation / git-sh-setup.txt
CommitLineData
215a7ad1
JH
1git-sh-setup(1)
2===============
7fc9d69f
JH
3
4NAME
5----
7bd7f280 6git-sh-setup - Common git shell script setup code
7fc9d69f
JH
7
8SYNOPSIS
9--------
215a7ad1 10'git-sh-setup'
7fc9d69f
JH
11
12DESCRIPTION
13-----------
7fc9d69f 14
850844e2
JH
15This 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.
18
19The `git-sh-setup` scriptlet is designed to be sourced (using
20`.`) 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::
36 exit after emitting the supplied error message to the
37 standard error stream.
38
39usage::
40 die with the usage message.
41
42set_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
47is_bare_repository::
48 outputs `true` or `false` to the standard output stream
49 to indicate if the repository is a bare repository
50 (i.e. without an associated working tree).
51
52cd_to_toplevel::
53 runs chdir to the toplevel of the working tree.
54
55require_work_tree::
56 checks if the repository is a bare repository, and dies
57 if so. Used by scripts that require working tree
58 (e.g. `checkout`).
59
7fc9d69f
JH
60
61Author
62------
63Written by Linus Torvalds <torvalds@osdl.org>
64
65Documentation
66--------------
67Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
68
69GIT
70---
a7154e91 71Part of the gitlink:git[7] suite