Skip to content

Commit 6671525

Browse files
author
Junio C Hamano
committed
Merge branch 'maint'
* maint: checkout: allow detaching to HEAD even when switching to the tip of a branch Updated documentation of hooks in git-receive-pack. Allow fetching references from any namespace tiny fix in documentation of git-clone Fix an unmatched comment end in arm/sha1_arm.S
2 parents a25907d + fdc99cb commit 6671525

File tree

4 files changed

+74
-11
lines changed

4 files changed

+74
-11
lines changed

Documentation/git-clone.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Make a local clone that borrows from the current directory, without checking thi
132132
+
133133
------------
134134
$ git clone -l -s -n . ../copy
135-
$ cd copy
135+
$ cd ../copy
136136
$ git show-branch
137137
------------
138138

Documentation/hooks.txt

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,35 @@ parameter, and is invoked after a commit is made.
9090
This hook is meant primarily for notification, and cannot affect
9191
the outcome of `git-commit`.
9292

93+
[[pre-receive]]
94+
pre-receive
95+
-----------
96+
97+
This hook is invoked by `git-receive-pack` on the remote repository,
98+
which happens when a `git push` is done on a local repository.
99+
Just before starting to update refs on the remote repository, the
100+
pre-receive hook is invoked. Its exit status determines the success
101+
or failure of the update.
102+
103+
This hook executes once for the receive operation. It takes no
104+
arguments, but for each ref to be updated it receives on standard
105+
input a line of the format:
106+
107+
<old-value> SP <new-value> SP <ref-name> LF
108+
109+
where `<old-value>` is the old object name stored in the ref,
110+
`<new-value>` is the new object name to be stored in the ref and
111+
`<ref-name>` is the full name of the ref.
112+
When creating a new ref, `<old-value>` is 40 `0`.
113+
114+
If the hook exits with non-zero status, none of the refs will be
115+
updated. If the hook exits with zero, updating of individual refs can
116+
still be prevented by the <<update,'update'>> hook.
117+
118+
If you want to report something to the `git-send-pack` on the other end,
119+
you can simply `echo` your messages.
120+
121+
[[update]]
93122
update
94123
------
95124

@@ -108,7 +137,7 @@ three parameters:
108137

109138
A zero exit from the update hook allows the ref to be updated.
110139
Exiting with a non-zero status prevents `git-receive-pack`
111-
from updating the ref.
140+
from updating that ref.
112141

113142
This hook can be used to prevent 'forced' update on certain refs by
114143
making sure that the object name is a commit object that is a
@@ -117,7 +146,8 @@ That is, to enforce a "fast forward only" policy.
117146

118147
It could also be used to log the old..new status. However, it
119148
does not know the entire set of branches, so it would end up
120-
firing one e-mail per ref when used naively, though.
149+
firing one e-mail per ref when used naively, though. The
150+
<<post-receive,'post-receive'>> hook is more suited to that.
121151

122152
Another use suggested on the mailing list is to use this hook to
123153
implement access control which is finer grained than the one
@@ -127,9 +157,38 @@ The standard output of this hook is sent to `stderr`, so if you
127157
want to report something to the `git-send-pack` on the other end,
128158
you can simply `echo` your messages.
129159

130-
The default 'update' hook, when enabled, demonstrates how to
131-
send out a notification e-mail.
160+
The default 'update' hook, when enabled--and with
161+
`hooks.allowunannotated` config option turned on--prevents
162+
unannotated tags to be pushed.
163+
164+
[[post-receive]]
165+
post-receive
166+
------------
132167

168+
This hook is invoked by `git-receive-pack` on the remote repository,
169+
which happens when a `git push` is done on a local repository.
170+
It executes on the remote repository once after all the refs have
171+
been updated.
172+
173+
This hook executes once for the receive operation. It takes no
174+
arguments, but gets the same information as the `pre-receive`
175+
hook does on its standard input.
176+
177+
This hook does not affect the outcome of `git-receive-pack`, as it
178+
is called after the real work is done.
179+
180+
This supersedes the [[post-update]] hook in that it actually get's
181+
both old and new values of all the refs.
182+
183+
If you want to report something to the `git-send-pack` on the
184+
other end, you can simply `echo` your messages.
185+
186+
The default 'post-receive' hook is empty, but there is
187+
a sample script `post-receive-email` provided in the `contrib/hooks`
188+
directory in git distribution, which implements sending commit
189+
emails.
190+
191+
[[post-update]]
133192
post-update
134193
-----------
135194

@@ -148,12 +207,16 @@ The 'post-update' hook can tell what are the heads that were pushed,
148207
but it does not know what their original and updated values are,
149208
so it is a poor place to do log old..new.
150209

210+
In general, `post-receive` hook is preferred when the hook needs
211+
to decide its acion on the status of the entire set of refs
212+
being updated, as this hook is called once per ref, with
213+
information only on a single ref at a time.
214+
151215
When enabled, the default 'post-update' hook runs
152216
`git-update-server-info` to keep the information used by dumb
153217
transports (e.g., HTTP) up-to-date. If you are publishing
154218
a git repository that is accessible via HTTP, you should
155219
probably enable this hook.
156220

157-
The standard output of this hook is sent to `/dev/null`; if you
158-
want to report something to the `git-send-pack` on the other end,
159-
you can redirect your output to your `stderr`.
221+
Both standard output and standard error output are forwarded to
222+
`git-send-pack` on the other end.

arm/sha1_arm.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sha_transform:
2323
stmfd sp!, {r4 - r8, lr}
2424

2525
@ for (i = 0; i < 16; i++)
26-
@ W[i] = ntohl(((uint32_t *)data)[i]); */
26+
@ W[i] = ntohl(((uint32_t *)data)[i]);
2727

2828
#ifdef __ARMEB__
2929
mov r4, r0

git-parse-remote.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ canon_refs_list_for_fetch () {
143143
fi
144144
case "$remote" in
145145
'' | HEAD ) remote=HEAD ;;
146-
refs/heads/* | refs/tags/* | refs/remotes/*) ;;
146+
refs/*) ;;
147147
heads/* | tags/* | remotes/* ) remote="refs/$remote" ;;
148148
*) remote="refs/heads/$remote" ;;
149149
esac
150150
case "$local" in
151151
'') local= ;;
152-
refs/heads/* | refs/tags/* | refs/remotes/*) ;;
152+
refs/*) ;;
153153
heads/* | tags/* | remotes/* ) local="refs/$local" ;;
154154
*) local="refs/heads/$local" ;;
155155
esac

0 commit comments

Comments
 (0)