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

Unable to use GIT #28

Open
marciot opened this issue May 27, 2024 · 9 comments
Open

Unable to use GIT #28

marciot opened this issue May 27, 2024 · 9 comments

Comments

@marciot
Copy link

marciot commented May 27, 2024

Hello,

I was hoping MacRelix would allow me to more easily manage my 68k MacOS development projects, but alas I cannot get it to work.

MacRelixGitError

When I use the git protocol, it says it cannot run "ssh".
When I use the https protocol, I get "Broken Pipe"

Any tips?

@jjuran
Copy link
Owner

jjuran commented May 27, 2024

Hi, Marcio!

MacRelix Git doesn't currently support SSH or HTTPS, only the git protocol, and GitHub no longer allows use of the git protocol. (The remote git@github.com:marciot/test-repo.git matches the format user@host:dir/repo.git, which indicates SSH — remotes using the git protocol look like git://host/dir/repo.git.)

Personally, I develop outside of classic Mac OS and push (via SSH) to a local Git server, whose bare repositories contain the magic git-daemon-export-ok file, allowing my MacRelix clients to git-fetch using the git protocol. When I'm ready to publish, I also push to GitHub.

Let me know if you have more questions.

@marciot
Copy link
Author

marciot commented May 28, 2024

Thank you for the tip, your suggestion reminded me that git can clone from another repo. I do development work inside Basilisk II and it exposes the drives on my Windows PC under the virtual volume "This PC". It turns out I can use MacRelix to clone a repo I have on my Windows drive, do work on it inside Basilisk II, and push my changes to my Windows repo when I am ready to transfer files to GitHub. Then, I can use Git under Windows to push from there onto GitHub using SSH. No git server is needed at all!

This is a huge improvement over my previous workflow of copying files manually to Windows to then check them into a repo.

This will save me a lot of time. Thank you!

A few other observations, when I do "git log", I get "cannot run less: No such file or directory". It looks like "more" is missing too. Does MacRelix have a file pager? Is there a way to set an editor for commit messages?

Lastly, is there any way you could make it so the up arrow recalls the previous command in the shell? Tab completion for file names would be fantastic too. Those are things I have in muscle memory from other shells and it would be hard to adapt to not having them!

@jjuran
Copy link
Owner

jjuran commented May 30, 2024

when I do "git log", I get "cannot run less: No such file or directory". It looks like "more" is missing too. Does MacRelix have a file pager?

The currently available workaround is git log | cat (or symlink /bin/less to cat, etc.). So... no, it doesn't. :-)

Is there a way to set an editor for commit messages?

The technically correct answer is yes, via any of the ways Git supports (e.g. by setting EDITOR). Though that begets the question of whether a suitable editor exists...

There is a bare-bones editor[1] provided in MacRelix:

export VISUAL="buffer --wait --in-place"

After editing, press Enter (i.e. via fn-Return or the keypad) to save, or just close the window to abort.

[1] Not to be confused with a Bare Bones editor. However, with the Apple event support in the macvx interpreter, it should be possible to write a CLI wrapper for BBEdit, for example.

@jjuran
Copy link
Owner

jjuran commented May 30, 2024

Lastly, is there any way you could make it so the up arrow recalls the previous command in the shell?

Again, arrow keys are handled by the console editor and not passed to the shell. I suppose the console could implement an input history on its own...

@marciot
Copy link
Author

marciot commented Jun 7, 2024

@jjuran I've finally managed to set up a git daemon to check out files, as you suggested, but it's been one obstacle after another. Right now I am trying to get "git pull" to work, but it appears as if there isn't a "git-pull" script in "/usr/lib/git-core". I tried creating one, but I think it isn't working because it doesn't have an execute bit set. When I try to fix that, I get:

$ chmod a+x /usr/lib/git-core/git-pull
chmod: /usr/lib/git-core/git-pull: Operation not permitted

It seems like "su" or "sudo" aren't implemented, so once again I am stumped.

I tried to see if I could set an alias for "git fetch; git merge", but there doesn't seem to be an "alias" command either. And even if there was, I wouldn't be able to set it for every session because I have not been able to find out where to make a startup script. Oh, and I recently found out by accident that to use Cntl-C, you have to use the right control key.

I feel like MacRelix could be super helpful once you get the hang of it, but the learning curve is steep. Have you considered documenting all the tricks somewhere, like in the wiki?

Again, arrow keys are handled by the console editor and not passed to the shell. I suppose the console could implement an input history on its own...

This would be super helpful. It doesn't need to be a history, it can just be the last command. I often type a command, or a path, find it is incorrect, then I have to select it, hit cntl-c, followed by cntl-v, to edit it; whereas under Linux an up-arrow would do the trick.

There is a bare-bones editor[1] provided in MacRelix:

export VISUAL="buffer --wait --in-place"

This does the trick nicely (though I had to use EDITOR in place of VISUAL), it's more than sufficient for commit messages. Thank you.

@jjuran
Copy link
Owner

jjuran commented Jun 10, 2024

Right now I am trying to get "git pull" to work, but it appears as if there isn't a "git-pull" script in "/usr/lib/git-core".

So far I've focused only on porting Git binaries, not scripts. Personally, I tend to run git-fetch separately anyway, and in MacRelix, the change is to run git merge origin/master instead of git pull.

$ chmod a+x /usr/lib/git-core/git-pull

Yeah, chmod is a very small Perl script that only understands octal numeral syntax, so that's not going to work. Try chmod 755 /usr/lib/git-core/git-pull.

chmod: /usr/lib/git-core/git-pull: Operation not permitted

It seems like "su" or "sudo" aren't implemented, so once again I am stumped.

"Operation not permitted" is EPERM. You're thinking of "Permission denied", which is EACCES. MacRelix currently doesn't do any permission checks related to user authorization (as implied by "Logging in with full privileges..."), the usual $ prompt notwithstanding, so there's no need for su or sudo.

I tried to see if I could set an alias for "git fetch; git merge", but there doesn't seem to be an "alias" command either.

You can create a shell script which runs those commands.

And even if there was, I wouldn't be able to set it for every session because I have not been able to find out where to make a startup script.

You can set environment variables and such in $HOME/.relix_profile, which is sourced by every login shell.

Also have a look at /etc/startup. It will run (but not source) "Preferences/MacRelix/startup" before opening the first console window (see /etc/welcome).

Oh, and I recently found out by accident that to use Cntl-C, you have to use the right control key.

I'm going to need more details on that. Yes, MacRelix uses some ADB magic to reprogram an Apple Extended Keyboard (I or II) to use different codes for the right modifier keys, but I just tested that Ctrl-C works either way (as does Cmd-period) on my G3 tower. I'm going to assume for now that this is a Basilisk-II-specific issue.

Have you considered documenting all the tricks somewhere, like in the wiki?

MacRelix could indeed use some comprehensive documentation, and recently I'm getting the impression that now is the time. I'm not sure what wiki you refer to; my first thought was a traditional "online" help system (which these days we might think of as offline, i.e. running locally without a network dependency).

This does the trick nicely (though I had to use EDITOR in place of VISUAL)

Dang it. I tested with EDITOR and assumed VISUAL would work similarly. I've since checked the Git source code, and it ignores VISUAL for "dumb" terminals (i.e. with TERM unset).

It doesn't need to be a history, it can just be the last command.

Okay, done! The console doesn't know anything about commands, per se, so it's the last input line — whether to sh, cat, or something else. But it's per console, and it works.

@jjuran
Copy link
Owner

jjuran commented Jun 10, 2024

If you have Open Transport and Internet access, you can run upgrade to download and unpack the latest version.

@marciot
Copy link
Author

marciot commented Jun 10, 2024

If you have Open Transport and Internet access, you can run upgrade to download and unpack the latest version.

I just tried the command editing! This will be a great time saver! I did notice a small glitch where right after the up arrow if I immediately type a left arrow to edit the command it does nothing. I have to either type something or hit the right arrow once to enable editing. Not a big deal.

Yeah, chmod is a very small Perl script that only understands octal numeral syntax, so that's not going to work. Try chmod 755 /usr/lib/git-core/git-pull.

Ahhh, that works. I didn't realize it wasn't the standard chmod.

It was only since my last post that I found out MacRelix has Perl built-in. That's great, as I can use it to add commands that are missing. Currently, my wishlist includes "less" and "find". I understand you are walking a fine line between trying to keep MacRelix slim and not bloated and offering just enough functionality to make it useful.

I'm not sure what wiki you refer to; my first thought was a traditional "online" help system (which these days we might think of as offline, i.e. running locally without a network dependency).

Every GitHub repository has a wiki. The MetaMage repo has one, although I see you are not using it:

MetaMageWiki

If you want to make an "online" help inside MacRelix, you could have it use the files from the GitHub Wiki, as they are easy-to-parse Markdown files. Once you create a page, you can clone the contents of the wiki using this command:

git clone https://github.com/jjuran/metamage_1.wiki.git

I'm going to need more details on that ... I just tested that Ctrl-C works either way (as does Cmd-period) on my G3 tower. I'm going to assume for now that this is a Basilisk-II-specific issue.

Could be. It could also be a Basillisk-on-Windows-specific issue, or maybe my own Basillisk configuration; I may have set Control to map to Command long ago, as on Windows, to copy-and-paste you use Control-C and Control-V, so it sort of makes sense to have Control be Command when emulating MacOS. But then the actual control key has to be something else and it's quite possible I made that into right control and forgot about it.

You can set environment variables and such in $HOME/.relix_profile, which is sourced by every login shell.

Excellent! Thank you!

@jjuran
Copy link
Owner

jjuran commented Jul 26, 2024

I did notice a small glitch where right after the up arrow if I immediately type a left arrow to edit the command it does nothing.

This is now fixed.

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

No branches or pull requests

2 participants