From patchwork Wed Oct 24 09:19:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin via GitGitGadget X-Patchwork-Id: 10654435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED05513BF for ; Wed, 24 Oct 2018 09:19:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E44892A1AE for ; Wed, 24 Oct 2018 09:19:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8C222A1DA; Wed, 24 Oct 2018 09:19:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79ADF2A1AE for ; Wed, 24 Oct 2018 09:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727695AbeJXRq7 (ORCPT ); Wed, 24 Oct 2018 13:46:59 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:44564 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726256AbeJXRq7 (ORCPT ); Wed, 24 Oct 2018 13:46:59 -0400 Received: by mail-pl1-f194.google.com with SMTP id d23-v6so1952241pls.11 for ; Wed, 24 Oct 2018 02:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=gJjpMUYnIzflc4m5g1x6IJ1lzkh5aTb35pGDHF+2fg4=; b=Aj4YF9EYM0M+hTqwLdZI6KAofLVRdTs10+g35phvSqcE1PfX3CW7LMu97MHlVAja43 KPtXcoG7/ISpickB6YMmy5F29bO1L3+0zBZgbodlHsuWRUa69E/XTqSNFlEOIalSgK7D 1DO9G70ah06qiMXXV/WNevZ4ZsLoVudFuraO9B2Z2cp6l5CsOOqaqmGpoZlUvIO9bNyN deelVNIl7v10S+B3IO/mJsGRvaqpFZyacLxW1rShMZw88BF1iLTUZVIid8qF7wyBVdOs RAQKzYOguHbm9E4ABWU5z5DaChPMBxmM8LGgIIeUcwcaGLXkbEQt6H3I1kCewrxAQllC 1LQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=gJjpMUYnIzflc4m5g1x6IJ1lzkh5aTb35pGDHF+2fg4=; b=LGfLqVE90rG/5+Gyy6acJXFdUsBai6CIEQEjhF93abxH0WYGVn3WWLtW0pAInfPN0w ZUe4QkyGI8eTUX355iNOcgVztdWsvzqcMHor2obilwzAgJTWQug5uTk5WkFQA9gEMPgS l+Wd3+L9CuoSlbtoWAj+Xfxn0/HZAn1bMIQ7Jg3W/ulpmQMW4qffmqwoDRdb65LtgQGX 469y/ZAe/++qmeR6JYRC00pHCyCmO12ptQPt6+MUPU6XMNvto0Hv31tGk4CfEByJId0w QmBV9v4CeqiMKbQzpV7XAGRCMM9GyjfgQ70dqr9nht2+QjVXQON8aESFOI4vpCprAWcA mW9g== X-Gm-Message-State: AGRZ1gIqfjabYofcVupn1cB+PlgbjhjpRZTBAUhZYJElIESztuqfxQ6H XAwGQ5lEAgkfDI/AL40QpLF2SN3f X-Google-Smtp-Source: AJdET5d0tRXhYokAdal3xrbVQusa3A3K6vlo/kk8RkiyQa9QRV3Lm1kF3v3gv/i52GHCIjPmy/tEcw== X-Received: by 2002:a17:902:223:: with SMTP id 32-v6mr1803703plc.112.1540372780122; Wed, 24 Oct 2018 02:19:40 -0700 (PDT) Received: from [127.0.0.1] ([40.112.137.127]) by smtp.gmail.com with ESMTPSA id o12-v6sm6389445pfh.20.2018.10.24.02.19.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 02:19:39 -0700 (PDT) Date: Wed, 24 Oct 2018 02:19:39 -0700 (PDT) X-Google-Original-Date: Wed, 24 Oct 2018 09:19:35 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH v2 0/2] Work around case-insensitivity issues with cwd on Windows Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Stephen Smith , Junio C Hamano Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Windows, file names are recorded case-sensitively, but looked up case-insensitively. Therefore, it is possible to switch to a directory by using incorrect case, e.g. cd documentation will still get you into the Documentation subdirectory. In Powershell, doing so will however report the current directory with the specified spelling rather than the one recorded on disk, and Git will get confused. To remedy that, we fixed this in Git for Windows more than three years ago, and needed only a small fix a couple of months later to accommodate for the diverse scenarios encountered by the many Git for Windows users. Not only to keep the story closer to what happened historically, but also to make it easier to follow, I refrained from squashing these two patches. Side note: the second patch is technically not battle-tested for that long: it uses an API function that requires Windows Vista or later, and we only recently started to clean up Git for Windows' code to drop fallbacks for Windows XP. Read: this code used to load the GetFinalPathNameByHandle() function dynamically, and that is the only difference to the code that has been "battle-tested" for close to three years. Changes since v1: * Fixed a grammar mistake in the second commit message. Anton Serbulov (1): mingw: fix getcwd when the parent directory cannot be queried Johannes Schindelin (1): mingw: ensure `getcwd()` reports the correct case compat/mingw.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) base-commit: c4df23f7927d8d00e666a3c8d1b3375f1dc8a3c1 Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-54%2Fdscho%2Fmingw-getcwd-v2 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-54/dscho/mingw-getcwd-v2 Pull-Request: https://github.com/gitgitgadget/git/pull/54 Range-diff vs v1: 1: e13ae2338 = 1: e13ae2338 mingw: ensure `getcwd()` reports the correct case 2: 3e3b1c3b1 ! 2: 87ef9ac63 mingw: fix getcwd when the parent directory cannot be queried @@ -4,7 +4,7 @@ `GetLongPathName()` function may fail when it is unable to query the parent directory of a path component to determine the long name - for that component. It happens, because of it uses `FindFirstFile()` + for that component. It happens, because it uses `FindFirstFile()` function for each next short part of path. The `FindFirstFile()` requires `List Directory` and `Synchronize` desired access for a calling process.