Merge branch 'maint'

* maint:
  post-receive-email: remove spurious commas in email subject
  fast-import: export correctly marks larger than 2^20-1
  t/lib-git-svn.sh: use $PERL_PATH for perl, not perl from $PATH
  diff: strip extra "/" when stripping prefix
This commit is contained in:
Junio C Hamano 2010-08-11 11:32:00 -07:00
commit 7980e41746
6 changed files with 130 additions and 7 deletions

View file

@ -203,7 +203,7 @@ generate_email_header()
# Generate header
cat <<-EOF
To: $recipients
Subject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe
Subject: ${emailprefix}$projectdesc $refname_type $short_refname ${change_type}d. $describe
X-Git-Refname: $refname
X-Git-Reftype: $refname_type
X-Git-Oldrev: $oldrev

10
diff.c
View file

@ -2704,10 +2704,16 @@ static void diff_fill_sha1_info(struct diff_filespec *one)
static void strip_prefix(int prefix_length, const char **namep, const char **otherp)
{
/* Strip the prefix but do not molest /dev/null and absolute paths */
if (*namep && **namep != '/')
if (*namep && **namep != '/') {
*namep += prefix_length;
if (*otherp && **otherp != '/')
if (**namep == '/')
++*namep;
}
if (*otherp && **otherp != '/') {
*otherp += prefix_length;
if (**otherp == '/')
++*otherp;
}
}
static void run_diff(struct diff_filepair *p, struct diff_options *o)

View file

@ -1666,7 +1666,7 @@ static void dump_marks_helper(FILE *f,
if (m->shift) {
for (k = 0; k < 1024; k++) {
if (m->data.sets[k])
dump_marks_helper(f, (base + k) << m->shift,
dump_marks_helper(f, base + (k << m->shift),
m->data.sets[k]);
}
} else {

View file

@ -16,7 +16,6 @@ fi
GIT_DIR=$PWD/.git
GIT_SVN_DIR=$GIT_DIR/svn/refs/remotes/git-svn
SVN_TREE=$GIT_SVN_DIR/svn-tree
PERL=${PERL:-perl}
svn >/dev/null 2>&1
if test $? -ne 1
@ -30,7 +29,7 @@ export svnrepo
svnconf=$PWD/svnconf
export svnconf
$PERL -w -e "
"$PERL_PATH" -w -e "
use SVN::Core;
use SVN::Repos;
\$SVN::Core::VERSION gt '1.1.0' or exit(42);
@ -130,7 +129,7 @@ stop_httpd () {
}
convert_to_rev_db () {
$PERL -w -- - "$@" <<\EOF
"$PERL_PATH" -w -- - "$@" <<\EOF
use strict;
@ARGV == 2 or die "Usage: convert_to_rev_db <input> <output>";
open my $wr, '+>', $ARGV[1] or die "$!: couldn't open: $ARGV[1]";

61
t/t4045-diff-relative.sh Executable file
View file

@ -0,0 +1,61 @@
#!/bin/sh
test_description='diff --relative tests'
. ./test-lib.sh
test_expect_success 'setup' '
git commit --allow-empty -m empty &&
echo content >file1 &&
mkdir subdir &&
echo other content >subdir/file2 &&
git add . &&
git commit -m one
'
check_diff() {
expect=$1; shift
cat >expected <<EOF
diff --git a/$expect b/$expect
new file mode 100644
index 0000000..25c05ef
--- /dev/null
+++ b/$expect
@@ -0,0 +1 @@
+other content
EOF
test_expect_success "-p $*" "
git diff -p $* HEAD^ >actual &&
test_cmp expected actual
"
}
check_stat() {
expect=$1; shift
cat >expected <<EOF
$expect | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
EOF
test_expect_success "--stat $*" "
git diff --stat $* HEAD^ >actual &&
test_cmp expected actual
"
}
check_raw() {
expect=$1; shift
cat >expected <<EOF
:000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A $expect
EOF
test_expect_success "--raw $*" "
git diff --no-abbrev --raw $* HEAD^ >actual &&
test_cmp expected actual
"
}
for type in diff stat raw; do
check_$type file2 --relative=subdir/
check_$type file2 --relative=subdir
check_$type dir/file2 --relative=sub
done
test_done

View file

@ -166,6 +166,63 @@ test_expect_success \
test `git rev-parse --verify master:file2` \
= `git rev-parse --verify verify--import-marks:copy-of-file2`'
test_tick
mt=$(git hash-object --stdin < /dev/null)
: >input.blob
: >marks.exp
: >tree.exp
cat >input.commit <<EOF
commit refs/heads/verify--dump-marks
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
test the sparse array dumping routines with exponentially growing marks
COMMIT
EOF
i=0
l=4
m=6
n=7
while test "$i" -lt 27; do
cat >>input.blob <<EOF
blob
mark :$l
data 0
blob
mark :$m
data 0
blob
mark :$n
data 0
EOF
echo "M 100644 :$l l$i" >>input.commit
echo "M 100644 :$m m$i" >>input.commit
echo "M 100644 :$n n$i" >>input.commit
echo ":$l $mt" >>marks.exp
echo ":$m $mt" >>marks.exp
echo ":$n $mt" >>marks.exp
printf "100644 blob $mt\tl$i\n" >>tree.exp
printf "100644 blob $mt\tm$i\n" >>tree.exp
printf "100644 blob $mt\tn$i\n" >>tree.exp
l=$(($l + $l))
m=$(($m + $m))
n=$(($l + $n))
i=$((1 + $i))
done
sort tree.exp > tree.exp_s
test_expect_success 'A: export marks with large values' '
cat input.blob input.commit | git fast-import --export-marks=marks.large &&
git ls-tree refs/heads/verify--dump-marks >tree.out &&
test_cmp tree.exp_s tree.out &&
test_cmp marks.exp marks.large'
###
### series B
###