code: func (s *DiffIndexScanner) scan(line string) (*DiffIndexEntry, error) {
  	// Format is:
  	//   :100644 100644 c5b3d83a7542255ec7856487baa5e83d65b1624c 9e82ac1b514be060945392291b5b3108c22f6fe3 M foo.gif
  	//   :<old mode> <new mode> <old sha1> <new sha1> <status>\t<file name>[\t<file name>]
  
  	parts := strings.Split(line, "\t")
  	if len(parts) < 2 {
  		return nil, errors.Errorf("invalid line: %s", line)
  	}
  
  	desc := strings.Fields(parts[0])
  	if len(desc) < 5 {
  		return nil, errors.Errorf("invalid description: %s", parts[0])
  	}
  
  	entry := &DiffIndexEntry{
  		SrcMode: strings.TrimPrefix(desc[0], ":"),
  		DstMode: desc[1],
  		SrcSha:  desc[2],
  		DstSha:  desc[3],
  		Status:  DiffIndexStatus(rune(desc[4][0])),
  		SrcName: parts[1],
  	}
  
  	if score, err := strconv.Atoi(desc[4][1:]); err != nil {
  		entry.StatusScore = score
  	}
  
  	if len(parts) > 2 {
  		entry.DstName = parts[2]
  	}
  
  	return entry, nil
  }
docs: // scan parses the given line and returns a `*DiffIndexEntry` or an error,
  // depending on whether or not the parse was successful.