Merge branch 'master' into next

* master:
  reflog gc: a tag that does not point at a commit is not a crime.
  contrib/vim: update syntax for changed commit template
  format-patch: fix bug with --stdout in a subdirectory
  [PATCH] honor --author even with --amend, -C, and -c.
  .mailmap: fix screw-ups in Uwe's name
  git-svn: remove leading slash when printing removed directories
  sha1_file.c: Avoid multiple calls to find_pack_entry().
  Documentation/config.txt: Document config file syntax better
  cvsimport: activate -a option, really.
  Cleanup uninitialized value in chomp
  Force Activestate Perl to tie git command pipe handle to a handle class
  Insert ACTIVESTATE_STRING in Git.pm
This commit is contained in:
Junio C Hamano
2007-01-22 22:51:12 -08:00
10 changed files with 107 additions and 39 deletions

View File

@@ -30,7 +30,9 @@ Robert Fitzsimons <robfitz@273k.net>
Santi Béjar <sbejar@gmail.com>
Sean Estabrooks <seanlkml@sympatico.ca>
Shawn O. Pearce <spearce@spearce.org>
Theodore Ts'o <tytso@mit.edu>
Tony Luck <tony.luck@intel.com>
Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de>
Ville Skyttä <scop@xemacs.org>
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
anonymous <linux@horizon.com>

View File

@@ -14,14 +14,72 @@ dot-separated segment and the section name is everything before the last
dot. The variable names are case-insensitive and only alphanumeric
characters are allowed. Some variables may appear multiple times.
Syntax
~~~~~~
The syntax is fairly flexible and permissive; whitespaces are mostly
ignored. The '#' and ';' characters begin comments to the end of line,
blank lines are ignored, lines containing strings enclosed in square
brackets start sections and all the other lines are recognized
as setting variables, in the form 'name = value'. If there is no equal
sign on the line, the entire line is taken as 'name' and the variable
is recognized as boolean "true". String values may be entirely or partially
enclosed in double quotes; some variables may require special value format.
ignored. The '#' and ';' characters begin comments to the end of line,
blank lines are ignored.
The file consists of sections and variables. A section begins with
the name of the section in square brackets and continues until the next
section begins. Section names are not case sensitive. Only alphanumeric
characters, '`-`' and '`.`' are allowed in section names. Each variable
must belong to some section, which means that there must be section
header before first setting of a variable.
Sections can be further divided into subsections. To begin a subsection
put its name in double quotes, separated by space from the section name,
in the section header, like in example below:
--------
[section "subsection"]
--------
Subsection names can contain any characters (doublequote '`"`', backslash
'`\`' and newline have to be entered escaped as '`\"`', '`\\`' and '`\n`',
respecitvely) and are case sensitive. Section header cannot span multiple
lines. Variables may belong directly to a section or to a given subsection.
You can have `[section]` if you have `[section "subsection"]`, but you
don't need to.
There is also (case insensitive) alternative `[section.subsection]` syntax.
In this syntax subsection names follow the same restrictions as for section
name.
All the other lines are recognized as setting variables, in the form
'name = value'. If there is no equal sign on the line, the entire line
is taken as 'name' and the variable is recognized as boolean "true".
The variable names are case-insensitive and only alphanumeric
characters and '`-`' are allowed. There can be more than one value
for a given variable; we say then that variable is multivalued.
Leading and trailing whitespace in a variable value is discarded.
Internal whitespace within a variable value is retained verbatim.
The values following the equals sign in variable assign are all either
a string, an integer, or a boolean. Boolean values may be given as yes/no,
0/1 or true/false. Case is not significant in boolean values, when
converting value to the canonical form using '--bool' type specifier;
`git-repo-config` will ensure that the output is "true" or "false".
String values may be entirely or partially enclosed in double quotes.
You need to enclose variable value in double quotes if you want to
preserve leading or trailing whitespace, or if variable value contains
beginning of comment characters (if it contains '#' or ';').
Double quote '`"`' and backslash '`\`' characters in variable value must
be escaped: use '`\"`' for '`"`' and '`\\`' for '`\`'.
The following escape sequences (beside '`\"`' and '`\\`') are recognized:
'`\n`' for newline character (NL), '`\t`' for horizontal tabulation (HT, TAB)
and '`\b`' for backspace (BS). No other char escape sequence, nor octal
char sequences are valid.
Variable value ending in a '`\`' is continued on the next line in the
customary UNIX fashion.
Some variables may require special value format.
Example
~~~~~~~
@@ -40,6 +98,10 @@ Example
remote = origin
merge = refs/heads/devel
# Proxy settings
[core]
gitProxy="ssh" for "ssh://kernel.org/"
gitProxy=default-proxy ; for the rest
Variables
~~~~~~~~~

View File

@@ -476,7 +476,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
if (!rev.diffopt.text)
rev.diffopt.binary = 1;
if (!output_directory)
if (!output_directory && !use_stdout)
output_directory = prefix;
if (output_directory) {

View File

@@ -263,9 +263,6 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
}
cb.ref_commit = lookup_commit_reference_gently(sha1, 1);
if (!cb.ref_commit)
fprintf(stderr,
"warning: ref '%s' does not point at a commit\n", ref);
cb.ref = ref;
cb.cmd = cmd;
for_each_reflog_ent(ref, expire_reflog_ent, &cb);

View File

@@ -1,7 +1,7 @@
syn region gitLine start=/^#/ end=/$/
syn region gitCommit start=/^# Added but not yet committed:$/ end=/^#$/ contains=gitHead,gitCommitFile
syn region gitCommit start=/^# Changes to be committed:$/ end=/^#$/ contains=gitHead,gitCommitFile
syn region gitHead contained start=/^# (.*)/ end=/^#$/
syn region gitChanged start=/^# Changed but not added:/ end=/^#$/ contains=gitHead,gitChangedFile
syn region gitChanged start=/^# Changed but not updated:/ end=/^#$/ contains=gitHead,gitChangedFile
syn region gitUntracked start=/^# Untracked files:/ end=/^#$/ contains=gitHead,gitUntrackedFile
syn match gitCommitFile contained /^#\t.*/hs=s+2

View File

@@ -462,15 +462,7 @@ if test -f "$GIT_DIR/MERGE_HEAD" && test -z "$no_edit"; then
fi >>"$GIT_DIR"/COMMIT_EDITMSG
# Author
if test '' != "$force_author"
then
GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
test '' != "$GIT_AUTHOR_NAME" &&
test '' != "$GIT_AUTHOR_EMAIL" ||
die "malformed --author parameter"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
elif test '' != "$use_commit"
if test '' != "$use_commit"
then
pick_author_script='
/^author /{
@@ -501,6 +493,15 @@ then
export GIT_AUTHOR_EMAIL
export GIT_AUTHOR_DATE
fi
if test '' != "$force_author"
then
GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
test '' != "$GIT_AUTHOR_NAME" &&
test '' != "$GIT_AUTHOR_EMAIL" ||
die "malformed --author parameter"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
fi
PARENTS="-p HEAD"
if test -z "$initial_commit"

View File

@@ -85,7 +85,7 @@ sub write_author_info($) {
close ($f);
}
getopts("hivmkuo:d:p:C:z:s:M:P:A:S:L:") or usage();
getopts("haivmkuo:d:p:C:z:s:M:P:A:S:L:") or usage();
usage if $opt_h;
@ARGV <= 1 or usage();

View File

@@ -2856,7 +2856,7 @@ sub rmdirs {
foreach my $d (sort { $b =~ tr#/#/# <=> $a =~ tr#/#/# } keys %$rm) {
$self->close_directory($bat->{$d}, $p);
my ($dn) = ($d =~ m#^(.*?)/?(?:[^/]+)$#);
print "\tD+\t/$d/\n" unless $q;
print "\tD+\t$d/\n" unless $q;
$self->SUPER::delete_entry($d, $r, $bat->{$dn}, $p);
delete $bat->{$d};
}

View File

@@ -275,7 +275,7 @@ sub command {
} else {
my @lines = <$fh>;
chomp @lines;
defined and chomp for @lines;
try {
_cmd_close($fh, $ctx);
} catch Git::Error::Command with {
@@ -736,13 +736,19 @@ sub _command_common_pipe {
_check_valid_cmd($cmd);
my $fh;
if ($^O eq '##INSERT_ACTIVESTATE_STRING_HERE##') {
if ($^O eq 'MSWin32') {
# ActiveState Perl
#defined $opts{STDERR} and
# warn 'ignoring STDERR option - running w/ ActiveState';
$direction eq '-|' or
die 'input pipe for ActiveState not implemented';
tie ($fh, 'Git::activestate_pipe', $cmd, @args);
# the strange construction with *ACPIPE is just to
# explain the tie below that we want to bind to
# a handle class, not scalar. It is not known if
# it is something specific to ActiveState Perl or
# just a Perl quirk.
tie (*ACPIPE, 'Git::activestate_pipe', $cmd, @args);
$fh = *ACPIPE;
} else {
my $pid = open($fh, $direction);
@@ -809,8 +815,9 @@ sub TIEHANDLE {
# FIXME: This is probably horrible idea and the thing will explode
# at the moment you give it arguments that require some quoting,
# but I have no ActiveState clue... --pasky
my $cmdline = join " ", @params;
my @data = qx{$cmdline};
# Let's just hope ActiveState Perl does at least the quoting
# correctly.
my @data = qx{git @params};
bless { i => 0, data => \@data }, $class;
}

View File

@@ -1469,21 +1469,20 @@ static void *read_packed_sha1(const unsigned char *sha1, char *type, unsigned lo
{
struct pack_entry e;
if (!find_pack_entry(sha1, &e, NULL)) {
error("cannot read sha1_file for %s", sha1_to_hex(sha1));
if (!find_pack_entry(sha1, &e, NULL))
return NULL;
}
return unpack_entry(e.p, e.offset, type, size);
else
return unpack_entry(e.p, e.offset, type, size);
}
void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
{
unsigned long mapsize;
void *map, *buf;
struct pack_entry e;
if (find_pack_entry(sha1, &e, NULL))
return read_packed_sha1(sha1, type, size);
buf = read_packed_sha1(sha1, type, size);
if (buf)
return buf;
map = map_sha1_file(sha1, &mapsize);
if (map) {
buf = unpack_sha1_file(map, mapsize, type, size);
@@ -1491,9 +1490,7 @@ void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size
return buf;
}
reprepare_packed_git();
if (find_pack_entry(sha1, &e, NULL))
return read_packed_sha1(sha1, type, size);
return NULL;
return read_packed_sha1(sha1, type, size);
}
void *read_object_with_reference(const unsigned char *sha1,
@@ -1781,6 +1778,8 @@ static void *repack_object(const unsigned char *sha1, unsigned long *objsize)
/* need to unpack and recompress it by itself */
unpacked = read_packed_sha1(sha1, type, &len);
if (!unpacked)
error("cannot read sha1_file for %s", sha1_to_hex(sha1));
hdrlen = sprintf(hdr, "%s %lu", type, len) + 1;