func Log(ref ...string) *CommitNode {
	var currentNode *CommitNode
	var headNode *CommitNode
	var oid string

	if len(ref) <= 0 {
		r, _ := storage.GetHead()
		oid, _ = GetOid(r)
	} else {
		oid, _ = GetOid(ref[0])
	}

	_, parent, message, err := GetCommit(oid)
	if err != nil {
		log.Println(err)
		return nil
	}
	for oid != "" {

		previous := currentNode
		currentNode = &CommitNode{
			message: message,
			oid:     oid,
		}
		if previous != nil {
			previous.parent = currentNode
		} else {
			headNode = currentNode
		}
		oid = parent
		_, parent, message, _ = GetCommit(oid)
	}
	return headNode
}
/*
Log iterates over the commits to build a linked list structure starting from the HEAD to the first Commit
*/
Log iterates over the commits to build a linked list structure starting from the HEAD to the first Commit
/ * Log iterates over the commits to build a linked list structure starting from the HEAD to the first Commit * /
func Log(ref ...string) *CommitNode {
	var currentNode *CommitNode
	var headNode *CommitNode
	var oid string
	if len(ref) <= 0 {
		r, _ := storage.GetHead()
		oid, _ = GetOid(r)
	} else {
		oid, _ = GetOid(ref[0])
	}
	_, parent, message, err := GetCommit(oid)
	if err != nil {
		log.Println(err)
		return nil
	}
	for oid != "" {
		previous := currentNode
		currentNode = &CommitNode{
			message: message,
			oid:     oid,
		}
		if previous != nil {
			previous.parent = currentNode
		} else {
			headNode = currentNode
		}
		oid = parent
		_, parent, message, _ = GetCommit(oid)
	}
	return headNode
}
func Log ( ref ... string ) * CommitNode { var currentNode * CommitNode var headNode * CommitNode var oid string if len ( ref ) <= 0 { r , _ := storage . GetHead ( ) oid , _ = GetOid ( r ) } else { oid , _ = GetOid ( ref [ 0 ] ) } _ , parent , message , err := GetCommit ( oid ) if err != nil { log . Println ( err ) return nil } for oid != " " { previous := currentNode currentNode = & CommitNode { message : message , oid : oid , } if previous != nil { previous . parent = currentNode } else { headNode = currentNode } oid = parent _ , parent , message , _ = GetCommit ( oid ) } return headNode }
Log iterates over the commits to build a linked list structure starting from the HEAD to the first Commit
Log iterates over the commits to build a linked list structure starting from the HEAD to the first Commit