receive-pack: refactor updateInstead codepath
commit21b138d0f64d99b55e901f90d4211e036b881e64
authorJunio C Hamano <gitster@pobox.com>
Mon, 1 Dec 2014 21:57:28 +0000 (1 13:57 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Dec 2014 21:57:28 +0000 (1 13:57 -0800)
tree82e157fbdfa7e26f59ff1c257f4847f2d234f4e8
parent4d7a5ceacc97e69c4ab5e1543f61fafafb963a9c
receive-pack: refactor updateInstead codepath

Keep the "there is nothing to update in a bare repository", "when
the check and update process runs, here are the GIT_DIR and
GIT_WORK_TREE" logic, which will be common regardless of how the
decision to update and the actual update are done, in the original
update_worktree() function, and split out the "working tree and
the index must match the original HEAD exactly" and "use two-way
read-tree to update the working tree" into a new push_to_deploy()
helper function.  This will allow customizing the logic more cleanly
and easily.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c