Skip to content

Commit 48d6e97

Browse files
author
Junio C Hamano
committed
Merge branch 'rs/tar-tree' into next
* rs/tar-tree: tar-tree: Use the prefix field of a tar header tar-tree: Remove obsolete code tar-tree: Use write_entry() to write the archive contents tar-tree: Introduce write_entry() tar-tree: Use SHA1 of root tree for the basedir git-apply: safety fixes Removed bogus "<snap>" identifier. Clarify and expand some hook documentation. commit-tree: check return value from write_sha1_file() send-email: Identify author at the top when sending e-mail Format tweaks for asciidoc.
2 parents 88d9405 + 4c69172 commit 48d6e97

File tree

11 files changed

+260
-256
lines changed

11 files changed

+260
-256
lines changed

Documentation/git-grep.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ OPTIONS
2424

2525
<option>...::
2626
Either an option to pass to `grep` or `git-ls-files`.
27-
28-
The following are the specific `git-ls-files` options
29-
that may be given: `-o`, `--cached`, `--deleted`, `--others`,
30-
`--killed`, `--ignored`, `--modified`, `--exclude=*`,
31-
`--exclude-from=*`, and `--exclude-per-directory=*`.
32-
33-
All other options will be passed to `grep`.
27+
+
28+
The following are the specific `git-ls-files` options
29+
that may be given: `-o`, `--cached`, `--deleted`, `--others`,
30+
`--killed`, `--ignored`, `--modified`, `--exclude=\*`,
31+
`--exclude-from=\*`, and `--exclude-per-directory=\*`.
32+
+
33+
All other options will be passed to `grep`.
3434

3535
<pattern>::
3636
The pattern to look for. The first non option is taken

Documentation/git-whatchanged.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ OPTIONS
4747
By default, differences for merge commits are not shown.
4848
With this flag, show differences to that commit from all
4949
of its parents.
50-
51-
However, it is not very useful in general, although it
52-
*is* useful on a file-by-file basis.
50+
+
51+
However, it is not very useful in general, although it
52+
*is* useful on a file-by-file basis.
5353

5454
Examples
5555
--------

Documentation/git.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,16 +521,14 @@ HEAD::
521521
a valid head 'name'
522522
(i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
523523

524-
<snap>::
525-
a valid snapshot 'name'
526-
(i.e. the contents of `$GIT_DIR/refs/snap/<snap>`).
527-
528524

529525
File/Directory Structure
530526
------------------------
531527

532528
Please see link:repository-layout.html[repository layout] document.
533529

530+
Read link:hooks.html[hooks] for more details about each hook.
531+
534532
Higher level SCMs may provide and manage additional information in the
535533
`$GIT_DIR`.
536534

Documentation/hooks.txt

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,31 @@ send out a commit notification e-mail.
9797
update
9898
------
9999

100-
This hook is invoked by `git-receive-pack`, which is invoked
101-
when a `git push` is done against the repository. It takes
102-
three parameters, name of the ref being updated, old object name
103-
stored in the ref, and the new objectname to be stored in the
104-
ref. Exiting with non-zero status from this hook prevents
105-
`git-receive-pack` from updating the ref.
106-
107-
This can be used to prevent 'forced' update on certain refs by
100+
This hook is invoked by `git-receive-pack` on the remote repository,
101+
which is happens when a `git push` is done on a local repository.
102+
Just before updating the ref on the remote repository, the update hook
103+
is invoked. It's exit status determins the success or failure of
104+
the ref update.
105+
106+
The hook executes once for each ref to be updated, and takes
107+
three parameters:
108+
- the name of the ref being updated,
109+
- the old object name stored in the ref,
110+
- and the new objectname to be stored in the ref.
111+
112+
A zero exit from the update hook allows the ref to be updated.
113+
Exiting with a non-zero status prevents `git-receive-pack`
114+
from updating the ref.
115+
116+
This hook can be used to prevent 'forced' update on certain refs by
108117
making sure that the object name is a commit object that is a
109118
descendant of the commit object named by the old object name.
119+
That is, to enforce a "fast forward only" policy.
120+
121+
It could also be used to log the old..new status. However, it
122+
does not know the entire set of branches, so it would end up
123+
firing one e-mail per ref when used naively, though.
124+
110125
Another use suggested on the mailing list is to use this hook to
111126
implement access control which is finer grained than the one
112127
based on filesystem group.
@@ -115,20 +130,30 @@ The standard output of this hook is sent to /dev/null; if you
115130
want to report something to the git-send-pack on the other end,
116131
you can redirect your output to your stderr.
117132

133+
118134
post-update
119135
-----------
120136

121-
This hook is invoked by `git-receive-pack`, which is invoked
122-
when a `git push` is done against the repository. It takes
123-
variable number of parameters; each of which is the name of ref
124-
that was actually updated.
137+
This hook is invoked by `git-receive-pack` on the remote repository,
138+
which is happens when a `git push` is done on a local repository.
139+
It executes on the remote repository once after all the refs have
140+
been updated.
141+
142+
It takes a variable number of parameters, each of which is the
143+
name of ref that was actually updated.
125144

126145
This hook is meant primarily for notification, and cannot affect
127146
the outcome of `git-receive-pack`.
128147

148+
The post-update hook can tell what are the heads that were pushed,
149+
but it does not know what their original and updated values are,
150+
so it is a poor place to do log old..new.
151+
129152
The default post-update hook, when enabled, runs
130153
`git-update-server-info` to keep the information used by dumb
131-
transport up-to-date.
154+
transports (eg, http) up-to-date. If you are publishing
155+
a git repository that is accessible via http, you should
156+
probably enable this hook.
132157

133158
The standard output of this hook is sent to /dev/null; if you
134159
want to report something to the git-send-pack on the other end,

Documentation/repository-layout.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ hooks::
8989
commands. A handful of sample hooks are installed when
9090
`git init-db` is run, but all of them are disabled by
9191
default. To enable, they need to be made executable.
92+
Read link:hooks.html[hooks] for more details about
93+
each hook.
9294

9395
index::
9496
The current index file for the repository. It is

apply.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static int parse_range(const char *line, int len, int offset, const char *expect
693693
line += digits;
694694
len -= digits;
695695

696-
*p2 = *p1;
696+
*p2 = 1;
697697
if (*line == ',') {
698698
digits = parse_num(line+1, p2);
699699
if (!digits)
@@ -901,6 +901,8 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
901901
break;
902902
}
903903
}
904+
if (oldlines || newlines)
905+
return -1;
904906
/* If a fragment ends with an incomplete line, we failed to include
905907
* it in the above loop because we hit oldlines == newlines == 0
906908
* before seeing it.

commit-tree.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ int main(int argc, char **argv)
125125
while (fgets(comment, sizeof(comment), stdin) != NULL)
126126
add_buffer(&buffer, &size, "%s", comment);
127127

128-
write_sha1_file(buffer, size, "commit", commit_sha1);
129-
printf("%s\n", sha1_to_hex(commit_sha1));
130-
return 0;
128+
if (!write_sha1_file(buffer, size, "commit", commit_sha1)) {
129+
printf("%s\n", sha1_to_hex(commit_sha1));
130+
return 0;
131+
}
132+
else
133+
return 1;
131134
}

git-send-email.perl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ sub send_message
307307
foreach my $t (@files) {
308308
open(F,"<",$t) or die "can't open file $t";
309309

310+
my $author_not_sender = undef;
310311
@cc = @initial_cc;
311312
my $found_mbox = 0;
312313
my $header_done = 0;
@@ -321,7 +322,12 @@ sub send_message
321322
$subject = $1;
322323

323324
} elsif (/^(Cc|From):\s+(.*)$/) {
324-
next if ($2 eq $from && $suppress_from);
325+
if ($2 eq $from) {
326+
next if ($suppress_from);
327+
}
328+
else {
329+
$author_not_sender = $2;
330+
}
325331
printf("(mbox) Adding cc: %s from line '%s'\n",
326332
$2, $_) unless $quiet;
327333
push @cc, $2;
@@ -360,6 +366,9 @@ sub send_message
360366
}
361367
}
362368
close F;
369+
if (defined $author_not_sender) {
370+
$message = "From: $author_not_sender\n\n$message";
371+
}
363372

364373
$cc = join(", ", unique_email_list(@cc));
365374

t/t5000-tar-tree.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ test_expect_success \
3434
mkdir a/bin &&
3535
cp /bin/sh a/bin &&
3636
ln -s a a/l1 &&
37+
(p=long_path_to_a_file && cd a &&
38+
for depth in 1 2 3 4 5; do mkdir $p && cd $p; done &&
39+
echo text >file_with_long_path) &&
3740
(cd a && find .) | sort >a.lst'
3841

3942
test_expect_success \

0 commit comments

Comments
 (0)