summaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorLibravatar Pang Yan Han <pangyanhan@gmail.com>2011-09-28 23:39:35 +0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-09-30 12:18:46 -0700
commit160b81ed819d870b7d098bf61b51c4bc959507f3 (patch)
treedd264c6422bb15d7c227a2a7bce0012bbcf42a3c /refs.h
parentGit 1.7.7-rc3 (diff)
downloadtgif-160b81ed819d870b7d098bf61b51c4bc959507f3.tar.xz
receive-pack: don't pass non-existent refs to post-{receive,update} hooks
When a push specifies deletion of non-existent refs, the post post-receive and post-update hooks receive them as input/arguments. For instance, for the following push, where refs/heads/nonexistent is a ref which does not exist on the remote side: git push origin :refs/heads/nonexistent the post-receive hook receives from standard input: <null-sha1> SP <null-sha1> SP refs/heads/nonexistent and the post-update hook receives as arguments: refs/heads/nonexistent which does not make sense since it is a no-op. Teach receive-pack not to pass non-existent refs to the post-receive and post-update hooks. If the push only attempts to delete non-existent refs, these hooks are not even called. The update and pre-receive hooks are still notified about attempted deletion of non-existent refs to give them a chance to inspect the situation and act on it. [jc: mild fix-ups to avoid introducing an extra list; also added fixes to some tests] Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/refs.h b/refs.h
index dfb086e933..4431205338 100644
--- a/refs.h
+++ b/refs.h
@@ -57,7 +57,7 @@ extern void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refn
*/
extern void add_extra_ref(const char *refname, const unsigned char *sha1, int flags);
extern void clear_extra_refs(void);
-extern int ref_exists(char *);
+extern int ref_exists(const char *);
extern int peel_ref(const char *, unsigned char *);