Skip to content

Commit

Permalink
fix cwd paths
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Feb 18, 2024
1 parent d250aad commit 46ffacb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/libfetchers/git-utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <regex>
#include <span>

namespace fs = std::filesystem;

namespace std {

template<> struct hash<git_oid>
Expand Down Expand Up @@ -302,18 +304,21 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
if (pathExists(modulesFile))
info.submodules = parseSubmodules(modulesFile);

fs::path cwd = fs::current_path();


// Usually ignored, so add it manually
if (pathExists(path / ".devenv.flake.nix")) {
info.files.insert(CanonPath(".devenv.flake.nix"));
info.files.insert(CanonPath(".devenv/flake.json"));
info.files.insert(CanonPath(".devenv/devenv.json"));
info.files.insert(CanonPath(std::string_view(".devenv.flake.nix"), CanonPath(cwd.string())));
info.files.insert(CanonPath(std::string_view(".devenv/flake.json"), CanonPath(cwd.string())));
info.files.insert(CanonPath(std::string_view(".devenv/devenv.json"), CanonPath(cwd.string())));
}
if (pathExists(path / "devenv.local.nix")) {
info.files.insert(CanonPath("devenv.local.nix"));
info.files.insert(CanonPath(std::string_view("devenv.local.nix"), CanonPath(cwd.string())));
}
// begins with .env
if (pathExists(path / ".env")) {
info.files.insert(CanonPath(".env"));
info.files.insert(CanonPath(std::string_view(".env"), CanonPath(cwd.string())));
}

return info;
Expand Down

0 comments on commit 46ffacb

Please sign in to comment.