receive-pack: drop tmp_objdir_env from run_update_hook
authorJeff King <peff@peff.net>
Mon, 10 Apr 2017 22:13:22 +0000 (18:13 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Apr 2017 01:13:12 +0000 (18:13 -0700)
Since 722ff7f87 (receive-pack: quarantine objects until
pre-receive accepts, 2016-10-03), we have to feed the
pre-receive hook the tmp_objdir environment, so that git
programs run from the hook know where to find the objects.

That commit modified run_update_hook() to do the same, but
there it is a noop. By the time we get to the update hooks,
we have already migrated the objects from quarantine, and so
tmp_objdir_env() will always return NULL. We can drop this
useless call.

Note that the ordering here and the lack of support for the
update hook is intentional. The update hook calls are
interspersed with actual ref updates, and we must migrate
the objects before any refs are updated (since otherwise
those refs would appear broken to outside processes). So the
only other options are:

- remain in quarantine for the _first_ ref, but not the
others. This is sufficiently confusing that it can be
rejected outright.

- run all the individual update hooks first, then migrate,
then update all the refs. But this changes the repository
state that the update hooks see (i.e., whether or not
refs from the same push are updated yet or not).

So the functionality is fine and remains unchanged with this
patch; we're just cleaning up a useless and confusing line
of code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c
index 267d3204c209bb0816004dac3009589f08f66074..a7408591d92789b0aefb6529db7e42d2dc6e2037 100644 (file)
@@ -768,7 +768,6 @@ static int run_update_hook(struct command *cmd)
        proc.stdout_to_stderr = 1;
        proc.err = use_sideband ? -1 : 0;
        proc.argv = argv;
-       proc.env = tmp_objdir_env(tmp_objdir);
 
        code = start_command(&proc);
        if (code)