From d654c956898a083b9d6cf46d9182f038f53ef15d Mon Sep 17 00:00:00 2001 From: William MARTIN Date: Thu, 6 Jan 2011 14:03:07 +0100 Subject: [PATCH] Fix issue 553 : Git escape too much character in a UTF-8 shell Add an option to configure the git core.quotepath option --- src/IDF/Plugin/SyncGit/Serve.php | 18 ++++++++++++++++++ src/IDF/conf/idf.php-dist | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/src/IDF/Plugin/SyncGit/Serve.php b/src/IDF/Plugin/SyncGit/Serve.php index 499a1ba..842797b 100644 --- a/src/IDF/Plugin/SyncGit/Serve.php +++ b/src/IDF/Plugin/SyncGit/Serve.php @@ -230,6 +230,24 @@ class IDF_Plugin_SyncGit_Serve } Pluf_Log::debug(array('IDF_Plugin_Git_Serve::initRepository', 'Added post-update hook.', $fullpath)); + // Configure the core.quotepath option + $quotepath = (Pluf::f('git_core_quotepath', true) == true) ? 'true' : 'false'; + $out = array(); + $res = 0; + exec(sprintf(Pluf::f('idf_exec_cmd_prefix', ''). + Pluf::f('git_path', 'git').' config -f %s/config --add core.quotepath %s', + escapeshellarg($fullpath), + escapeshellarg($quotepath) + ), + $out, $res); + if ($res != 0) { + Pluf_Log::warn(array('IDF_Plugin_Git_Serve::initRepository', + 'core.quotepath configuration error.', + $quotepath)); + return; + } + Pluf_Log::debug(array('IDF_Plugin_Git_Serve::initRepository', + 'core.quotepath configured.', $quotepath)); } /** diff --git a/src/IDF/conf/idf.php-dist b/src/IDF/conf/idf.php-dist index e76c4b3..9e0ed8a 100644 --- a/src/IDF/conf/idf.php-dist +++ b/src/IDF/conf/idf.php-dist @@ -255,6 +255,12 @@ $cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git', 'mtn' => 'IDF_Scm_Monotone', ); +# Specific git config +# The core.quotepath is configured on new repository +# True -> All characters upper than 0x80 will be escape (default) +# False -> Characters is print directly, enable accented character in a UTF-8 shell +# $cfg['git_core_quotepath'] = false; + # Set to true when uploaded public keys should not only be validated # syntactically, but also by the specific backend. For SSH public # keys, ssh-keygen(3) must be available and usable in PATH, for