Skip to content

Commit

Permalink
Merge pull request #34 from Oxen-AI/fix/add-absolute-path
Browse files Browse the repository at this point in the history
Fix/add absolute path
  • Loading branch information
gschoeni authored Nov 5, 2023
2 parents 80cb23e + f58e4ec commit 1b83c5d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions oxen/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion oxen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ log = "0.4.17"
pyo3-log = "0.8.1"
tokio = { version = "1", features = ["full"] }
pyo3-polars = "0.6.0"
liboxen = "0.9.3"
liboxen = "0.9.6"
# liboxen = { path = "../../rust/Oxen/src/lib" }

[build-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions oxen/python/oxen/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ def config_auth(token: str, host: str = "hub.oxen.ai", path: Optional[str] = Non
The host to configure authentication for. Default: 'hub.oxen.ai'
path: `Optional[str]`
The path to save the authentication config to.
Defaults to $HOME/.config/oxen/user_config.toml
Defaults to $HOME/.config/oxen/auth_config.toml
"""
if path is None:
path = f"{util.get_oxen_config_dir()}/user_config.toml"
path = f"{util.get_oxen_config_dir()}/auth_config.toml"
if not path.endswith(".toml"):
raise ValueError("Path must end with .toml")
auth.add_host_auth(host, token, path)
auth.config_auth(host, token, path)
10 changes: 10 additions & 0 deletions oxen/python/oxen/local_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ def add(self, path: str):
"""
Stage a file or directory to be committed.
"""
# Check if the path exists
if not os.path.exists(path):
# try repo.path + path
path = os.path.join(self.path, path)

# Convert to absolute path before adding
path = os.path.abspath(path)
if not os.path.exists(path):
raise Exception(f"Path {path} does not exist.")

self._repo.add(path)

def rm(self, path: str, recursive=False, staged=False, remote=False):
Expand Down

0 comments on commit 1b83c5d

Please sign in to comment.