githumerge: skip if already merged
authorJean Privat <jean@pryen.org>
Fri, 26 Aug 2016 00:20:52 +0000 (20:20 -0400)
committerJean Privat <jean@pryen.org>
Fri, 26 Aug 2016 00:20:52 +0000 (20:20 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

contrib/github_merge.nit

index a1971fd..46e6105 100644 (file)
@@ -122,6 +122,10 @@ for arg in args do
                print "Commit {sha} not in local repository; did you fetch github?"
                return
        end
+       if system("git merge-base --is-ancestor {sha} HEAD") == 0 then
+               print "Is already merged."
+               continue
+       end
        if system("git merge --no-ff --no-commit {sha}") != 0 then
                system("cp mergemsg `git rev-parse --git-dir`/MERGE_MSG")
                print "Problem during merge... Let's do the commit manually."