pcal43 / fastback

Fast, incremental Minecraft world backups. Powered by Git.
https://pcal43.github.io/fastback/
GNU General Public License v2.0
125 stars 19 forks source link

[enhancement] allow pointing to native git executable #300

Closed Merith-TK closed 8 months ago

Merith-TK commented 8 months ago

The setup for individuals can be an bit weird from time to time, such as some Dedicated Server images (most) not containing an "native git binary", this config would allow the individual to point to an native git binary located on the system that may not be in $PATH,

An example of this is I run my MC through an launcher that clears the $PATH variable to allow for isolated PATH's to be defined, as part of this, my git, which is located at %USERPROFILE%/scoop/shims/git.exe is not detectable by Minecraft/FastBack.

pcal43 commented 8 months ago

It's a reasonable idea. Unfortunately, git itself expects to be able to find itself on the PATH - it uses this to locate subcommands, most of which are discrete executables within the git distro.

So, a solution like this will succeed in executing the core git executable but will then be unable to actually do anything useful (like push or commit).

pcal43 commented 8 months ago

The other thing as well is that this setting couldn't be in the git config - that becomes a chicken-and-egg problem.

So really the only way would be either a mod-scoped properties file (which I'm fairly reluctant to add) or setting environment variables. But in either case, it doesn't really seem like it is any easier than just setting the PATH correctly.

Merith-TK commented 8 months ago

The problem still includes Dedicated Servers, which it is NOT easier to set the PATH as we are not allowed to run generic shell scripts or alter runtime variables easily image That startup command variable is a lie (I just tested it by replacing it with bash start.sh which contains an echo "Custom start worked" and an sleep 120), it acted as if there was no change to the startup command

Alveel commented 4 months ago

@Merith-TK did you find a solution? I happen to also be using scoop :)

Merith-TK commented 4 months ago

Other than setting your system level path to include git? nope.

Cant even use it on my main server network because I run all that shit through itzg/docker-minecraft containers, which iirc dont have git installed in them...

Pcal, please just add the config, since this effectively makes it impossible to use on systems/environments where the PATH variable cannot be defined. HELL, you could legitimately have it so it downloads the appropriate standalone version of git and stores in the minecraft/server folder! Thats what I do for my code-server (common/src/main/java/xyz/merith/CodeServer.java#L80)

plus, you can append a value to PATH, which would resolve your concern about "git must be in path"