summaryrefslogtreecommitdiff
path: root/git-mv.perl
AgeCommit message (Collapse)AuthorFilesLines
2005-11-29[PATCH] Make git-mv work in subdirectories, tooLibravatar Johannes Schindelin1-9/+3
Turns out, all git programs git-mv uses are capable of operating in a subdirectory just fine. So don't complain about it. [jc: I think that sounds sane. You need to grab the exit status from `git-rev-parse --git-dir`, which I added. Alex Riesen says this worked fine.] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28git-mv: quote $src in regexp properly.Libravatar Junio C Hamano1-1/+1
Noticed and fixed by Matthias Urlichs and Josef Weidendorfer. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27git-mv: follow -k request even on failing renamesLibravatar Josef Weidendorfer1-0/+5
-k requests to keep running on an error condition. Previously, git-mv stopped on failing renames even with -k. There are some error conditions which are not checked in the first phase of git-mv, eg. 'permission denied'. Still, option -k should work. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27git-mv: fully detect 'directory moved into itself'Libravatar Josef Weidendorfer1-1/+1
This gives a better error message when trying to move a directory into some subdirectory of itself; ie. no real bug fix: renaming already failed before, but with a strange "invalid argument". Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27git-mv: keep git index consistent with file system on failed renameLibravatar Josef Weidendorfer1-2/+10
When doing multiple renames, and a rename in the middle fails, git-mv did not store the successful renames in the git index; this is fixed by delaying the error message on a failed rename to after the git updating. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27git-mv: shrink usage, no usage on errorLibravatar Josef Weidendorfer1-27/+19
Small fixes to be consistent with other git scripts: - usage message is only about options and arguments - on error, exit(1) without the usage message Additionally, "beautifies" output with -n a little bit Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25git-mv is not able to handle big directoriesLibravatar Alexander Litvinov1-9/+22
Use update-index --stdin to handle large number of files without breaking exec() argument storage limit. [jc: with minor cleanup from the version posted on the list] Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23Fix git-mv for moving directories with 1 fileLibravatar Josef Weidendorfer1-8/+17
This is fixed by putting the file into @changedfiles/@addedfiles, and not the directory this file is in. Additionally, this fixes the behavior for attempting to overwrite a file with a directory, and gives a message for all cases where overwriting is not possible (file->dir,dir->file,dir->dir). Thanks for Alexander Litvinov for noting this problem. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-01Strip any trailing slash on destination argumentLibravatar Josef Weidendorfer1-0/+2
Needed because generating a target paths will add another slash. This fixes e.g. "git-mv file dir/", which removed "file" from version control by renaming it to "dir//file", as git-update-index does not accept such paths. Thanks goes to Ben Lau for noting this bug. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-25Check another error condition in git-mvLibravatar Josef Weidendorfer1-1/+11
When moving multiple files at once, it can happen that files get the same target name, like in git-mv a/foo b/foo destdir Both a/foo and b/foo target destdir/foo. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-23Add git-mvLibravatar Josef Weidendorfer1-0/+185
It supersedes git-rename by adding functionality to move multiple files, directories or symlinks into another directory. It also provides according documentation. The implementation renames multiple files, using the arguments from the command line to produce an array of sources and destinations. In a first pass, all requested renames are checked for errors, and overwriting of existing files is only allowed with '-f'. The actual renaming is done in a second pass. This ensures that any error condition is checked before anything is changed. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>