From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Keeping Subject: [PATCH v2 2/3] difftool: avoid double slashes in symlink targets Date: Thu, 14 Mar 2013 20:19:40 +0000 Message-ID: References: Cc: Junio C Hamano , David Aguilar , Matt McClure , Tim Henigan , John Keeping To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Thu Mar 14 21:20:54 2013 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 1UGEdx-0006w1-Ha for gcvg-git-2@plane.gmane.org; Thu, 14 Mar 2013 21:20:53 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751536Ab3CNUU0 (ORCPT ); Thu, 14 Mar 2013 16:20:26 -0400 Received: from pichi.aluminati.org ([72.9.246.58]:48987 "EHLO pichi.aluminati.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751081Ab3CNUUZ (ORCPT ); Thu, 14 Mar 2013 16:20:25 -0400 Received: from localhost (localhost [127.0.0.1]) by pichi.aluminati.org (Postfix) with ESMTP id A82CA161E4DD; Thu, 14 Mar 2013 20:20:24 +0000 (GMT) X-Quarantine-ID: X-Virus-Scanned: Debian amavisd-new at aluminati.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -12.9 X-Spam-Level: X-Spam-Status: No, score=-12.9 tagged_above=-9999 required=6.31 tests=[ALL_TRUSTED=-1, ALUMINATI_LOCAL_TESTS=-10, BAYES_00=-1.9] autolearn=ham Received: from pichi.aluminati.org ([127.0.0.1]) by localhost (pichi.aluminati.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yr2w1xkH2a1y; Thu, 14 Mar 2013 20:20:24 +0000 (GMT) Received: from river.lan (tg1.aluminati.org [10.0.16.53]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pichi.aluminati.org (Postfix) with ESMTPSA id 74EDF161E52C; Thu, 14 Mar 2013 20:20:13 +0000 (GMT) X-Mailer: git-send-email 1.8.2.396.g36b63d6 In-Reply-To: In-Reply-To: References: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: When we add tests for symlinks in "git difftool --dir-diff" it's easier to check the target path if we don't have to worry about double slashes separating directories. Remove the trailing slash (if present) from $workdir before creating the symlinks in order to avoid this. Signed-off-by: John Keeping --- git-difftool.perl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/git-difftool.perl b/git-difftool.perl index 12231fb..e594f9c 100755 --- a/git-difftool.perl +++ b/git-difftool.perl @@ -209,7 +209,9 @@ EOF delete($ENV{GIT_INDEX_FILE}); # Changes in the working tree need special treatment since they are - # not part of the index + # not part of the index. Remove any trailing slash from $workdir + # before starting to avoid double slashes in symlink targets. + $workdir =~ s|/$||; for my $file (@working_tree) { my $dir = dirname($file); unless (-d "$rdir/$dir") { -- 1.8.2.396.g36b63d6