darktable-org / darktable-org/lua-scripts

git commands not running on Windows

Open
#671 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
219
Forks
142
PR merge metrics
No merged PRs in 30d

Description

On windows executing the git command fails from the lua scripts.
It might have something to do with my repo path containing a space. Thought just putting quotes around it does not fix it, there might be strange behaviour in combination with the & concatenator as well.
io.popen("cd " .. repo .. CS .. "git status")
->

fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
     8,8792 LUA ERROR: script_manager.lua: get_current_repo_branch: 318: no current branch detected in repo_data

In my opinion a better solution would be to use the -C <path> argument of git for all commands instead of changing the directory, and also quoting the repo string:
io.popen("git -C \"" .. repo .. "\" status")

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in script_manager.lua at get_current_repo_branch around line 318 and trace the Lua scripts that invoke git through io.popen. Test a repository path containing spaces on Windows and verify that git status and the other affected commands resolve the repository correctly without changing directories.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, lua
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.