Skip to content

Commit

Permalink
Document is_repo_clean()
Browse files Browse the repository at this point in the history
  • Loading branch information
richardreeve committed Jul 18, 2024
1 parent 910cd33 commit 06a1592
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/test_Phylo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,25 @@ using Git
using Logging
using Pkg

function is_repo_clean(repo_path)
function is_repo_clean(repo_path; ignore_untracked = true)
# Get the status of the repository
statuses = readlines(`$(Git.git()) status -s $repo_path`)
statuses = filter((!) contains("??"), statuses)

if ignore_untracked
# Repo must be clean except for untracked files
statuses = filter((!) contains("??"), statuses)
end

is_clean = isempty(statuses)

# If not clean then report on dirty files
is_clean || @error "\n" * join(statuses, "\n")

return is_clean
end

# Metadata crosswalk testing only works on Julia v1.8 and after due to Project.toml changes
# Also does not currently work on Windows runners on GitHub due to file writing issues
if VERSION VersionNumber("1.8.0") && (!haskey(ENV, "RUNNER_OS") || ENV["RUNNER_OS"] "Windows")
Pkg.develop(url = "https://github.com/richardreeve/ResearchSoftwareMetadata.jl.git")
using ResearchSoftwareMetadata
Expand Down

0 comments on commit 06a1592

Please sign in to comment.