// Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: BUSL-1.1 package git import ( "context" "fmt" "strconv" "strings" ) type ( // RebaseMerges is the strategy for handling merge commits in rebases RebaseMerges = string // RebaseMerges is the strategy for rebasing RebaseStrategy = string // RebaseMerges is the strategy for handling whitespace during rebasing WhitespaceAction = string ) const ( RebaseMergesCousins RebaseMerges = "rebase-cousins" RebaseMergesNoCousins RebaseMerges = "no-rebase-cousins" RebaseStrategyTrue RebaseStrategy = "true" RebaseStrategyFalse RebaseStrategy = "false" RebaseStrategyMerges RebaseStrategy = "merges" RebaseStrategyInteractive RebaseStrategy = "interactive" WhitespaceActionNoWarn WhitespaceAction = "nowarn" WhitespaceActionWarn WhitespaceAction = "warn" WhitespaceActionFix WhitespaceAction = "fix" WhitespaceActionError WhitespaceAction = "error" WhitespaceActionErrorAll WhitespaceAction = "error-all" ) // RebaseOpts are the git rebase flags and arguments // See: https://git-scm.com/docs/git-rebase type RebaseOpts struct { // Options AllowEmptyMessage bool // --allow-empty-message Apply bool // --apply Autosquash bool // --autosquash Autostash bool // --autostash CommitterDateIsAuthorDate bool // --committer-date-is-author-date Context uint // -C Empty EmptyCommit // --empty= Exec string // --exec= ForceRebase bool // --force-rebase ForkPoint bool // --fork-point GPGSign bool // --gpgsign GPGSignKeyID string // --gpgsign= IgnoreDate bool // --ignore-date IgnoreWhitespace bool // --ignore-whitespace KeepBase string // --keep-base KeepEmpty bool // --keep-empty Merge bool // --merge NoAutosquash bool // --no-autosquash NoAutostash bool // --no-autostash NoKeepEmpty bool // --no-keep-empty NoReapplyCherryPicks bool // --no-reapply-cherry-picks NoRebaseMerges bool // --no-rebase-merges NoRescheduleFailedExec bool // --no-reschedule-failed-exec NoReReReAutoupdate bool // --no-rerere-autoupdate NoStat bool // --no-stat NoUpdateRefs bool // --no-update-refs NoVerify bool // --no-verify Onto string // --onto Quiet bool // --quiet ReapplyCherryPicks bool // --reapply-cherry-picks RebaseMerges RebaseMerges // --rebase-merges= RescheduleFailedExec bool // --reschedule-failed-exec ResetAuthorDate bool // --reset-author-date ReReReAutoupdate bool // --rerere-autoupdate Root bool // --root Stat bool // --stat Strategy MergeStrategy // --strategy StragegyOptions []MergeStrategyOption // --strategy-option=