Skip to content

worktree.AddWithOptions not staging deleted files #223

Closed

Description

@boindil

According to docs this should also stage deleted files, but sadly it does not.

err := worktree.AddWithOptions(&git.AddOptions{
	All: true,
})
// AddOptions describes how a add operation should be performed
type AddOptions struct {
	// All equivalent to `git add -A`, update the index not only where the
	// working tree has a file matching `Path` but also where the index already
	// has an entry. This adds, modifies, and removes index entries to match the
	// working tree.  If no `Path` nor `Glob` is given when `All` option is
	// used, all files in the entire working tree are updated.
	All bool
	// Path is the exact filepath to a the file or directory to be added.
	Path string
	// Glob adds all paths, matching pattern, to the index. If pattern matches a
	// directory path, all directory contents are added to the index recursively.
	Glob string
}

Activity

  1. DataHearth commented on Jun 27, 2022

    @DataHearth

    Is there any update on this issue ? We still encounter the problem with the latest version.

    A workaround has been given here but I can't tell for now if it works.

  2. boindil commented on Jun 29, 2022

    @boindil
    Author

    @DataHearth I'm not exactly sure, bis the linked workaround seems pretty similar to what I remember implementing as a workaround.

  3. added a commit that references this issue on Jul 1, 2023
    62e8cf8
  4. added a commit that references this issue on Feb 22, 2024
    5dabd83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions