Skip to content

Commit b30075a

Browse files
committed
Just allow a...b and a..b two kinds of parameter
1 parent 0749bb5 commit b30075a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

modules/git/repo_compare.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ func parseDiffStat(stdout string) (numFiles, totalAdditions, totalDeletions int,
233233
return numFiles, totalAdditions, totalDeletions, err
234234
}
235235

236+
// parseCompareArgs parses the compareArgs string into a slice of arguments
237+
// Only supports the following formats:
238+
// - "base...head"
239+
// - "base..head"
236240
func parseCompareArgs(compareArgs string) (args []string) {
237241
parts := strings.Split(compareArgs, "...")
238242
if len(parts) == 2 {
@@ -242,10 +246,6 @@ func parseCompareArgs(compareArgs string) (args []string) {
242246
if len(parts) == 2 {
243247
return parts
244248
}
245-
parts = strings.Fields(compareArgs)
246-
if len(parts) == 2 {
247-
return parts
248-
}
249249

250250
return nil
251251
}

modules/git/repo_compare_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ func Test_parseCompareArgs(t *testing.T) {
2121
"master..develop",
2222
[]string{"master", "develop"},
2323
},
24-
{
25-
"master HEAD",
26-
[]string{"master", "HEAD"},
27-
},
2824
{
2925
"HEAD...develop",
3026
[]string{"HEAD...develop"},

0 commit comments

Comments
 (0)