Code

git-p4: handle files with shell metacharacters
authorLuke Diamand <luke@diamand.org>
Sun, 16 Oct 2011 14:47:52 +0000 (10:47 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Oct 2011 03:46:49 +0000 (20:46 -0700)
commit6de040df566d4b4489366aa2ae5cc215ec449618
tree749741b429861ab84d30c5daa124c9fb1d9b4305
parentcb585a9cda70320647cc5d69e71bedc929244189
git-p4: handle files with shell metacharacters

git-p4 used to simply pass strings into system() and popen(), and
relied on the shell doing the necessary expansion. This though meant
that shell metacharacters in file names would be corrupted - for
example files with $ or space in them.

Switch to using subprocess.Popen() and friends, and pass in explicit
arrays in the places where it matters. This then avoids needing shell
expansion.

Add trivial helper functions for some common perforce operations. Add
test case.

[pw: test cleanup]

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/fast-import/git-p4
t/t9803-git-shell-metachars.sh [new file with mode: 0755]