func (g *gitCtx) gitHeadTimestamp() (int, error) {
	gitShowCommand := g.gitCommand("show", "-s", "--format=format:%ct", "HEAD")
	_, gitOutput, err := gitShowCommand.run()
	if err != nil {
		logrus.WithError(err).Debug("Could not obtain timestamp of git HEAD")
		return 0, err
	}
	timestamp, convErr := strconv.Atoi(string(gitOutput))
	if convErr != nil {
		logrus.WithError(convErr).Errorf("Failed to parse timestamp %q", gitOutput)
		return 0, convErr
	}
	return timestamp, nil
}
func (g *gitCtx) gitHeadTimestamp() (int, error) {
	gitShowCommand := g.gitCommand("show", "-s", "--format=format:%ct", "HEAD")
	_, gitOutput, err := gitShowCommand.run()
	if err != nil {
		logrus.WithError(err).Debug("Could not obtain timestamp of git HEAD")
		return 0, err
	}
	timestamp, convErr := strconv.Atoi(string(gitOutput))
	if convErr != nil {
		logrus.WithError(convErr).Errorf("Failed to parse timestamp %q", gitOutput)
		return 0, convErr
	}
	return timestamp, nil
}
func ( g * gitCtx ) gitHeadTimestamp ( ) ( int , error ) { gitShowCommand := g . gitCommand ( " " , " " , " " , " " ) _ , gitOutput , err := gitShowCommand . run ( ) if err != nil { logrus . WithError ( err ) . Debug ( " " ) return 0 , err } timestamp , convErr := strconv . Atoi ( string ( gitOutput ) ) if convErr != nil { logrus . WithError ( convErr ) . Errorf ( " " , gitOutput ) return 0 , convErr } return timestamp , nil }
// gitHeadTimestamp returns the timestamp of the HEAD commit as seconds from the
// UNIX epoch. If unable to read the timestamp for any reason (such as missing
// the git, or not using a git repo), it returns 0 and an error.
gitHeadTimestamp returns the timestamp of the HEAD commit as seconds from the UNIX epoch . If unable to read the timestamp for any reason ( such as missing the git or not using a git repo ) it returns 0 and an error .