Skip to content

Commit

Permalink
diff with origin
Browse files Browse the repository at this point in the history
  • Loading branch information
Simonis, Matthias authored and Simonis, Matthias committed Mar 1, 2024
1 parent 08308b3 commit 52202e5
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions golang/vaas/cmd/git-scan/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,17 @@ import (
)

func main() {
if len(os.Args) < 2 {
log.Fatal("need 2 parameter: targetBranch")
if len(os.Args) < 3 {
log.Fatal("need 2 parameter: targetBranch, remote")
}

targetBranch := os.Args[1]
if targetBranch == "" {
log.Fatal("no targetBranch set")
}
remote := ""
if len(os.Args) > 2 {
remote = os.Args[2]
}
if remote == "" {
remote = "origin"
remote := os.Args[2]
if targetBranch == "" {
log.Fatal("no remote set")
}

clientID, exists := os.LookupEnv("VAAS_CLIENT_ID")
Expand Down Expand Up @@ -63,7 +60,7 @@ func main() {
}
log.Println("fetch result: ", string(fetchBytes))

gitDiffCommand := exec.Command("git", "diff", "--name-only", targetBranch)
gitDiffCommand := exec.Command("git", "diff", "--name-only", remote+"/"+targetBranch)
diffBytes, err := gitDiffCommand.Output()
if err != nil {
log.Fatal("git diff ", err, string(diffBytes))
Expand Down

0 comments on commit 52202e5

Please sign in to comment.