Staging
v0.5.1
https://github.com/git/git
Revision a2239b79e554bab92abe47d8568cbbfe5c77ce85 authored by Junio C Hamano on 16 October 2005, 00:30:15 UTC, committed by Junio C Hamano on 16 October 2005, 01:10:02 UTC
Contains the following changes since v0.99.8c.

Johannes Schindelin:
      Teach git-status about spaces in file names also on MacOSX
      t5400-send-pack relies on a working cpio

Jonas Fonseca:
      git.sh: quote all paths

Junio C Hamano:
      Also force LC_ALL in test scripts.
      OpenBSD needs the strcasestr replacement.
      git-check-ref-format: reject funny ref names.
      Refuse to create funny refs in clone-pack, git-fetch and receive-pack.
      Ignore funny refname sent from remote
      Introduce notation "ref^{type}".

Martin Langhoff:
      cvsimport: don't pass --cvs-direct if user options contradict us

Ralf Baechle:
      rsh.c: typo fix

Note that "funny ref" bits are not strictly fixes but rather
backport from the "master" branch.  They will prevent refs and
heads with funny names from being created.  In addition, what is
in the master branch will start feeding the clients unwrapped
tag information to help Martin's findtags and possibly later
Cogito.  These backported "funny ref" changes are to prevent
clients on the "maint" branch from getting confused when talking
with newer git-upload-pack and when reading from info/refs file
prepared with newer git-update-server-info.

Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 4baf5dd
Raw File
Tip revision: a2239b79e554bab92abe47d8568cbbfe5c77ce85 authored by Junio C Hamano on 16 October 2005, 00:30:15 UTC
GIT v0.99.8d
Tip revision: a2239b7
git-rename.perl
#!/usr/bin/perl
#
# Copyright 2005, Ryan Anderson <ryan@michonline.com>
#
# This file is licensed under the GPL v2, or a later version
# at the discretion of Linus Torvalds.


use warnings;
use strict;

sub usage($);

# Sanity checks:
my $GIT_DIR = $ENV{'GIT_DIR'} || ".git";

unless ( -d $GIT_DIR && -d $GIT_DIR . "/objects" && 
	-d $GIT_DIR . "/objects/00" && -d $GIT_DIR . "/refs") {
	usage("Git repository not found.");
}

usage("") if scalar @ARGV != 2;

my ($src,$dst) = @ARGV;

unless (-f $src || -l $src || -d $src) {
	usage("git rename: bad source '$src'");
}

if (-e $dst) {
	usage("git rename: destinations '$dst' already exists");
}

my (@allfiles,@srcfiles,@dstfiles);

$/ = "\0";
open(F,"-|","git-ls-files","-z")
	or die "Failed to open pipe from git-ls-files: " . $!;

@allfiles = map { chomp; $_; } <F>;
close(F);

my $safesrc = quotemeta($src);
@srcfiles = grep /^$safesrc/, @allfiles;
@dstfiles = @srcfiles;
s#^$safesrc(/|$)#$dst$1# for @dstfiles;

rename($src,$dst)
	or die "rename failed: $!";

my $rc = system("git-update-index","--add","--",@dstfiles);
die "git-update-index failed to add new name with code $?\n" if $rc;

$rc = system("git-update-index","--remove","--",@srcfiles);
die "git-update-index failed to remove old name with code $?\n" if $rc;


sub usage($) {
	my $s = shift;
	print $s, "\n" if (length $s != 0);
	print <<EOT;
$0 <source> <dest>
source must exist and be either a file, symlink or directory.
dest must NOT exist.

Renames source to dest, and updates the git cache to reflect the change.
Use "git commit" to make record the change permanently.
EOT
	exit(1);
}
back to top