Skip to content

Commit 8e29f90

Browse files
author
Junio C Hamano
committed
Merge branch 'maint-1.5.1' into maint
* maint-1.5.1: git-config: Improve documentation of git-config file handling git-config: Various small fixes to asciidoc documentation decode_85(): fix missing return. fix signed range problems with hex conversions
2 parents a192a90 + 1701409 commit 8e29f90

File tree

4 files changed

+69
-15
lines changed

4 files changed

+69
-15
lines changed

Documentation/git-config.txt

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ If you want to update or unset an option which can occur on multiple
3131
lines, a POSIX regexp `value_regex` needs to be given. Only the
3232
existing values that match the regexp are updated or unset. If
3333
you want to handle the lines that do *not* match the regex, just
34-
prepend a single exclamation mark in front (see EXAMPLES).
34+
prepend a single exclamation mark in front (see also <<EXAMPLES>>).
3535

3636
The type specifier can be either '--int' or '--bool', which will make
3737
'git-config' ensure that the variable(s) are of the given type and
@@ -48,7 +48,7 @@ This command will fail if:
4848
. the section or key is invalid,
4949
. you try to unset an option which does not exist,
5050
. you try to unset/set an option for which multiple lines match, or
51-
. you use --global option without $HOME being properly set.
51+
. you use '--global' option without $HOME being properly set.
5252

5353

5454
OPTIONS
@@ -75,11 +75,22 @@ OPTIONS
7575
Like --get-all, but interprets the name as a regular expression.
7676

7777
--global::
78-
Use global ~/.gitconfig file rather than the repository .git/config.
78+
For writing options: write to global ~/.gitconfig file rather than
79+
the repository .git/config.
80+
+
81+
For reading options: read only from global ~/.gitconfig rather than
82+
from all available files.
83+
+
84+
See also <<FILES>>.
7985

8086
--system::
81-
Use system-wide $(prefix)/etc/gitconfig rather than the repository
82-
.git/config.
87+
For writing options: write to system-wide $(prefix)/etc/gitconfig
88+
rather than the repository .git/config.
89+
+
90+
For reading options: read only from system-wide $(prefix)/etc/gitconfig
91+
rather than from all available files.
92+
+
93+
See also <<FILES>>.
8394

8495
--remove-section::
8596
Remove the given section from the configuration file.
@@ -106,21 +117,64 @@ OPTIONS
106117
by 1024, 1048576, or 1073741824 prior to output.
107118

108119

120+
[[FILES]]
121+
FILES
122+
-----
123+
124+
There are three files where git-config will search for configuration
125+
options:
126+
127+
.git/config::
128+
Repository specific configuration file. (The filename is
129+
of course relative to the repository root, not the working
130+
directory.)
131+
132+
~/.gitconfig::
133+
User-specific configuration file. Also called "global"
134+
configuration file.
135+
136+
$(prefix)/etc/gitconfig::
137+
System-wide configuration file.
138+
139+
If no further options are given, all reading options will read all of these
140+
files that are available. If the global or the system-wide configuration
141+
file are not available they will be ignored. If the repository configuration
142+
file is not available or readable, git-config will exit with a non-zero
143+
error code. However, in neither case will an error message be issued.
144+
145+
All writing options will per default write to the repository specific
146+
configuration file. Note that this also affects options like '--replace-all'
147+
and '--unset'. *git-config will only ever change one file at a time*.
148+
149+
You can override these rules either by command line options or by environment
150+
variables. The '--global' and the '--system' options will limit the file used
151+
to the global or system-wide file respectively. The GIT_CONFIG environment
152+
variable has a similar effect, but you can specify any filename you want.
153+
154+
The GIT_CONFIG_LOCAL environment variable on the other hand only changes
155+
the name used instead of the repository configuration file. The global and
156+
the system-wide configuration files will still be read. (For writing options
157+
this will obviously result in the same behavior as using GIT_CONFIG.)
158+
159+
109160
ENVIRONMENT
110161
-----------
111162

112163
GIT_CONFIG::
113164
Take the configuration from the given file instead of .git/config.
114-
Using the "--global" option forces this to ~/.gitconfig.
165+
Using the "--global" option forces this to ~/.gitconfig. Using the
166+
"--system" option forces this to $(prefix)/etc/gitconfig.
115167

116168
GIT_CONFIG_LOCAL::
117-
Currently the same as $GIT_CONFIG; when Git will support global
118-
configuration files, this will cause it to take the configuration
119-
from the global configuration file in addition to the given file.
169+
Take the configuration from the given file instead if .git/config.
170+
Still read the global and the system-wide configuration files, though.
120171

172+
See also <<FILES>>.
121173

122-
EXAMPLE
123-
-------
174+
175+
[[EXAMPLES]]
176+
EXAMPLES
177+
--------
124178

125179
Given a .git/config like this:
126180

base85.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int decode_85(char *dst, const char *buffer, int len)
6666
*/
6767
if (0x03030303 < acc ||
6868
0xffffffff - de < (acc *= 85))
69-
error("invalid base85 sequence %.5s", buffer-5);
69+
return error("invalid base85 sequence %.5s", buffer-5);
7070
acc += de;
7171
say1(" %08x", acc);
7272

cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ extern int legacy_loose_object(unsigned char *);
359359
extern int has_pack_file(const unsigned char *sha1);
360360
extern int has_pack_index(const unsigned char *sha1);
361361

362-
extern signed char hexval_table[256];
363-
static inline unsigned int hexval(unsigned int c)
362+
extern const signed char hexval_table[256];
363+
static inline unsigned int hexval(unsigned char c)
364364
{
365365
return hexval_table[c];
366366
}

sha1_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const unsigned char null_sha1[20];
3333

3434
static unsigned int sha1_file_open_flag = O_NOATIME;
3535

36-
signed char hexval_table[256] = {
36+
const signed char hexval_table[256] = {
3737
-1, -1, -1, -1, -1, -1, -1, -1, /* 00-07 */
3838
-1, -1, -1, -1, -1, -1, -1, -1, /* 08-0f */
3939
-1, -1, -1, -1, -1, -1, -1, -1, /* 10-17 */

0 commit comments

Comments
 (0)