Commit graph

3 commits

Author SHA1 Message Date
Josef Weidendorfer f676fa76e2 Strip any trailing slash on destination argument
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-11-01 14:45:49 -08:00
Josef Weidendorfer 05ff5649a4 Check another error condition in git-mv
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-25 22:50:49 -07:00
Josef Weidendorfer 1114b26e8f Add git-mv
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>
2005-10-23 17:25:08 -07:00