aboutsummaryrefslogtreecommitdiff
path: root/git-mv.perl
Commit message (Collapse)AuthorAge
* git-mv: fix moves into a subdir from outsideJosef Weidendorfer2006-03-03
| | | | | | | | | | | | | | | | | | git-mv needs to be run from the base directory so that the check if a file is under revision also covers files outside of a subdirectory. Previously, e.g. in the git repo, cd Documentation; git-mv ../README . produced the error Error: '../README' not under version control The test is extended for this case; it previously only tested one direction. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge git-mv fixes from 'maint'Junio C Hamano2006-03-01
|\
| * git-mv: fixes for path handlingJosef Weidendorfer2006-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moving a directory ending in a slash was not working as the destination was not calculated correctly. E.g. in the git repo, git-mv t/ Documentation gave the error Error: destination 'Documentation' already exists To get rid of this problem, strip trailing slashes from all arguments. The comment in cg-mv made me curious about this issue; Pasky, thanks! As result, the workaround in cg-mv is not needed any more. Also, another bug was shown by cg-mv. When moving files outside of a subdirectory, it typically calls git-mv with something like git-mv Documentation/git.txt Documentation/../git-mv.txt which triggers the following error from git-update-index: Ignoring path Documentation/../git-mv.txt The result is a moved file, removed from git revisioning, but not added again. To fix this, the paths have to be normalized not have ".." in the middle. This was already done in git-mv, but only for a better visual appearance :( Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
| * git-mv: Allow -h without repo & fix error messageJosef Weidendorfer2006-03-01
| | | | | | | | | | | | | | | | | | | | | | This fixes "git-mv -h" to output the usage without the need to be in a git repository. Additionally: - fix confusing error message when only one arg was given - fix typo in error message Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
| * Allow git-mv to accept ./ in paths.Junio C Hamano2006-03-01
| | | | | | | | | | Signed-off-by: Junio C Hamano <junkio@cox.net> (cherry picked from 9a0e6731c632c841cd2de9dec0b9091b2f10c6fd commit)
* | Allow git-mv to accept ./ in paths.Junio C Hamano2006-02-18
|/ | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-mv to work with Perl 5.6Junio C Hamano2005-12-05
| | | | | | List form of pipe open is 5.8 invention. Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH] Make git-mv work in subdirectories, tooJohannes Schindelin2005-11-29
| | | | | | | | | | | | 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>
* git-mv: quote $src in regexp properly.Junio C Hamano2005-11-28
| | | | | | Noticed and fixed by Matthias Urlichs and Josef Weidendorfer. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-mv: follow -k request even on failing renamesJosef Weidendorfer2005-11-27
| | | | | | | | | | | | -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>
* git-mv: fully detect 'directory moved into itself'Josef Weidendorfer2005-11-27
| | | | | | | | | 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>
* git-mv: keep git index consistent with file system on failed renameJosef Weidendorfer2005-11-27
| | | | | | | | | | 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>
* git-mv: shrink usage, no usage on errorJosef Weidendorfer2005-11-27
| | | | | | | | | | | 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>
* git-mv is not able to handle big directoriesAlexander Litvinov2005-11-25
| | | | | | | | | 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>
* Fix git-mv for moving directories with 1 fileJosef Weidendorfer2005-11-23
| | | | | | | | | | | | | | 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>
* Strip any trailing slash on destination argumentJosef Weidendorfer2005-11-01
| | | | | | | | | | | | 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>
* Check another error condition in git-mvJosef Weidendorfer2005-10-25
| | | | | | | | | | | | 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>
* Add git-mvJosef Weidendorfer2005-10-23
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>