Skip to content

Commit

Permalink
Properly unstage file (fixes #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulvandermeijs committed Sep 26, 2024
1 parent 3391d38 commit f507ad1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion 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 Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gitls"
version = "0.3.0"
version = "0.3.1"
edition = "2021"
description = "A language server for Git."
license = "MIT"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ to explore the usage of a language server for Git.

### Blame

| Feature | Status |
| -------------- | ----------------- |
| Blame on hover | Implemented |
| Stage file | Under development |
| Feature | Status |
| -------------- | ----------- |
| Blame on hover | Implemented |
| Stage file | Implemented |

### Index

Expand Down
5 changes: 3 additions & 2 deletions src/handlers/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ pub(crate) fn handle_execute_command(
index.add_path(rel_path)?;
}
Command::UnstageFile => {
// TODO: Completely removes the file from the index but should unstage
index.remove_path(rel_path)?
let head = repository.head()?;
let target = head.peel_to_commit()?;
repository.reset_default(Some(&target.into_object()), vec![rel_path])?;
}
}

Expand Down

0 comments on commit f507ad1

Please # to comment.