From: Joshua Jensen <jjensen@workspacewhiz.com>
To: Mike Hommey <mh@glandium.org>, git@vger.kernel.org
Subject: Re: fast-import should not care about core.ignorecase
Date: Mon, 08 Dec 2014 18:07:09 -0700 [thread overview]
Message-ID: <54864B3D.6040503@workspacewhiz.com> (raw)
In-Reply-To: <20141209001211.GA13386@glandium.org>
Mike Hommey wrote on 12/8/2014 5:12 PM:
> While it makes sense for checkouts and local commits, it doesn't make
> sense to me that using git fast-import with the same import script would
> have a different behavior depending on whether the file system is
> case-sensitive or not.
I have used fast-import with Perforce inputs. When you run a Windows
Perforce server, filenames can be submitted with ANY case, but given the
case insensitive nature of the file system, a synced Perforce file will
end up using whatever case happens to be on the file system at that point.
That may not be clear, so here goes:
Revision 1: abc/DEF/ghi/FILE.dat
Revision 2: ABC/def/GHI/file.dat
^^ Yes, Perforce stores the filename internally in that manner and does
not fold the case.
If you happen to sync Revision 2 on an empty directory tree, you'll get
ABC/def/GHI/file.dat. If you then sync Revision 1, the filename case
remains ABC/def/GHI/file.dat.
Likewise, if you happen to sync Revision 1 into an empty directory tree,
you'll get abc/DEF/ghi/FILE.dat. If you then sync Revision 2, the
filename case remains as abc/DEF/ghi/FILE.dat.
I was the one who originally submitted the patch for this some 4 years
ago. It was commit 50906e04e8f48215b0b09841686709b92a2ab2e4. 'git
fast-import' with core.ignorecase=true will fold the case of the
filename specified in Revision 2 to the case currently stored in the Git
repository from Revision 1.
If it does not do this, then Git internally stores FILE.dat and
file.dat, and bad things happen on case-insensitive file systems.
(Further, there are still a few paths into Git where
core.ignorecase=true does not fold the case of the filename, and this
can cause 'repository corruptions' on case-insensitive file systems.
One such place is in 'git update-index' directly used by 'git gui'. I
really need to get this submitted, as we've been beating on it for a
long time now, but here is the partial patch for informational purposes
only.
I think it has been discussed before, but maybe Git needs a
core.casefold in addition to core.ignorecase.)
-Josh
---------------------------- builtin/update-index.c
----------------------------
index aaa6f78..4cfedc1 100644
@@ -99,6 +99,7 @@ static int add_one_path(const struct cache_entry *old,
const char *path, int len
memcpy(ce->name, path, len);
ce->ce_flags = create_ce_flags(0);
ce->ce_namelen = len;
+ fold_ce_name_case(&the_index, ce);
fill_stat_cache_info(ce, st);
ce->ce_mode = ce_mode_from_stat(old, st->st_mode);
@@ -234,6 +235,7 @@ static int add_cacheinfo(unsigned int mode, const
unsigned char *sha1,
memcpy(ce->name, path, len);
ce->ce_flags = create_ce_flags(stage);
ce->ce_namelen = len;
+ fold_ce_name_case(&the_index, ce);
ce->ce_mode = create_ce_mode(mode);
if (assume_unchanged)
ce->ce_flags |= CE_VALID;
next prev parent reply other threads:[~2014-12-09 1:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-09 0:12 fast-import should not care about core.ignorecase Mike Hommey
2014-12-09 0:22 ` Mike Hommey
2014-12-09 1:07 ` Joshua Jensen [this message]
2014-12-09 1:31 ` Jonathan Nieder
2014-12-09 3:20 ` Joshua Jensen
2014-12-09 20:19 ` Junio C Hamano
2015-04-17 11:52 ` [PATCH] fast-import: add options to enable/disable case folding Mike Hommey
2015-04-17 16:56 ` Torsten Bögershausen
2015-04-17 18:44 ` Junio C Hamano
2015-04-18 7:36 ` Mike Hommey
2015-04-24 9:42 ` Luke Diamand
2015-04-17 19:57 ` Eric Sunshine
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=54864B3D.6040503@workspacewhiz.com \
--to=jjensen@workspacewhiz.com \
--cc=git@vger.kernel.org \
--cc=mh@glandium.org \
/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).