Skip to content

Misc updates #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 8 additions & 2 deletions 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
Expand Up @@ -39,7 +39,7 @@ concolor-clap = { version = "0.0.9", features = ["api_unstable"] }
proc-exit = "1"
eyre = "0.6"
human-panic = "1"
termtree = "0.2.4"
termtree = "0.4"
indexmap = "1"

git2-ext = "0.0.5"
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ Or use rust to install:
$ cargo install git-stack
```

We also recommend installing
[`git-branch-stash`](https://github.com/gitext-rs/git-branch-stash) for easily
undoing `git stack` operations:
```console
$ cargo install git-branch-stash-cli
```

### Uninstall

See the uninstall method for your installer.
Expand Down Expand Up @@ -204,6 +211,14 @@ If a commit summary is only `WIP` or is prefixed by:

*This includes the prefixes used by [Gitlab](https://docs.gitlab.com/ee/user/project/merge_requests/drafts.html)*

### What is `git branch-staash`

[`git-branch-stash`](https://github.com/gitext-rs/git-branch-stash) is a
separate utility that is like `git stash` for instead of your working tree, it
stashes what commit each of your branches points to. `git stack` backs up
using `git branch-stash`s file format to lower the risk of trying things out
with `git stack`.

### Why don't you just ...?

Have an idea, we'd love to [hear it](https://github.com/gitext-rs/git-stack/discussions)!
Expand Down
13 changes: 13 additions & 0 deletions docs/comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ Cons:
- Only supports Github
- Sounds like they require user-prefixes for branches

## `git-machete`

[Website](https://github.com/VirtusLab/git-machete)

Pros:
- Supports going up and down stacks (`go up`, `go down`, `go next`, `go prev`, `go root`)
- Quick way to diff a branch on a stack

Cons:
- Manually managed branch relationships
- `discover` to get started
- `add` to edit the file from the command-line

## `git spr`

[Website](https://github.com/ejoffe/spr)
Expand Down
4 changes: 3 additions & 1 deletion docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ Why not `git push --set-upstream --force-with-lease origin <branch>`?

### `git branch-stash`

While `git stash` backs up and restores your working tree, `git branch-stash` backs up and restores the state of all of your branches.
While `git stash` backs up and restores your working tree,
[`git branch-stash`](https://github.com/gitext-rs/git-branch-stash) backs up
and restores the state of all of your branches.

`git-stack` implicitly does a `git branch-stash` whenever modifying the tree.

Expand Down
12 changes: 6 additions & 6 deletions src/bin/git-stack/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ impl<'r> Tree<'r> {
node: Some(self.root),
palette,
};
let mut tree = termtree::Tree::root(root).with_glyphs(GLYPHS);
let mut tree = termtree::Tree::new(root).with_glyphs(GLYPHS);
let joint = RenderNode {
repo,
head_branch,
Expand All @@ -1311,7 +1311,7 @@ impl<'r> Tree<'r> {
let stacks_len = self.stacks.len();
for (i, stack) in self.stacks.into_iter().enumerate() {
if i < stacks_len - 1 {
let mut stack_tree = termtree::Tree::root(joint).with_glyphs(JOINT_GLYPHS);
let mut stack_tree = termtree::Tree::new(joint).with_glyphs(JOINT_GLYPHS);
for child_tree in stack.into_iter() {
stack_tree.push(child_tree.into_display(
repo,
Expand All @@ -1325,7 +1325,7 @@ impl<'r> Tree<'r> {
let stack_len = stack.len();
for (j, child_tree) in stack.into_iter().enumerate() {
if i != 0 && j == 0 {
tree.push(termtree::Tree::root(joint).with_glyphs(SPACE_GLYPHS));
tree.push(termtree::Tree::new(joint).with_glyphs(SPACE_GLYPHS));
}
let child = RenderNode {
repo,
Expand All @@ -1334,11 +1334,11 @@ impl<'r> Tree<'r> {
node: Some(child_tree.root),
palette,
};
tree.push(termtree::Tree::root(child).with_glyphs(GLYPHS));
tree.push(termtree::Tree::new(child).with_glyphs(GLYPHS));
if !child_tree.stacks.is_empty() {
for child_stack in child_tree.stacks.into_iter() {
let mut stack_tree =
termtree::Tree::root(joint).with_glyphs(JOINT_GLYPHS);
termtree::Tree::new(joint).with_glyphs(JOINT_GLYPHS);
for child_tree in child_stack.into_iter() {
stack_tree.push(child_tree.into_display(
repo,
Expand All @@ -1350,7 +1350,7 @@ impl<'r> Tree<'r> {
tree.push(stack_tree);
}
if j < stack_len {
tree.push(termtree::Tree::root(joint).with_glyphs(SPACE_GLYPHS));
tree.push(termtree::Tree::new(joint).with_glyphs(SPACE_GLYPHS));
}
}
}
Expand Down