Skip to content

Commit

Permalink
Minor variable name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkchoi212 committed Dec 31, 2017
1 parent 21634e1 commit 4b11691
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func parseInput(g *gocui.Gui, v *gocui.View) error {

func main() {
var err error
conflicts, err = Find()
conflicts, err = FindConflicts()
if err != nil {
switch err.(type) {
case *ErrNoConflict:
Expand Down
14 changes: 7 additions & 7 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,26 @@ func parseRawOutput(diff string, dict map[string][]int) error {
return nil
}

func groupConflictOutput(fname string, cwd string, lines []int) ([]Conflict, error) {
func CreateConflictStructs(fname string, cwd string, lines []int) ([]Conflict, error) {
if len(lines)%3 != 0 {
return nil, errors.New("Invalid number of remaining conflict markers")
}

conflicts := []Conflict{}
parsedConflicts := []Conflict{}
for i := 0; i < len(lines); i += 3 {
conf := Conflict{}
conf.Start = lines[i]
conf.Middle = lines[i+1]
conf.End = lines[i+2]
conf.FileName = fname
conf.AbsolutePath = path.Join(cwd, fname)
conflicts = append(conflicts, conf)
parsedConflicts = append(parsedConflicts, conf)
}

return conflicts, nil
return parsedConflicts, nil
}

func Find() (conflicts []Conflict, err error) {
func FindConflicts() (conflicts []Conflict, err error) {
dummyPath := "/Users/mikechoi/src/CSCE-313/"
stdout, stderr, _ := RunCommand("git", dummyPath, "--no-pager", "diff", "--check")

Expand All @@ -168,8 +168,8 @@ func Find() (conflicts []Conflict, err error) {
}

for fname := range diffMap {
if groupedConflicts, err := groupConflictOutput(fname, dummyPath, diffMap[fname]); err == nil {
conflicts = append(conflicts, groupedConflicts...)
if out, err := CreateConflictStructs(fname, dummyPath, diffMap[fname]); err == nil {
conflicts = append(conflicts, out...)
} else {
return nil, err
}
Expand Down

0 comments on commit 4b11691

Please sign in to comment.