core
core copied to clipboard
important bug in file tree: dragging file into dir and selecting "Copy New File" adds everything to git!
Need to check the git add command that is being run -- it is not correct. This may happen in other situations so probably add a wrapper for all such calls to prevent this. You can undo with git reset but it is a pain if you don't notice in time!
Also the Copy New File itself doesn't quite seem to work..
the offending code is in filetree/file.go:392 -- it is doing nfn.AddtoVCS() where nfn is supposed to be the target path, but apparently isn't quite somehow..
added a check that path == tpath -- hopefully will allow catching the bug -- wasn't able to reproduce in various testing on a dummy repo..
2a1f1175e65b666f2da557ad330c44e8be3ec81b
Given that this issue cannot currently be reproduced, I will close it. If it ever comes up again in the future, this issue can be reopened.
I had this happen again at some point. I think another place where this can happen is in the vcs/git.go code:
// Move moves updates the repo with the rename
func (gr *GitRepo) Move(oldpath, newpath string) error {
out, err := gr.RunFromDir("git", "mv", RelPath(gr, oldpath), RelPath(gr, newpath))
// if err != nil {
// log.Println(string(out))
// fmt.Printf("%s\n", out)
// return err
// }
out, err = gr.RunFromDir("git", "add", RelPath(gr, newpath))
if err != nil {
log.Println(string(out))
return err
}
return nil
}
it is generating some kind of error there (why the error printing is commented out) and then the add is probably adding everything under a directory.
This was fixed in 311f773de