// IsWorkingCopyDirty returns true if and only if the working copy in which the
// command was executed is dirty as compared to the index.
//
// If the status of the working copy could not be determined, an error will be
// returned instead.
174898
func IsWorkingCopyDirty() (bool, error) {
	bare, err := IsBare()
	if bare || err != nil {
		return false, err
	}

	out, err := gitSimple("status", "--porcelain")
	if err != nil {
		return false, err
	}
	return len(out) != 0, nil
}
1187795
func requireWorkingCopy() {
	bare, err := git.IsBare()
	if err != nil {
		ExitWithError(errors.Wrap(
			err, "fatal: could not determine bareness"))
	}

	if bare {
		Print("This operation must be run in a work tree.")
		os.Exit(128)
	}
}
1297115
func sortedCopy(input stats.Float64Data) (sorted stats.Float64Data) {
	sorted = make(stats.Float64Data, input.Len())
	copy(sorted, input)
	sort.Float64s(sorted)
	return
}
316840
func (d *DirtyBlockCacheStandard) RequestPermissionToDirty(
	ctx context.Context, _ tlf.ID, estimatedDirtyBytes int64) (
	DirtyPermChan, error) {
	d.shutdownLock.RLock()
	defer d.shutdownLock.RUnlock()
	if d.isShutdown {
		return nil, ShutdownHappenedError{}
	}

	if estimatedDirtyBytes < 0 {
		panic("Must request permission for a non-negative number of bytes.")
	}
	c := make(chan struct{})

	// No need to wait to write 0 bytes.
	if estimatedDirtyBytes == 0 {
		close(c)
		return c, nil
	}

	now := d.clock.Now()
	deadline, ok := ctx.Deadline()
	defaultDeadline := now.Add(BackgroundTaskTimeout / 2)
	if !ok || deadline.After(defaultDeadline) {
		// Use half of the background task timeout, to make sure we
		// never get close to a timeout in a background task.
		deadline = defaultDeadline
	}
	req := dirtyReq{c, estimatedDirtyBytes, now, deadline}
	select {
	case d.requestsChan <- req:
		return c, nil
	case <-ctx.Done():
		return nil, ctx.Err()
	}
}
593773
func (df *DirtyFile) UpdateNotYetSyncingBytes(newBytes int64) {
	df.lock.Lock()
	defer df.lock.Unlock()
	df.notYetSyncingBytes += newBytes
	if df.notYetSyncingBytes < 0 {
		// It would be better if we didn't have this check, but it's
		// hard for folderBlockOps to account correctly when bytes in
		// a syncing block are overwritten, and then the write is
		// deferred (see KBFS-2157).
		df.notYetSyncingBytes = 0
	}
	df.dirtyBcache.UpdateUnsyncedBytes(df.Path.Tlf, newBytes, false)
}
777814
func (in *Workflow) DeepCopy() *Workflow {
	if in == nil {
		return nil
	}
	out := new(Workflow)
	in.DeepCopyInto(out)
	return out
}
1236294
func (s Status) IsClean() bool {
	for _, status := range s {
		if status.Worktree != Unmodified || status.Staging != Unmodified {
			return false
		}
	}

	return true
}
563657
func (in *ReplicationControllerCondition) DeepCopy() *ReplicationControllerCondition {
	if in == nil {
		return nil
	}
	out := new(ReplicationControllerCondition)
	in.DeepCopyInto(out)
	return out
}
552966
func SyncDirAdditive(src, dst string) error {
	srcInfos, err := ioutil.ReadDir(src)
	if err != nil {
		return errors.Wrapf(err, "failed to open %s", src)
	}

	for _, srcInfo := range srcInfos {
		srcPath := path.Join(src, srcInfo.Name())
		dstPath := path.Join(dst, srcInfo.Name())

		if dstInfo, err := os.Stat(dstPath); os.IsNotExist(err) {
			// safe to copy
			if srcInfo.IsDir() {
				err = CopyDir(srcPath, dstPath)
			} else {
				err = CopyFile(srcPath, dstPath)
			}
			if err != nil {
				return errors.Wrapf(err, "failed to copy %s to %s", srcPath, dstPath)
			}
		} else if err != nil {
			return errors.Wrapf(err, "failed to stat %s", dstPath)
		} else if srcInfo.IsDir() && dstInfo.IsDir() {
			// if source and destination are both directories, sync recursively
			if err = SyncDirAdditive(srcPath, dstPath); err != nil {
				return errors.Wrapf(err, "failed to sync %s to %s", srcPath, dstPath)
			}
		}
	}
	return nil
}
341819
func (s *UploadPartCopyOutput) SetCopySourceVersionId(v string) *UploadPartCopyOutput {
	s.CopySourceVersionId = &v
	return s
}
597833
func IsErrFilePos(err error) bool {
	if err == nil {
		return false
	}
	_, isErrFilePos := err.(ErrFilePos)
	return isErrFilePos
}
882700
func sortedCopyDif(input Float64Data) (copy Float64Data) {
	if sort.Float64sAreSorted(input) {
		return input
	}
	copy = copyslice(input)
	sort.Float64s(copy)
	return
}
431158
func (_m *API) VirtualizationCopyTo(ctx context.Context, ID string, path string, content io.Reader, AllowOverwriteDirWithFile bool, CopyUIDGID bool) error {
	ret := _m.Called(ctx, ID, path, content, AllowOverwriteDirWithFile, CopyUIDGID)

	var r0 error
	if rf, ok := ret.Get(0).(func(context.Context, string, string, io.Reader, bool, bool) error); ok {
		r0 = rf(ctx, ID, path, content, AllowOverwriteDirWithFile, CopyUIDGID)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
147227
func (fbo *folderBlockOps) GetDirtyFileBlockRefs(
	lState *kbfssync.LockState) []data.BlockRef {
	fbo.blockLock.RLock(lState)
	defer fbo.blockLock.RUnlock(lState)
	var dirtyRefs []data.BlockRef
	for ref := range fbo.unrefCache {
		dirtyRefs = append(dirtyRefs, ref)
	}
	return dirtyRefs
}
56529
func NewDefaultCopyStrategy(o *RsyncOptions) CopyStrategy {
	strategies := copyStrategies{}
	if hasLocalRsync() {
		if isWindows() {
			strategies = append(strategies, NewRsyncDaemonStrategy(o))
		} else {
			strategies = append(strategies, NewRsyncStrategy(o))
		}
	} else {
		warnNoRsync(o.ErrOut)
	}
	return append(strategies, NewTarStrategy(o))
}
514021
func IsCorrupted(err error) bool {
	switch err.(type) {
	case *ErrCorrupted:
		return true
	case *storage.ErrCorrupted:
		return true
	}
	return false
}
450705
func (s *UploadPartCopyInput) SetCopySourceIfNoneMatch(v string) *UploadPartCopyInput {
	s.CopySourceIfNoneMatch = &v
	return s
}