Skip to content

Commit

Permalink
Support stacked PRs for subfeatures
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymzh committed Apr 26, 2024
1 parent 43f9272 commit a9ef2a1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/sugarjar/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ def smartpullrequest(*args)
end

if gh?
curr = current_branch
base = tracked_branch
if @pr_autofill
curr = current_branch
base = tracked_branch
num_commits = git(
'rev-list', '--count', curr, "^#{base}"
).stdout.strip.to_i
Expand All @@ -345,6 +345,14 @@ def smartpullrequest(*args)
args.unshift('--fill')
end
end
if all_local_branches.reject { |x| x == most_main }.include?(base)
$stdout.print(
'It looks like this is a subfeature, would you like to base ' +
"this PR on #{base}? [y/n] ",
)
ans = $stdin.gets.strip
args += ['--base', base] if %w{Y y}.include?(ans)
end
SugarJar::Log.trace("Running: gh pr create #{args.join(' ')}")
system(which('gh'), 'pr', 'create', *args)
else
Expand Down

0 comments on commit a9ef2a1

Please sign in to comment.