From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Schindelin Subject: [PATCH v2 1/4] config --show-origin: report paths with forward slashes Date: Wed, 23 Mar 2016 11:55:00 +0100 (CET) Message-ID: <8beb1c208e33e1de8f272caa22fb7a0b662ca4cc.1458730457.git.johannes.schindelin@gmx.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Cc: git@vger.kernel.org, Lars Schneider , Johannes Sixt , Kazutoshi SATODA , Eric Wong , Jonathan Nieder , =?UTF-8?Q?Torsten_B=C3=B6gershausen?= To: Junio C Hamano X-From: git-owner@vger.kernel.org Wed Mar 23 11:55:50 2016 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aigS6-0006Vd-5b for gcvg-git-2@plane.gmane.org; Wed, 23 Mar 2016 11:55:50 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754314AbcCWKzV (ORCPT ); Wed, 23 Mar 2016 06:55:21 -0400 Received: from mout.gmx.net ([212.227.17.21]:53063 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753750AbcCWKzT (ORCPT ); Wed, 23 Mar 2016 06:55:19 -0400 Received: from virtualbox ([37.24.143.127]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MC7em-1aZqki0ZRA-008qjc; Wed, 23 Mar 2016 11:55:04 +0100 X-X-Sender: virtualbox@virtualbox In-Reply-To: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) X-Provags-ID: V03:K0:pI4zF0snqe2WC98WCLv3NTeal6sVaP/v5Zy+5x9ldHAy/0jfArg XGbQMYlIeI6krJ1rWHQdSx1AcL3/cc9dpvUR5nS+2YTH1mBVMI10hAAtfg6J01vK5spY7oV qgj+i+qICYcYXXjsH2YoT3gDhMGh5yd64bJvgzraD+J/I1DoEPoSlgtKMxAlzrDTYLdKd78 8OtnzHb9x1woGZcv3xM7A== X-UI-Out-Filterresults: notjunk:1;V01:K0:AbFbnpgMNLg=:8IMyFSQNn0XVn9Di8nEAld ZAFsNjdRtIj7y4C4LkvAtIi66+qyi//tc8iO4vPPv5g1FxbnQOhCs/zH5aOG/cbJpiRiMqHtm hdCDXCbjapZ2hu/wsh/uyLPtVi5mBNYJ/DOeLAAgEUHr2EB6aZpIzmbBHQDW0C77TTz5kpVvN m/OkSuM5PASE4FxTeudT4IeF5GPLNKtITSEZPcgeDcFcF7FvLdLzj1TER2CbVhKVmFoKUhuoV u6hKkZJ1Yxq2eLR6XQyp+91lFeA6CriYWg8fjJaJT65KRG8aJnpcRrI/TLM9haU3ZA652cDSO 4+skWTuufR47g0yeIN3F2+GLm5kLbVDOxUg+T0rKJzXInoYP53RxKSz2MX4BD9RnMTfao0Mrr eteTk0TlsJiGFywqU3ReH4u8YR4Q9FGj5ycV1l9QY+V0lrN4n2kRYH8DI6SkggRfYB0Qgz0ud fG17rlKQgtrOjxCBsRis8QHIzSbtfr5fTKsNcQAV6eCgBqJZ2YahP/MSSsnsidlLN+7697umZ hI8GoivO3Q2g7SmUCuDP8OYLN0uu7xi/17Af2HUkJTcFfE3lTwgbs0ViQr32OD3uSdgYHH8/+ ir5FMhOWeAIf9usURssGY1tKp26tIWdFPoIh/XKD8N8k3kL8yZGq3NEEceuq+/nh9BKUDensz 9iG0xjFx65H7grZsyrwc3wJeI2vvdergiSlZUdrOcB+YGziJkVPss1EUoW1OFFtCxBi+21TOv 6eX9Jyr0FyLU3wiA31Jx6lTTxDwYp+opV6X4FgFutBRod4I4oJuB3/J+G67vyGkZ/zQ718+O Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Windows, the backslash is the native directory separator, but all supported Windows versions also accept the forward slash in most circumstances. Our tests expect forward slashes. Relative paths are generated by Git using forward slashes. So let's try to be consistent and use forward slashes in the $HOME part of the paths reported by `git config --show-origin`, too. Signed-off-by: Johannes Schindelin --- compat/mingw.h | 6 ++++++ path.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/compat/mingw.h b/compat/mingw.h index 8c5bf50..c008694 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -396,6 +396,12 @@ static inline char *mingw_find_last_dir_sep(const char *path) ret = (char *)path; return ret; } +static inline void convert_slashes(char *path) +{ + for (; *path; path++) + if (*path == '\\') + *path = '/'; +} #define find_last_dir_sep mingw_find_last_dir_sep int mingw_offset_1st_component(const char *path); #define offset_1st_component mingw_offset_1st_component diff --git a/path.c b/path.c index 8b7e168..969b494 100644 --- a/path.c +++ b/path.c @@ -584,6 +584,9 @@ char *expand_user_path(const char *path) if (!home) goto return_null; strbuf_addstr(&user_path, home); +#ifdef GIT_WINDOWS_NATIVE + convert_slashes(user_path.buf); +#endif } else { struct passwd *pw = getpw_str(username, username_len); if (!pw) -- 2.7.4.windows.1