~ubuntu-branches/ubuntu/edgy/git-core/edgy-backports

« back to all changes in this revision

Viewing changes to Documentation/git-sh-setup.txt

  • Committer: Package Import Robot
  • Author(s): LaMont Jones
  • Date: 2007-11-29 07:28:44 UTC
  • mfrom: (8.1.2 dapper-backports)
  • Revision ID: package-import@ubuntu.com-20071129072844-umsb7y3140yhxkth
Tags: 1:1.5.3.6-1.1~dapper1
* backport to dapper et al.
  - debian/rules changes to support source:Upstream-Version for old dpkg.
  - allow asciidoc (>7.0.2-3)

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
DESCRIPTION
13
13
-----------
14
14
 
15
 
Sets up the normal git environment variables and a few helper functions
16
 
(currently just "die()"), and returns OK if it all looks like a git archive.
17
 
So, to make the rest of the git scripts more careful and readable,
18
 
use it as follows:
19
 
 
20
 
-------------------------------------------------
21
 
. git-sh-setup || die "Not a git archive"
22
 
-------------------------------------------------
 
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.
 
18
 
 
19
The `git-sh-setup` scriptlet is designed to be sourced (using
 
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
 
 
47
is_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
 
 
52
cd_to_toplevel::
 
53
        runs chdir to the toplevel of the working tree.
 
54
 
 
55
require_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
 
23
60
 
24
61
Author
25
62
------
32
69
GIT
33
70
---
34
71
Part of the gitlink:git[7] suite
35