Merge branch 'js/diff-b' into next

* js/diff-b:
  Document git-diff whitespace flags -b and -w
  diff -b: ignore whitespace at end of line
  receive-pack: do not insist on fast-forward outside refs/heads/
  git-fetch: ignore dereferenced tags in expand_refs_wildcard
  git-clone: Rename --use-immingled-remote option to --no-separate-remote
  gitweb: Fix Atom feed <logo>: it is $logo, not $logo_url
  Make perl/ build procedure ActiveState friendly.
  Pass -M to diff in request-pull
  Set permissions of each new file before "cvs add"ing it.
  git-mv: search more precisely for source directory in index

Conflicts:

	git-clone.sh
This commit is contained in:
Junio C Hamano
2006-12-04 16:33:22 -08:00
16 changed files with 136 additions and 25 deletions

View File

@@ -129,5 +129,21 @@
-a::
Shorthand for "--text".
--ignore-space-change::
Ignore changes in amount of white space. This ignores white
space at line end, and consider all other sequences of one or
more white space characters to be equivalent.
-b::
Shorthand for "--ignore-space-change".
--ignore-all-space::
Ignore white space when comparing lines. This ignores
difference even if one line has white space where the other
line has none.
-w::
Shorthand for "--ignore-all-space".
For more detailed explanation on these common options, see also
link:diffcore.html[diffcore documentation].

View File

@@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
[-o <name>] [-u <upload-pack>] [--reference <repository>]
[--use-separate-remote | --use-immingled-remote] <repository>
[--use-separate-remote | --no-separate-remote] <repository>
[<directory>]
DESCRIPTION
@@ -105,7 +105,7 @@ OPTIONS
of `$GIT_DIR/refs/heads/`. Only the local master branch is
saved in the latter. This is the default.
--use-immingled-remote::
--no-separate-remote::
Save remotes heads in the same namespace as the local
heads, `$GIT_DIR/refs/heads/'. In regular repositories,
this is a legacy setup git-clone created by default in

View File

@@ -91,6 +91,10 @@ all:
#
# Define USE_STDEV below if you want git to care about the underlying device
# change being considered an inode change from the update-cache perspective.
#
# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
# MakeMaker (e.g. using ActiveState under Cygwin).
#
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -539,6 +543,9 @@ endif
ifdef NO_ACCURATE_DIFF
BASIC_CFLAGS += -DNO_ACCURATE_DIFF
endif
ifdef NO_PERL_MAKEMAKER
export NO_PERL_MAKEMAKER
endif
# Shell quote (do not use $(call) to accommodate ancient setups);
@@ -568,8 +575,8 @@ export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi
all: perl/Makefile
$(MAKE) -C perl
all:
$(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
$(MAKE) -C templates
strip: $(PROGRAMS) git$X
@@ -602,7 +609,11 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
chmod +x $@+
mv $@+ $@
$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/Makefile
$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
perl/perl.mak: GIT-CFLAGS
$(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
rm -f $@ $@+
INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
@@ -797,7 +808,7 @@ install: all
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
$(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)'
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
$(MAKE) -C perl install
$(MAKE) -C perl prefix='$(prefix_SQ)' install
if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
then \
ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
@@ -867,8 +878,7 @@ clean:
rm -f $(htmldocs).tar.gz $(manpages).tar.gz
rm -f gitweb/gitweb.cgi
$(MAKE) -C Documentation/ clean
[ ! -f perl/Makefile ] || $(MAKE) -C perl/ clean || $(MAKE) -C perl/ clean
rm -f perl/ppport.h perl/Makefile.old
$(MAKE) -C perl clean
$(MAKE) -C templates/ clean
$(MAKE) -C t/ clean
rm -f GIT-VERSION-FILE GIT-CFLAGS

View File

@@ -146,21 +146,24 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
&& lstat(dst, &st) == 0)
bad = "cannot move directory over file";
else if (src_is_dir) {
const char *src_w_slash = add_slash(src);
int len_w_slash = length + 1;
int first, last;
modes[i] = WORKING_DIRECTORY;
first = cache_name_pos(src, length);
first = cache_name_pos(src_w_slash, len_w_slash);
if (first >= 0)
die ("Huh? %s/ is in index?", src);
die ("Huh? %.*s is in index?",
len_w_slash, src_w_slash);
first = -1 - first;
for (last = first; last < active_nr; last++) {
const char *path = active_cache[last]->name;
if (strncmp(path, src, length)
|| path[length] != '/')
if (strncmp(path, src_w_slash, len_w_slash))
break;
}
free((char *)src_w_slash);
if (last - first < 1)
bad = "source directory is empty";

View File

@@ -14,7 +14,7 @@ die() {
}
usage() {
die "Usage: $0 [--template=<template_directory>] [--use-immingled-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [--depth <n>] [-n] <repo> [<dir>]"
die "Usage: $0 [--template=<template_directory>] [--no-separate-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [--depth <n>] [-n] <repo> [<dir>]"
}
get_repo_base() {
@@ -141,7 +141,7 @@ while
*,--use-separate-remote)
# default
use_separate_remote=t ;;
*,--use-immingled-remote)
*,--no-separate-remote)
use_separate_remote= ;;
1,--reference) usage ;;
*,--reference)
@@ -181,7 +181,7 @@ repo="$1"
test -n "$repo" ||
die 'you must specify a repository to clone.'
# --bare implies --no-checkout and --use-immingled-remote
# --bare implies --no-checkout and --no-separate-remote
if test yes = "$bare"
then
if test yes = "$origin_override"

View File

@@ -116,6 +116,7 @@ if ($opt_a) {
close MSG;
my (@afiles, @dfiles, @mfiles, @dirs);
my %amodes;
my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);
#print @files;
$? && die "Error in git-diff-tree";
@@ -124,6 +125,7 @@ foreach my $f (@files) {
my @fields = split(m!\s+!, $f);
if ($fields[4] eq 'A') {
my $path = $fields[5];
$amodes{$path} = $fields[1];
push @afiles, $path;
# add any needed parent directories
$path = dirname $path;
@@ -268,6 +270,7 @@ if (($? >> 8) == 2) {
}
foreach my $f (@afiles) {
set_new_file_permissions($f, $amodes{$f});
if (grep { $_ eq $f } @bfiles) {
system('cvs', 'add','-kb',$f);
} else {
@@ -342,3 +345,13 @@ sub safe_pipe_capture {
}
return wantarray ? @output : join('',@output);
}
# For any file we want to add to cvs, we must first set its permissions
# properly, *before* the "cvs add ..." command. Otherwise, it is impossible
# to change the permission of the file in the CVS repository using only cvs
# commands. This should be fixed in cvs-1.12.14.
sub set_new_file_permissions {
my ($file, $perm) = @_;
chmod oct($perm), $file
or die "failed to set permissions of \"$file\": $!\n";
}

View File

@@ -116,7 +116,7 @@ expand_refs_wildcard () {
while read sha1 name
do
mapped=${name#"$from"}
if test "z$name" != "z${name#'^{}'}" ||
if test "z$name" != "z${name%'^{}'}" ||
test "z$name" = "z$mapped"
then
continue

View File

@@ -30,4 +30,4 @@ echo " $url"
echo
git log $baserev..$headrev | git-shortlog ;
git diff --stat --summary $baserev..$headrev
git diff -M --stat --summary $baserev..$headrev

View File

@@ -4282,7 +4282,7 @@ XML
}
if (defined $logo_url) {
# not twice as wide as tall: 72 x 27 pixels
print "<logo>" . esc_url($logo_url) . "</logo>\n";
print "<logo>" . esc_url($logo) . "</logo>\n";
}
if (! %latest_date) {
# dummy date to keep the feed valid until commits trickle in:

3
perl/.gitignore vendored
View File

@@ -1,4 +1,5 @@
Makefile
perl.mak
perl.mak.old
blib
blibdirs
pm_to_blib

39
perl/Makefile Normal file
View File

@@ -0,0 +1,39 @@
#
# Makefile for perl support modules and routine
#
makfile:=perl.mak
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
prefix_SQ = $(subst ','\'',$(prefix))
all install instlibdir: $(makfile)
$(MAKE) -f $(makfile) $@
clean:
test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0
$(RM) ppport.h
$(RM) $(makfile)
$(RM) $(makfile).old
ifdef NO_PERL_MAKEMAKER
instdir_SQ = $(subst ','\'',$(prefix)/lib)
$(makfile): ../GIT-CFLAGS Makefile
echo all: > $@
echo ' :' >> $@
echo install: >> $@
echo ' mkdir -p $(instdir_SQ)' >> $@
echo ' $(RM) $(instdir_SQ)/Git.pm; cp Git.pm $(instdir_SQ)' >> $@
echo ' $(RM) $(instdir_SQ)/Error.pm; \
cp private-Error.pm $(instdir_SQ)/Error.pm' >> $@
echo instlibdir: >> $@
echo ' echo $(instdir_SQ)' >> $@
else
$(makfile): Makefile.PL ../GIT-CFLAGS
'$(PERL_PATH_SQ)' $< FIRST_MAKEFILE='$@' PREFIX='$(prefix_SQ)'
endif
# this is just added comfort for calling make directly in perl dir
# (even though GIT-CFLAGS aren't used yet. If ever)
../GIT-CFLAGS:
$(MAKE) -C .. GIT-CFLAGS

View File

@@ -120,7 +120,8 @@ static int update(struct command *cmd)
"but I can't find it!", new_hex);
}
if (deny_non_fast_forwards && !is_null_sha1(new_sha1) &&
!is_null_sha1(old_sha1)) {
!is_null_sha1(old_sha1) &&
!strncmp(name, "refs/heads/", 11)) {
struct commit *old_commit, *new_commit;
struct commit_list *bases, *ent;

View File

@@ -109,12 +109,10 @@ index d99af23..8b32fb5 100644
+ whitespace at beginning
whitespace change
-whitespace in the middle
-whitespace at end
+white space in the middle
+whitespace at end
whitespace at end
unchanged line
-CR at endQ
+CR at end
CR at endQ
EOF
git-diff -b > out
test_expect_success 'another test, with -b' 'diff -u expect out'

View File

@@ -105,4 +105,17 @@ test_expect_success "Michael Cassar's test case" '
}
'
rm -fr papers partA path?
test_expect_success "Sergey Vlasov's test case" '
rm -fr .git &&
git init-db &&
mkdir ab &&
date >ab.c &&
date >ab/d &&
git add ab.c ab &&
git commit -m 'initial' &&
git mv ab a
'
test_done

View File

@@ -142,4 +142,20 @@ test_expect_success \
diff F/newfile6.png ../F/newfile6.png
)'
test_expect_success 'Retain execute bit' '
mkdir G &&
echo executeon >G/on &&
chmod +x G/on &&
echo executeoff >G/off &&
git add G/on &&
git add G/off &&
git commit -a -m "Execute test" &&
(
cd "$CVSWORK" &&
git-cvsexportcommit -c HEAD
test -x G/on &&
! test -x G/off
)
'
test_done

View File

@@ -230,7 +230,8 @@ unsigned long xdl_hash_record(char const **data, char const *top, long flags) {
while (ptr + 1 < top && isspace(ptr[1])
&& ptr[1] != '\n')
ptr++;
if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
if (flags & XDF_IGNORE_WHITESPACE_CHANGE
&& ptr[1] != '\n') {
ha += (ha << 5);
ha ^= (unsigned long) ' ';
}