From: Pang Yan Han Date: Wed, 28 Sep 2011 15:39:35 +0000 (+0800) Subject: receive-pack: don't pass non-existent refs to post-{receive,update} hooks X-Git-Tag: v1.7.8-rc0~62^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/160b81ed819d870b7d098bf61b51c4bc959507f3?hp=160b81ed819d870b7d098bf61b51c4bc959507f3 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: SP 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 Signed-off-by: Junio C Hamano ---