@matheusbsbs / matheus-bagliano / commits / 1331df8781
Fork 0

Remove git-rename. git-mv does the same

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Josef Weidendorfer committed Nov 13, 2005 at 15:08 UTC 1331df878113037aabc496860b49ed14a762517c
5 files changed +1 -107
.gitignore
-1
@@ -74,7 +74,6 @@ git-read-tree
74 git-rebase
75 git-receive-pack
76 git-relink
77 -git-rename
77 git-repack
78 git-request-pull
79 git-reset
Documentation/git-rename.txt deleted
-32
@@ -1,32 +0,0 @@
1 -git-rename(1)
2 -=============
3 -
4 -NAME
5 -----
6 -git-rename - Script used to rename a file, directory or symlink.
7 -
8 -
9 -SYNOPSIS
10 ---------
11 -'git-rename' <source> <destination>
12 -
13 -DESCRIPTION
14 ------------
15 -This script is used to rename a file, directory or symlink.
16 -
17 -The index is updated after successful completion, but the change must still be
18 -committed.
19 -
20 -Author
21 -------
22 -Written by Linus Torvalds <torvalds@osdl.org>
23 -Rewritten by Ryan Anderson <ryan@michonline.com>
24 -
25 -Documentation
26 ---------------
27 -Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
28 -
29 -GIT
30 ----
31 -Part of the gitlink:git[7] suite
32 -
Documentation/git.txt
-3
@@ -262,9 +262,6 @@ gitlink:git-push[1]::
262 gitlink:git-rebase[1]::
263 Rebase local commits to new upstream head.
264
265 -gitlink:git-rename[1]::
266 - Rename files and directories.
267 -
265 gitlink:git-repack[1]::
266 Pack unpacked objects in a repository.
267
Makefile
+1 -1
@@ -96,7 +96,7 @@ SCRIPT_SH = \
96
97 SCRIPT_PERL = \
98 git-archimport.perl git-cvsimport.perl git-relink.perl \
99 - git-rename.perl git-shortlog.perl git-fmt-merge-msg.perl \
99 + git-shortlog.perl git-fmt-merge-msg.perl \
100 git-svnimport.perl git-mv.perl git-cvsexportcommit.perl
101
102 SCRIPT_PYTHON = \
git-rename.perl deleted
-70
@@ -1,70 +0,0 @@
1 -#!/usr/bin/perl
2 -#
3 -# Copyright 2005, Ryan Anderson <ryan@michonline.com>
4 -#
5 -# This file is licensed under the GPL v2, or a later version
6 -# at the discretion of Linus Torvalds.
7 -
8 -
9 -use warnings;
10 -use strict;
11 -
12 -sub usage($);
13 -
14 -# Sanity checks:
15 -my $GIT_DIR = $ENV{'GIT_DIR'} || ".git";
16 -
17 -unless ( -d $GIT_DIR && -d $GIT_DIR . "/objects" &&
18 - -d $GIT_DIR . "/objects/" && -d $GIT_DIR . "/refs") {
19 - usage("Git repository not found.");
20 -}
21 -
22 -usage("") if scalar @ARGV != 2;
23 -
24 -my ($src,$dst) = @ARGV;
25 -
26 -unless (-f $src || -l $src || -d $src) {
27 - usage("git rename: bad source '$src'");
28 -}
29 -
30 -if (-e $dst) {
31 - usage("git rename: destinations '$dst' already exists");
32 -}
33 -
34 -my (@allfiles,@srcfiles,@dstfiles);
35 -
36 -$/ = "\0";
37 -open(F,"-|","git-ls-files","-z")
38 - or die "Failed to open pipe from git-ls-files: " . $!;
39 -
40 -@allfiles = map { chomp; $_; } <F>;
41 -close(F);
42 -
43 -my $safesrc = quotemeta($src);
44 -@srcfiles = grep /^$safesrc/, @allfiles;
45 -@dstfiles = @srcfiles;
46 -s#^$safesrc(/|$)#$dst$1# for @dstfiles;
47 -
48 -rename($src,$dst)
49 - or die "rename failed: $!";
50 -
51 -my $rc = system("git-update-index","--add","--",@dstfiles);
52 -die "git-update-index failed to add new name with code $?\n" if $rc;
53 -
54 -$rc = system("git-update-index","--remove","--",@srcfiles);
55 -die "git-update-index failed to remove old name with code $?\n" if $rc;
56 -
57 -
58 -sub usage($) {
59 - my $s = shift;
60 - print $s, "\n" if (length $s != 0);
61 - print <<EOT;
62 -$0 <source> <dest>
63 -source must exist and be either a file, symlink or directory.
64 -dest must NOT exist.
65 -
66 -Renames source to dest, and updates the git cache to reflect the change.
67 -Use "git commit" to make record the change permanently.
68 -EOT
69 - exit(1);
70 -}