Skip to content

Commit e75bffe

Browse files
committed
feat: Git UI for managing large numbers of branches.
Not good at graphs, but good at trees.
0 parents  commit e75bffe

89 files changed

Lines changed: 25150 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.cargo/config.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
target-dir = "/tmp/git-stackui_target"

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.github/ @TokTok/admins

‎.github/workflows/actions.lock‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file is machine-generated by `gh actions-lock`.
2+
# Do not edit by hand; run `gh actions-lock` to update.
3+
# Docs: https://gh.io/actions-lockfile
4+
version: 'v0.0.3'
5+
workflows:
6+
'.github/workflows/ci.yml': []
7+
'.github/workflows/draft.yml': []

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
common:
9+
uses: TokTok/ci-tools/.github/workflows/common-ci.yml@master

‎.github/workflows/draft.yml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: draft
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request_target:
7+
branches: [master]
8+
types: [opened, reopened, synchronize]
9+
10+
# Cancel old builds when pushing new commits.
11+
concurrency:
12+
group: draft-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
release:
17+
uses: TokTok/ci-tools/.github/workflows/release-drafter.yml@master

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/bazel-*
2+
/target/

‎.restyled.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
restylers:
3+
- rustfmt:
4+
image: "toxchat/restylers:rustfmt"
5+
arguments: ["--edition=2024"]
6+
- "*"

‎BUILD.bazel‎

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_clippy", "rust_library", "rust_test")
2+
load("//tools/project:build_defs.bzl", "project")
3+
4+
project(license = "gpl3-https")
5+
6+
rust_library(
7+
name = "git_stackui_lib",
8+
srcs = [
9+
"src/diff_utils.rs",
10+
"src/engine/executor.rs",
11+
"src/engine/git.rs",
12+
"src/engine/github.rs",
13+
"src/engine/mod.rs",
14+
"src/engine/planner.rs",
15+
"src/engine/refs.rs",
16+
"src/engine/topology.rs",
17+
"src/engine/transaction.rs",
18+
"src/engine/types.rs",
19+
"src/lib.rs",
20+
"src/patch_utils.rs",
21+
"src/runtime.rs",
22+
"src/split_state.rs",
23+
"src/state/actions.rs",
24+
"src/state/input.rs",
25+
"src/state/mod.rs",
26+
"src/state/reducer.rs",
27+
"src/state/types.rs",
28+
"src/testing.rs",
29+
"src/topology/mod.rs",
30+
"src/topology/virtual_layer.rs",
31+
"src/ui/common.rs",
32+
"src/ui/main_view.rs",
33+
"src/ui/mod.rs",
34+
"src/ui/preview_view.rs",
35+
"src/ui/prompt_view.rs",
36+
"src/ui/split_view.rs",
37+
],
38+
crate_name = "git_stackui",
39+
edition = "2024",
40+
tags = ["no-cross"],
41+
visibility = ["//visibility:public"],
42+
deps = [
43+
"@crates//:anyhow",
44+
"@crates//:crossterm",
45+
"@crates//:git2",
46+
"@crates//:indexmap",
47+
"@crates//:itertools",
48+
"@crates//:petgraph",
49+
"@crates//:ratatui",
50+
"@crates//:serde",
51+
"@crates//:serde_json",
52+
"@crates//:tempfile",
53+
"@crates//:tokio",
54+
"@crates//:unicode-segmentation",
55+
],
56+
)
57+
58+
rust_binary(
59+
name = "git-stackui",
60+
srcs = ["src/main.rs"],
61+
edition = "2024",
62+
rustc_flags = ["-Clink-arg=-fuse-ld=bfd"],
63+
tags = ["no-cross"],
64+
deps = [
65+
":git_stackui_lib",
66+
"@crates//:anyhow",
67+
"@crates//:clap",
68+
"@crates//:serde",
69+
"@crates//:serde_json",
70+
"@crates//:tokio",
71+
],
72+
)
73+
74+
TEST_SRCS = glob(
75+
["test/*.rs"],
76+
exclude = ["test/apply_cli_tests.rs"],
77+
)
78+
79+
[
80+
rust_test(
81+
name = test_file.replace("test/", "").replace(".rs", ""),
82+
size = "medium" if test_file == "test/apply_plan_integration_tests.rs" else "small",
83+
srcs = [test_file],
84+
data = glob(["test/snapshots/**"]) + ["@git"],
85+
edition = "2024",
86+
env = {"GIT_STACKUI_GIT_BIN": "$(rootpath @git)"},
87+
env_inherit = ["PATH"],
88+
rustc_flags = ["-Clink-arg=-fuse-ld=bfd"],
89+
tags = ["no-cross"],
90+
deps = [
91+
":git_stackui_lib",
92+
"@crates//:anyhow",
93+
"@crates//:crossterm",
94+
"@crates//:git2",
95+
"@crates//:insta",
96+
"@crates//:petgraph",
97+
"@crates//:proptest",
98+
"@crates//:ratatui",
99+
"@crates//:regex",
100+
"@crates//:tempfile",
101+
"@crates//:tokio",
102+
],
103+
)
104+
for test_file in TEST_SRCS
105+
]
106+
107+
# Special-cased: shells out to the built git-stackui binary, so it needs the binary
108+
# as a data dep and the path injected via env.
109+
rust_test(
110+
name = "apply_cli_tests",
111+
size = "small",
112+
srcs = ["test/apply_cli_tests.rs"],
113+
data = [
114+
":git-stackui",
115+
"@git",
116+
],
117+
edition = "2024",
118+
env = {
119+
"GIT_STACKUI_BIN": "$(rootpath :git-stackui)",
120+
"GIT_STACKUI_GIT_BIN": "$(rootpath @git)",
121+
},
122+
env_inherit = ["PATH"],
123+
rustc_flags = ["-Clink-arg=-fuse-ld=bfd"],
124+
tags = ["no-cross"],
125+
deps = [
126+
":git_stackui_lib",
127+
"@crates//:git2",
128+
"@crates//:serde_json",
129+
"@crates//:tempfile",
130+
],
131+
)
132+
133+
rust_clippy(
134+
name = "clippy",
135+
testonly = True,
136+
tags = ["no-cross"],
137+
deps = [
138+
":apply_cli_tests",
139+
":git-stackui",
140+
":git_stackui_lib",
141+
] + [
142+
":" + src.replace("test/", "").replace(".rs", "")
143+
for src in TEST_SRCS
144+
],
145+
)

0 commit comments

Comments
 (0)