Skip to content
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

git-interactive-rebase-tool 2.0.0 #70612

Closed
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
39 changes: 13 additions & 26 deletions Formula/git-interactive-rebase-tool.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class GitInteractiveRebaseTool < Formula
desc "Native sequence editor for Git interactive rebase"
homepage "https://gitrebasetool.mitmaro.ca/"
url "https://github.com/MitMaro/git-interactive-rebase-tool/archive/1.2.1.tar.gz"
sha256 "8df32f209d481580c3365a065882e40343ecc42d9e4ed593838092bb6746a197"
url "https://github.com/MitMaro/git-interactive-rebase-tool/archive/2.0.0.tar.gz"
sha256 "572815b6bf152cae9414635caf9c8c918a575747c3a8885767380da4aeeeb709"
license "GPL-3.0-or-later"

livecheck do
Expand All @@ -19,49 +19,36 @@ class GitInteractiveRebaseTool < Formula

depends_on "rust" => :build

uses_from_macos "ncurses"
uses_from_macos "zlib"

def install
system "cargo", "install", *std_cargo_args
end

test do
require "pty" # required for interactivity
require "pty"
require "io/console"

mkdir testpath/"repo" do
system "git", "init"
touch "FILE1"
system "git", "add", "FILE1"
system "git", "commit", "--date='2005-04-07T22:13:13-3:30'",
"--author='Test <test@example.com>'",
"--message='File 1'"
touch "FILE2"
system "git", "add", "FILE2"
system "git", "commit", "--date='2005-04-07T22:13:13-3:30'",
"--author='Test <test@example.com>'",
"--message='File 2'"
end

(testpath/"repo/.git/rebase-merge/git-rebase-todo").write <<~EOS
pick be5eaa0 File 1
pick 32bd1bb File 2
noop
EOS

expected_git_rebase_todo = <<~EOS
drop be5eaa0 File 1
pick 32bd1bb File 2
noop
EOS

env = { "GIT_DIR" => testpath/"repo/.git/" }
executable = bin/"interactive-rebase-tool"
file = testpath/"repo/.git/rebase-merge/git-rebase-todo"
PTY.spawn(env, executable, file) do |stdout, stdin, _pid|
# simulate user input
stdin.putc "d"
stdin.putc "W"
stdout.read
end
todo_file = testpath/"repo/.git/rebase-merge/git-rebase-todo"

_, _, pid = PTY.spawn(env, executable, todo_file)
Process.wait(pid)

assert_equal expected_git_rebase_todo, (testpath/"repo/.git/rebase-merge/git-rebase-todo").read
assert_equal 0, $CHILD_STATUS.exitstatus
assert_equal expected_git_rebase_todo, todo_file.read
end
end