Skip to content

Commit

Permalink
Fix git commands
Browse files Browse the repository at this point in the history
Changed files were not retrieved properly in latest git versions.
  • Loading branch information
pnezis committed Oct 4, 2024
1 parent 5bcd78c commit f45466f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions workspace/lib/workspace/git.ex
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ defmodule Workspace.Git do
def uncommitted_files(opts \\ []) do
cd = opts[:cd] || File.cwd!()

with {:ok, output} <- git_in_path(cd, ~w[diff --name-only --no-renames HEAD .]) do
with {:ok, output} <- git_in_path(cd, ~w[diff --name-only --no-renames HEAD]) do
{:ok, parse_git_output(output)}
end
end
Expand Down Expand Up @@ -120,7 +120,14 @@ defmodule Workspace.Git do
cd = opts[:cd] || File.cwd!()

with {:ok, output} <-
git_in_path(cd, ["diff", "--name-only", "--no-renames", "--relative", base, head]) do
git_in_path(cd, [
"diff",
"--name-only",
"--no-renames",
"--relative",
"#{base}",
"#{head}"
]) do
{:ok, parse_git_output(output)}
end
end
Expand Down
2 changes: 1 addition & 1 deletion workspace/test/support/test_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ defmodule Workspace.TestUtils do
def init_git_project(path) do
File.cd!(path, fn ->
System.cmd("git", ~w[init])
System.cmd("git", ~w[symbolic-ref HEAD refs/heads/main])
System.cmd("git", ~w[add .])
System.cmd("git", ~w[commit -m "commit"])
System.cmd("git", ~w[symbolic-ref HEAD refs/heads/main])
end)
end

Expand Down

0 comments on commit f45466f

Please sign in to comment.