git-sh-setup.1   [plain text]


'\" t
.\"     Title: git-sh-setup
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\"      Date: 06/01/2011
.\"    Manual: Git Manual
.\"    Source: Git 1.7.5.4
.\"  Language: English
.\"
.TH "GIT\-SH\-SETUP" "1" "06/01/2011" "Git 1\&.7\&.5\&.4" "Git Manual"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-sh-setup \- Common git shell script setup code
.SH "SYNOPSIS"
.sp
\fI\&. "$(git \-\-exec\-path)/git\-sh\-setup"\fR
.SH "DESCRIPTION"
.sp
This is not a command the end user would want to run\&. Ever\&. This documentation is meant for people who are studying the Porcelain\-ish scripts and/or are writing new ones\&.
.sp
The \fIgit sh\-setup\fR scriptlet is designed to be sourced (using \&.) by other shell scripts to set up some variables pointing at the normal git directories and a few helper shell functions\&.
.sp
Before sourcing it, your script should set up a few variables; USAGE (and LONG_USAGE, if any) is used to define message given by usage() shell function\&. SUBDIRECTORY_OK can be set if the script can run from a subdirectory of the working tree (some commands do not)\&.
.sp
The scriptlet sets GIT_DIR and GIT_OBJECT_DIRECTORY shell variables, but does \fBnot\fR export them to the environment\&.
.SH "FUNCTIONS"
.PP
die
.RS 4
exit after emitting the supplied error message to the standard error stream\&.
.RE
.PP
usage
.RS 4
die with the usage message\&.
.RE
.PP
set_reflog_action
.RS 4
set the message that will be recorded to describe the end\-user action in the reflog, when the script updates a ref\&.
.RE
.PP
git_editor
.RS 4
runs an editor of user\(cqs choice (GIT_EDITOR, core\&.editor, VISUAL or EDITOR) on a given file, but error out if no editor is specified and the terminal is dumb\&.
.RE
.PP
is_bare_repository
.RS 4
outputs
true
or
false
to the standard output stream to indicate if the repository is a bare repository (i\&.e\&. without an associated working tree)\&.
.RE
.PP
cd_to_toplevel
.RS 4
runs chdir to the toplevel of the working tree\&.
.RE
.PP
require_work_tree
.RS 4
checks if the repository is a bare repository, and dies if so\&. Used by scripts that require working tree (e\&.g\&.
checkout)\&.
.RE
.PP
get_author_ident_from_commit
.RS 4
outputs code for use with eval to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit\&.
.RE
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite