pcal43/fastback

any command causes to run `git --version` and `git lfs --version` multiple times

Opened this issue · 2 comments

I ran backup gc after making a backup

image

fresh logs from local dev

[05:46:56] [Server thread/INFO] (Minecraft) <Mekrath> running gc
[05:47:01] [Server thread/INFO] (fastback) [DEBUG] executing net.pcal.fastback.commands.Commands$$Lambda$8014/0x000002ac82fd5a68@352b0d1b
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] Executing git --version
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] PATH: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] USER: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] HOME: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] [STDOUT] git version 2.42.0.windows.2
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] Executing git lfs --version
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] PATH: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] USER: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] HOME: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] [STDOUT] git-lfs/3.4.0 (GitHub; windows amd64; go 1.20.6; git d06d6e9e)
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] Executing git --version
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] PATH: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] USER: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] HOME: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] [STDOUT] git version 2.42.0.windows.2
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] Executing git lfs --version
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] PATH: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] USER: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] HOME: null
[05:47:01] [pool-6-thread-1/INFO] (fastback) [DEBUG] [STDOUT] git-lfs/3.4.0 (GitHub; windows amd64; go 1.20.6; git d06d6e9e)

found where it is
its the isNativeOk() checks, they call the functions multiple times

perhaps caching the results of the version strings could help with this