Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sets EOL convention ANY in case SYSTEM-EXTERNALFORMAT defaults to :THROUGH #2090

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rmkaplan
Copy link
Contributor

@rmkaplan rmkaplan commented Apr 1, 2025

This is a follow on to the issue I brought up in the technical meeting 3/31/2025.

The problem is that information returned by a GIT-COMMAND is read from a file with the value returned by SYSTEM-EXTERNALFORMAT. For a separate unknown reason, sometimes on my Mac UNIX-GETENV returns NIL for all of the possible ways that it tries to detect the system's default encoding, and in that case it returns the format :THROUGH, which just does byte-for-byte with no interpretation.

And if the command result-string has entries separated by LF, those don't get broken up when they are read by GIT-RESULT-TO-LINES. For the GIT-BRANCHES command, you get one big string with all the branch names that it knows about, separated by LF, and that one big string can't be converted to an atom. So, for example, it can't even decide that origin/master is one of the branches--it fails.

We talked about changing the default system format to something else (:THROUGH-ANY or :ISO8859/1). In this update I took the easy way out: I explicit assert that the EOL convention is ANY, no matter the selected format.

At least this error goes away. But presumably the return really is UTF-8, so if it had non-ASCII characters it would probably not do the right thing. We should figure out why e.g. (UNIX-GETENV "LANG") is sometimes defined and sometimes not (on Mac, maybe others). If we can't guarantee it automatically, then perhaps there should be a Lisp variable DEFAULT-SYSTEM-EXTERNALFORMAT that the function uses instead of :THROUGH when it gets no other information. At least the user has easier control.

But what I did here is a first improvement.

@pamoroso
Copy link
Contributor

pamoroso commented Apr 1, 2025

I tested this change on Linux Mint 22 Cinnamon and didn't notice anything unusual with GITFNS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants