mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
.devcontainer
.github
.vscode
cmd
docs
pkg
app
cheatsheet
commands
common
config
constants
env
fakes
gui
context
controllers
filetree
keybindings
mergeconflicts
modes
cherrypicking
diffing
diffing.go
filtering
patch_exploring
popup
presentation
services
style
types
app_status_manager.go
arrangement.go
background.go
branches_panel.go
command_log_panel.go
commit_files_panel.go
commit_message_panel.go
commits_panel.go
confirmation_panel.go
context.go
context_config.go
controllers.go
custom_patch_options_panel.go
diff_context_size_test.go
diffing.go
dummies.go
editors.go
extras_panel.go
file_watching.go
files_panel.go
filtering.go
filtering_menu_panel.go
global_handlers.go
gui.go
gui_common.go
gui_driver.go
information_panel.go
keybindings.go
layout.go
list_context_config.go
main_panels.go
menu_panel.go
modes.go
options_menu_panel.go
pty.go
pty_windows.go
quitting.go
recent_repos_panel.go
reflog_panel.go
refresh.go
remote_branches_panel.go
remotes_panel.go
searching.go
side_window.go
snake.go
stash_panel.go
status_panel.go
sub_commits_panel.go
submodules_panel.go
suggestions_panel.go
tags_panel.go
tasks_adapter.go
test_mode.go
updates.go
view_helpers.go
views.go
whitespace-toggle.go
window.go
i18n
integration
logs
secureexec
snake
tasks
theme
updates
utils
scripts
test
uffizzi
vendor
.gitignore
.golangci.yml
.goreleaser.yml
CODE-OF-CONDUCT.md
CONTRIBUTING.md
Dockerfile
LICENSE
README.md
go.mod
go.sum
main.go
29 lines
616 B
Go
29 lines
616 B
Go
package diffing
|
|
|
|
// if ref is blank we're not diffing anything
|
|
type Diffing struct {
|
|
Ref string
|
|
Reverse bool
|
|
}
|
|
|
|
func New() Diffing {
|
|
return Diffing{}
|
|
}
|
|
|
|
func (self *Diffing) Active() bool {
|
|
return self.Ref != ""
|
|
}
|
|
|
|
// GetFromAndReverseArgsForDiff tells us the from and reverse args to be used in a diff command.
|
|
// If we're not in diff mode we'll end up with the equivalent of a `git show` i.e `git diff blah^..blah`.
|
|
func (self *Diffing) GetFromAndReverseArgsForDiff(from string) (string, bool) {
|
|
reverse := false
|
|
|
|
if self.Active() {
|
|
reverse = self.Reverse
|
|
from = self.Ref
|
|
}
|
|
|
|
return from, reverse
|
|
}
|