git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 0/1] Disallow writing, but not fetching commits with file names containing backslashes
Date: Thu, 26 Dec 2019 17:42:30 +0000	[thread overview]
Message-ID: <pull.682.git.git.1577382151.gitgitgadget@gmail.com> (raw)

As of Git for Windows, v2.24.1(2). cloning a repository that contained a
file with a backslash in its name some time in the past, the command will 
succeed but at the same time print errors like this:

    error: filename in tree entry contains backslash: '\'

A corresponding git fetch will also show those errors, but fail.

The reason is that v2.24.1 is much more strict about backslashes in tree
entries than earlier versions. The intention was actually to prevent 
checking out such files, though: if there was a mistake in a repository long 
ago that has been fixed long since, there is actually no reason why we
should require the history to be rewritten.

This fixes https://github.com/git-for-windows/git/issues/2435.

The idea of this patch is to stop complaining about tree entries, and focus
instead on the index: whenever a file is added to the index, we do not want
any backslashes in the file name on Windows.

As before, this check is only performed on Windows, and only under 
core.protectNTFS. On other platforms, even if core.protectNTFS is turned on,
the backslash is not a directory separator, therefore the Operating System's
syscalls will (should?) refuse to create files on NTFS with backslashes in
their file name.

I would appreciate reviews with a particular eye on keeping users safe: I am
not 100% certain that all relevant file writes go through the index (I think 
that they all go through the index, but I might have well missed a corner
case).

Johannes Schindelin (1):
  mingw: only test index entries for backslashes, not tree entries

 read-cache.c               | 5 +++++
 t/t7415-submodule-names.sh | 7 ++++---
 tree-walk.c                | 6 ------
 3 files changed, 9 insertions(+), 9 deletions(-)


base-commit: 12029dc57db23baef008e77db1909367599210ee
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-682%2Fdscho%2Fmingw-only-error-on-backslash-in-index-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-682/dscho/mingw-only-error-on-backslash-in-index-v1
Pull-Request: https://github.com/git/git/pull/682
-- 
gitgitgadget

             reply	other threads:[~2019-12-26 17:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26 17:42 Johannes Schindelin via GitGitGadget [this message]
2019-12-26 17:42 ` [PATCH 1/1] mingw: only test index entries for backslashes, not tree entries Johannes Schindelin via GitGitGadget
2019-12-26 18:56   ` Junio C Hamano
2019-12-26 21:16     ` Johannes Schindelin
2019-12-30 21:57       ` Junio C Hamano
2020-01-02 19:53         ` Johannes Schindelin
2019-12-26 20:03   ` Jonathan Nieder
2019-12-26 21:23     ` Johannes Schindelin
2019-12-26 21:42       ` Jonathan Nieder
2019-12-26 22:01         ` Junio C Hamano
2019-12-26 22:25           ` Junio C Hamano
2019-12-31 22:51             ` Johannes Schindelin
2020-01-02 19:58         ` Johannes Schindelin
2020-01-04  1:57           ` Jonathan Nieder
2020-01-04 21:29             ` Johannes Schindelin
2019-12-26 19:22 ` [PATCH 0/1] Disallow writing, but not fetching commits with file names containing backslashes Junio C Hamano
2019-12-26 21:19   ` Johannes Schindelin
2019-12-31 22:53 ` [PATCH v2 " Johannes Schindelin via GitGitGadget
2019-12-31 22:53   ` [PATCH v2 1/1] mingw: only test index entries for backslashes, not tree entries Johannes Schindelin via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.682.git.git.1577382151.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).