mv: remove use of deprecated 'get_pathspec()'
authorBrandon Williams <bmwill@google.com>
Wed, 4 Jan 2017 18:03:56 +0000 (10:03 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Jan 2017 02:04:17 +0000 (18:04 -0800)
commit2ec87741b2d2935542b13d407fbeedbe0a7af094
tree71bfcf5ab7008e8560f1c8e0b54419d3596be925
parent454cb6bd52a4de614a3633e4f547af03d5c3b640
mv: remove use of deprecated 'get_pathspec()'

Convert the 'internal_copy_pathspec()' function to 'prefix_path()'
instead of using the deprecated 'get_pathspec()' interface.  Also,
rename 'internal_copy_pathspec()' to 'internal_prefix_pathspec()' to be
more descriptive of what the funciton is actually doing.

In addition to this, fix a memory leak caused by only duplicating some
of the pathspec elements.  Instead always duplicate all of the the
pathspec elements as an intermediate step (with modificationed based on
the passed in flags).  This way the intermediate strings can then be
freed after getting the result from 'prefix_path()'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mv.c