-
Notifications
You must be signed in to change notification settings - Fork 466
Remove deprecated reading of env vars for determining diff program #1469
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,6 @@ import ( | |
| "fmt" | ||
| "os" | ||
| "os/exec" | ||
| "runtime" | ||
| "strings" | ||
| ) | ||
|
|
||
| // Invocation of different diff commands, according to environment variables. | ||
|
|
@@ -90,45 +88,10 @@ func (d *Differ) Run() error { | |
| } | ||
|
|
||
| // Find returns the differ to use, using various environment variables. | ||
| func Find() (*Differ, bool) { | ||
| func Find() (*Differ) { | ||
|
Ahajha marked this conversation as resolved.
Outdated
|
||
| d := &Differ{} | ||
| deprecationWarning := false | ||
| if cmd := os.Getenv("BUILDIFIER_DIFF"); cmd != "" { | ||
| deprecationWarning = true | ||
| d.Cmd = cmd | ||
| } | ||
|
|
||
| // Load MultiDiff setting from environment. | ||
| knowMultiDiff := false | ||
| if md := os.Getenv("BUILDIFIER_MULTIDIFF"); md == "0" || md == "1" { | ||
| deprecationWarning = true | ||
| d.MultiDiff = md == "1" | ||
| knowMultiDiff = true | ||
| } | ||
| d.Cmd = "diff --unified" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing the Windows fallback to When Note: You will also need to add if runtime.GOOS == "windows" {
d.Cmd = "FC"
} else {
d.Cmd = "diff --unified"
}References
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I'm not sure about this one. #520 marked this path as deprecated too, but I'm wondering the reason for making the sole Windows path here deprecated. |
||
|
|
||
| if d.Cmd != "" { | ||
| if !knowMultiDiff { | ||
| lower := strings.ToLower(d.Cmd) | ||
| d.MultiDiff = strings.Contains(lower, "tkdiff") && | ||
| isatty(1) && os.Getenv("DISPLAY") != "" | ||
| } | ||
| } else { | ||
| if !knowMultiDiff { | ||
| d.MultiDiff = isatty(1) && os.Getenv("DISPLAY") != "" | ||
| if d.MultiDiff { | ||
| deprecationWarning = true | ||
| } | ||
| } | ||
| if d.MultiDiff { | ||
| d.Cmd = "tkdiff" | ||
| } else { | ||
| if runtime.GOOS == "windows" { | ||
| deprecationWarning = true | ||
| d.Cmd = "FC" | ||
| } else { | ||
| d.Cmd = "diff --unified" | ||
| } | ||
| } | ||
| } | ||
| return d, deprecationWarning | ||
| return d | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.