Move generic assertions into new test_util package

Also fixed small bug in the git package -- branches should be listed
using show-ref, not ls-remote. Apologies for tacking this change on
to this CL!

BUG=chromium:980346
TEST=run_test.sh

Change-Id: I18ee2e8d55fc50436a7cbbbb50601656000aae88
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/go/+/1712802
Reviewed-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Evan Hernandez <evanhernandez@chromium.org>
Commit-Queue: Jack Neus <jackneus@google.com>
Tested-by: Jack Neus <jackneus@google.com>
diff --git a/internal/git/git.go b/internal/git/git.go
index 047452c..3fb7179 100644
--- a/internal/git/git.go
+++ b/internal/git/git.go
@@ -66,10 +66,14 @@
 	namespace = regexp.MustCompile("(?i)^" + namespace.String())
 	pattern = regexp.MustCompile("(?i)" + pattern.String())
 
-	output, err := RunGit(gitRepo, []string{"ls-remote", gitRepo})
+	output, err := RunGit(gitRepo, []string{"show-ref"})
 	if err != nil {
+		if strings.Contains(err.Error(), "exit status 1") {
+			// Not a fatal error, just no branches.
+			return []string{}, nil
+		}
 		// Could not read branches.
-		return []string{}, fmt.Errorf("git error: %s\nstderr: %s", err.Error(), output.Stderr)
+		return []string{}, fmt.Errorf("git error: %s\nstdout: %s stderr: %s", err.Error(), output.Stdout, output.Stderr)
 	}
 	// Find all branches that match the pattern.
 	branches := strings.Split(output.Stdout, "\n")