code: func (w *Worktree) doAddFile(idx *index.Index, s Status, path string) (added bool, h plumbing.Hash, err error) {
  	if s.File(path).Worktree == Unmodified {
  		return false, h, nil
  	}
  
  	h, err = w.copyFileToStorage(path)
  	if err != nil {
  		if os.IsNotExist(err) {
  			added = true
  			h, err = w.deleteFromIndex(idx, path)
  		}
  
  		return
  	}
  
  	if err := w.addOrUpdateFileToIndex(idx, path, h); err != nil {
  		return false, h, err
  	}
  
  	return true, h, err
  }
docs: // doAddFile create a new blob from path and update the index, added is true if
  // the file added is different from the index.