git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 3/3] read_directory(): infrastructure for pathname character set conversion
Date: Thu, 14 May 2009 14:23:37 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0905141413080.3343@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.01.0905141346440.3343@localhost.localdomain>



On Thu, 14 May 2009, Linus Torvalds wrote:

> In particular, this allows:
> 
>  - the filesystem path component separator to be set to something
>    different than the normal UNIX '/' character.

I forgot to mention that this also now allows really having a different 
prefix. The old code had "path" and "base", and without really reading the 
code you might think that you could have a different base for the two, but 
immediately when it recursed, it would re-set the path and base to be the 
same thing, so you could never really have two different address spaces.

The new code very much intentionally keeps the two apart, and the 
_intention_ is that on platforms like Windows, you should not just be able 
to use other path component separators like '\', it should also be 
possible to use an absolute base (which, if I recall correctly, is the 
only way to handle things like long path-names. But maybe I'm wrong - I 
really don't know the crazy native Windows API's).

IOW, the _intention_ is that you could literally pass in something like

	"c:\Source\git\myrepo"

as the "path", and with an empty "base", it would then be possible to 
basically traverse the tree with the filesystem operations building up a 
"path" like

	c:\Source\git\myrepo\subdir\myfile.txt

while "base" would track it, but become "subdir/myfile.txt".

In fact, my intention was that the pathname could easily be in some crazy 
UTF16LE format (ie not a real "string" at all), but I might need to pass 
the "pathlen" around as a parameter if we need to handle strings that 
contain embedded NUL characters. That's an easy thing to do if required, 
though.

Now, it's possible that nobody wants to do that kind of crazy windows 
stuff, because even windows people are perfectly fine using regular utf-8. 
I really dunno. My point is more that this is meant to be very flexible 
basic infrastructure and that we _could_ do things like that.

		Linus

  reply	other threads:[~2009-05-14 21:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 20:42 [PATCH 1/3] dir.c: clean up handling of 'path' parameter in read_directory_recursive() Linus Torvalds
2009-05-14 20:46 ` [PATCH 2/3] Add 'fill_directory()' helper function for directory traversal Linus Torvalds
2009-05-14 20:54   ` [PATCH 3/3] read_directory(): infrastructure for pathname character set conversion Linus Torvalds
2009-05-14 21:23     ` Linus Torvalds [this message]
2009-05-14 22:19     ` Johannes Schindelin
2009-05-14 22:36       ` Aaron Cohen
2009-05-14 22:51         ` Linus Torvalds
2009-05-14 22:47       ` Linus Torvalds
2009-05-15 19:01     ` [PATCH 4/3] Introduce 'convert_path_to_git()' Linus Torvalds
2009-05-16  6:40       ` Junio C Hamano
2009-05-16 17:27         ` Linus Torvalds
2009-05-19 12:20         ` Jens Kilian
2009-05-19 13:31           ` John Koleszar

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=alpine.LFD.2.01.0905141413080.3343@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).