Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Utilities/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,15 @@ Returns the path of `file`, relative to the root of the Git repository, or `noth
file is not in a Git repository.
"""
function relpath_from_repo_root(file)
isfile(file) || return nothing
cd(dirname(file)) do
root = repo_root(file)
root !== nothing && startswith(file, root) ? relpath(file, root) : nothing
end
end

function repo_commit(file)
isfile(file) || return nothing
cd(dirname(file)) do
readchomp(`$(git()) rev-parse HEAD`)
end
Expand Down