git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] File system difference handling in git

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 22, 2008, 10:24 UTC
Message-ID
<7vtzl6qhtk.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<3f4fd2640801220121w60cb9a69u8519a7ceb81d3414@mail.gmail.com>
"Reece Dunn" <msclrhd@googlemail.com> writes:
Show 7 quoted lines
>   1.  File name representation
>
> For Linux file systems ...
> Therefore, you have:
>
>    os_to_git_path( const NATIVECHAR * ospath, strbuf * gitpath );
>    git_to_os_path( const char * gitpath, const NATIVECHAR * ospath, int oslen );

It is not that simple, I am afraid. Legacy encodings can be used in pathnames. With bog-standard traditional UNIX pathname semantics, all pathnames are sequences of non-NUL, non-slash bytes, separated with slashes, so if you do not allow choices (which is a very sensible ideal world scenario), you can declare that the "git" encoding is UTF-8 and always check things out as-is.

But if you want a project ("git" in your above parlance) to be checked out in two repositories, one with legacy and the other with UTF-8, you cannot just say os_to_git/git_to_os. You would need a bit more information from the repository owners what encodings are suitable. So your os_to_git()/git_to_os() will not be an identity function even on Linux to support such.

I used to have a data directory on my Linux box with EUC-JP pathname and exported as an SMB share to my wife's Windows box, telling samba to transliterate to whatever encoding the other end liked. I did not want to have the pathname on the Linux end in UTF-8 because I did not have enough energey to update my Emacs configuration to grok Japanese in UTF-8 (even though I finally bit the bullet and switched to UTF-8 on the Linux side recently).

I know, this is painful. Real life hurts. Even on Linux, not everybody can live in UTF-8-only world.

Show 8 quoted lines
>   2.  Case (in)sensitivity
>
> Here, you have the following cases:
> ...
>   3.  git says that the files are different, but the filesystem says
> that the files are the same.
>
> Allow the move, updating the git directory tree only.

Sorry, I cannot really tell what you are talking about. You seem to imply, with "Allow the move", that you are describing a scenario that involves a move of one existing file to another, but it is not clear. E.g. did you mean, by 3, "When the user says 'move a b', and if git says a and b are different but if the filesystem says a and b are the same, then..."?

Previous: Reece DunnNext: Reece Dunn
Message 2 of 8 in “[RFC] File system difference handling in git”
  1. Reece DunnJan 22, 2008
  2. Junio C HamanoJan 22, 2008
  3. Reece DunnJan 22, 2008
  4. Steffen ProhaskaJan 22, 2008
  5. Jonathan del StrotherJan 22, 2008
  6. Linus TorvaldsJan 22, 2008
  7. David KastrupJan 22, 2008
  8. Linus TorvaldsJan 22, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.