Merge branch 'maint'
* maint: sha1_file: link() returns -1 on failure, not errno Make git archive respect core.autocrlf when creating zip format archives Add new test to demonstrate git archive core.autocrlf inconsistency gitweb: avoid warnings for commits without body Clarified gitattributes documentation regarding custom hunk header. git-svn: fix handling of even funkier branch names git-svn: Always create a new RA when calling do_switch for svn:// git-svn: factor out svnserve test code for later use diff/diff-files: do not use --cc too aggressively
This commit is contained in:
commit
3791f77c28
@ -270,27 +270,27 @@ See linkgit:git[1] for details.
|
|||||||
Defining a custom hunk-header
|
Defining a custom hunk-header
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Each group of changes (called "hunk") in the textual diff output
|
Each group of changes (called a "hunk") in the textual diff output
|
||||||
is prefixed with a line of the form:
|
is prefixed with a line of the form:
|
||||||
|
|
||||||
@@ -k,l +n,m @@ TEXT
|
@@ -k,l +n,m @@ TEXT
|
||||||
|
|
||||||
The text is called 'hunk header', and by default a line that
|
This is called a 'hunk header'. The "TEXT" portion is by default a line
|
||||||
begins with an alphabet, an underscore or a dollar sign is used,
|
that begins with an alphabet, an underscore or a dollar sign; this
|
||||||
which matches what GNU 'diff -p' output uses. This default
|
matches what GNU 'diff -p' output uses. This default selection however
|
||||||
selection however is not suited for some contents, and you can
|
is not suited for some contents, and you can use a customized pattern
|
||||||
use customized pattern to make a selection.
|
to make a selection.
|
||||||
|
|
||||||
First in .gitattributes, you would assign the `diff` attribute
|
First, in .gitattributes, you would assign the `diff` attribute
|
||||||
for paths.
|
for paths.
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
*.tex diff=tex
|
*.tex diff=tex
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
Then, you would define "diff.tex.funcname" configuration to
|
Then, you would define a "diff.tex.funcname" configuration to
|
||||||
specify a regular expression that matches a line that you would
|
specify a regular expression that matches a line that you would
|
||||||
want to appear as the hunk header, like this:
|
want to appear as the hunk header "TEXT", like this:
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
[diff "tex"]
|
[diff "tex"]
|
||||||
|
@ -111,6 +111,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
|
|||||||
{
|
{
|
||||||
const char *remote = NULL;
|
const char *remote = NULL;
|
||||||
|
|
||||||
|
git_config(git_default_config, NULL);
|
||||||
|
|
||||||
remote = extract_remote_arg(&argc, argv);
|
remote = extract_remote_arg(&argc, argv);
|
||||||
if (remote)
|
if (remote)
|
||||||
return run_remote_archiver(remote, argc, argv);
|
return run_remote_archiver(remote, argc, argv);
|
||||||
|
@ -50,7 +50,12 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
|
|||||||
3 < rev.max_count)
|
3 < rev.max_count)
|
||||||
usage(diff_files_usage);
|
usage(diff_files_usage);
|
||||||
|
|
||||||
if (rev.max_count == -1 &&
|
/*
|
||||||
|
* "diff-files --base -p" should not combine merges because it
|
||||||
|
* was not asked to. "diff-files -c -p" should not densify
|
||||||
|
* (the user should ask with "diff-files --cc" explicitly).
|
||||||
|
*/
|
||||||
|
if (rev.max_count == -1 && !rev.combine_merges &&
|
||||||
(rev.diffopt.output_format & DIFF_FORMAT_PATCH))
|
(rev.diffopt.output_format & DIFF_FORMAT_PATCH))
|
||||||
rev.combine_merges = rev.dense_combined_merges = 1;
|
rev.combine_merges = rev.dense_combined_merges = 1;
|
||||||
|
|
||||||
|
@ -225,7 +225,13 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
|
|||||||
argv++; argc--;
|
argv++; argc--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (revs->max_count == -1 &&
|
/*
|
||||||
|
* "diff --base" should not combine merges because it was not
|
||||||
|
* asked to. "diff -c" should not densify (if the user wants
|
||||||
|
* dense one, --cc can be explicitly asked for, or just rely
|
||||||
|
* on the default).
|
||||||
|
*/
|
||||||
|
if (revs->max_count == -1 && !revs->combine_merges &&
|
||||||
(revs->diffopt.output_format & DIFF_FORMAT_PATCH))
|
(revs->diffopt.output_format & DIFF_FORMAT_PATCH))
|
||||||
revs->combine_merges = revs->dense_combined_merges = 1;
|
revs->combine_merges = revs->dense_combined_merges = 1;
|
||||||
|
|
||||||
|
25
git-svn.perl
25
git-svn.perl
@ -4010,20 +4010,19 @@ sub gs_do_switch {
|
|||||||
my $old_url = $full_url;
|
my $old_url = $full_url;
|
||||||
$full_url .= '/' . escape_uri_only($path) if length $path;
|
$full_url .= '/' . escape_uri_only($path) if length $path;
|
||||||
my ($ra, $reparented);
|
my ($ra, $reparented);
|
||||||
if ($old_url ne $full_url) {
|
|
||||||
if ($old_url !~ m#^svn(\+ssh)?://#) {
|
if ($old_url =~ m#^svn(\+ssh)?://#) {
|
||||||
SVN::_Ra::svn_ra_reparent($self->{session}, $full_url,
|
$_[0] = undef;
|
||||||
$pool);
|
$self = undef;
|
||||||
$self->{url} = $full_url;
|
$RA = undef;
|
||||||
$reparented = 1;
|
$ra = Git::SVN::Ra->new($full_url);
|
||||||
} else {
|
$ra_invalid = 1;
|
||||||
$_[0] = undef;
|
} elsif ($old_url ne $full_url) {
|
||||||
$self = undef;
|
SVN::_Ra::svn_ra_reparent($self->{session}, $full_url, $pool);
|
||||||
$RA = undef;
|
$self->{url} = $full_url;
|
||||||
$ra = Git::SVN::Ra->new($full_url);
|
$reparented = 1;
|
||||||
$ra_invalid = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ra ||= $self;
|
$ra ||= $self;
|
||||||
$url_b = escape_url($url_b);
|
$url_b = escape_url($url_b);
|
||||||
my $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool);
|
my $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool);
|
||||||
|
@ -2123,7 +2123,7 @@ sub parse_commit_text {
|
|||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($co{'title'} eq "") {
|
if (! defined $co{'title'} || $co{'title'} eq "") {
|
||||||
$co{'title'} = $co{'title_short'} = '(no commit message)';
|
$co{'title'} = $co{'title_short'} = '(no commit message)';
|
||||||
}
|
}
|
||||||
# remove added spaces
|
# remove added spaces
|
||||||
|
@ -2136,7 +2136,9 @@ static void write_sha1_file_prepare(const void *buf, unsigned long len,
|
|||||||
*/
|
*/
|
||||||
int move_temp_to_file(const char *tmpfile, const char *filename)
|
int move_temp_to_file(const char *tmpfile, const char *filename)
|
||||||
{
|
{
|
||||||
int ret = link(tmpfile, filename);
|
int ret = 0;
|
||||||
|
if (link(tmpfile, filename))
|
||||||
|
ret = errno;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Coda hack - coda doesn't like cross-directory links,
|
* Coda hack - coda doesn't like cross-directory links,
|
||||||
|
@ -138,3 +138,20 @@ close $wr or die $!;
|
|||||||
close $rd or die $!;
|
close $rd or die $!;
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_svnserve () {
|
||||||
|
if test -z "$SVNSERVE_PORT"
|
||||||
|
then
|
||||||
|
say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)'
|
||||||
|
test_done
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start_svnserve () {
|
||||||
|
svnserve --listen-port $SVNSERVE_PORT \
|
||||||
|
--root "$rawsvnrepo" \
|
||||||
|
--listen-once \
|
||||||
|
--listen-host 127.0.0.1 &
|
||||||
|
}
|
||||||
|
|
||||||
|
46
t/t0024-crlf-archive.sh
Normal file
46
t/t0024-crlf-archive.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
test_description='respect crlf in git archive'
|
||||||
|
|
||||||
|
. ./test-lib.sh
|
||||||
|
UNZIP=${UNZIP:-unzip}
|
||||||
|
|
||||||
|
test_expect_success setup '
|
||||||
|
|
||||||
|
git config core.autocrlf true
|
||||||
|
|
||||||
|
printf "CRLF line ending\r\nAnd another\r\n" > sample &&
|
||||||
|
git add sample &&
|
||||||
|
|
||||||
|
test_tick &&
|
||||||
|
git commit -m Initial
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'tar archive' '
|
||||||
|
|
||||||
|
git archive --format=tar HEAD |
|
||||||
|
( mkdir untarred && cd untarred && "$TAR" -xf - )
|
||||||
|
|
||||||
|
test_cmp sample untarred/sample
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
"$UNZIP" -v >/dev/null 2>&1
|
||||||
|
if [ $? -eq 127 ]; then
|
||||||
|
echo "Skipping ZIP test, because unzip was not found"
|
||||||
|
test_done
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_expect_success 'zip archive' '
|
||||||
|
|
||||||
|
git archive --format=zip HEAD >test.zip &&
|
||||||
|
|
||||||
|
( mkdir unzipped && cd unzipped && unzip ../test.zip ) &&
|
||||||
|
|
||||||
|
test_cmp sample unzipped/sample
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
test_done
|
@ -12,19 +12,7 @@ test_description='git svn dcommit new files over svn:// test'
|
|||||||
|
|
||||||
. ./lib-git-svn.sh
|
. ./lib-git-svn.sh
|
||||||
|
|
||||||
if test -z "$SVNSERVE_PORT"
|
require_svnserve
|
||||||
then
|
|
||||||
say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)'
|
|
||||||
test_done
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
start_svnserve () {
|
|
||||||
svnserve --listen-port $SVNSERVE_PORT \
|
|
||||||
--root "$rawsvnrepo" \
|
|
||||||
--listen-once \
|
|
||||||
--listen-host 127.0.0.1 &
|
|
||||||
}
|
|
||||||
|
|
||||||
test_expect_success 'start tracking an empty repo' '
|
test_expect_success 'start tracking an empty repo' '
|
||||||
svn mkdir -m "empty dir" "$svnrepo"/empty-dir &&
|
svn mkdir -m "empty dir" "$svnrepo"/empty-dir &&
|
||||||
|
22
t/t9126-git-svn-follow-deleted-readded-directory.sh
Executable file
22
t/t9126-git-svn-follow-deleted-readded-directory.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Alec Berryman
|
||||||
|
|
||||||
|
test_description='git svn fetch repository with deleted and readded directory'
|
||||||
|
|
||||||
|
. ./lib-git-svn.sh
|
||||||
|
|
||||||
|
# Don't run this by default; it opens up a port.
|
||||||
|
require_svnserve
|
||||||
|
|
||||||
|
test_expect_success 'load repository' '
|
||||||
|
svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9126/follow-deleted-readded.dump
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'fetch repository' '
|
||||||
|
start_svnserve &&
|
||||||
|
git svn init svn://127.0.0.1:$SVNSERVE_PORT &&
|
||||||
|
git svn fetch
|
||||||
|
'
|
||||||
|
|
||||||
|
test_done
|
201
t/t9126/follow-deleted-readded.dump
Normal file
201
t/t9126/follow-deleted-readded.dump
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
SVN-fs-dump-format-version: 2
|
||||||
|
|
||||||
|
UUID: 1807dc6f-c693-4cda-9710-00e1be8c1f21
|
||||||
|
|
||||||
|
Revision-number: 0
|
||||||
|
Prop-content-length: 56
|
||||||
|
Content-length: 56
|
||||||
|
|
||||||
|
K 8
|
||||||
|
svn:date
|
||||||
|
V 27
|
||||||
|
2008-09-14T19:53:13.006748Z
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
Revision-number: 1
|
||||||
|
Prop-content-length: 111
|
||||||
|
Content-length: 111
|
||||||
|
|
||||||
|
K 7
|
||||||
|
svn:log
|
||||||
|
V 12
|
||||||
|
Create trunk
|
||||||
|
K 10
|
||||||
|
svn:author
|
||||||
|
V 4
|
||||||
|
alec
|
||||||
|
K 8
|
||||||
|
svn:date
|
||||||
|
V 27
|
||||||
|
2008-09-14T19:53:13.239689Z
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
Node-path: trunk
|
||||||
|
Node-kind: dir
|
||||||
|
Node-action: add
|
||||||
|
Prop-content-length: 10
|
||||||
|
Content-length: 10
|
||||||
|
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
|
||||||
|
Revision-number: 2
|
||||||
|
Prop-content-length: 119
|
||||||
|
Content-length: 119
|
||||||
|
|
||||||
|
K 7
|
||||||
|
svn:log
|
||||||
|
V 20
|
||||||
|
Create trunk/project
|
||||||
|
K 10
|
||||||
|
svn:author
|
||||||
|
V 4
|
||||||
|
alec
|
||||||
|
K 8
|
||||||
|
svn:date
|
||||||
|
V 27
|
||||||
|
2008-09-14T19:53:13.548860Z
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
Node-path: trunk/project
|
||||||
|
Node-kind: dir
|
||||||
|
Node-action: add
|
||||||
|
Prop-content-length: 10
|
||||||
|
Content-length: 10
|
||||||
|
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
|
||||||
|
Revision-number: 3
|
||||||
|
Prop-content-length: 111
|
||||||
|
Content-length: 111
|
||||||
|
|
||||||
|
K 7
|
||||||
|
svn:log
|
||||||
|
V 12
|
||||||
|
add new file
|
||||||
|
K 10
|
||||||
|
svn:author
|
||||||
|
V 4
|
||||||
|
alec
|
||||||
|
K 8
|
||||||
|
svn:date
|
||||||
|
V 27
|
||||||
|
2008-09-14T19:53:15.433630Z
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
Node-path: trunk/project/foo
|
||||||
|
Node-kind: file
|
||||||
|
Node-action: add
|
||||||
|
Prop-content-length: 10
|
||||||
|
Text-content-length: 4
|
||||||
|
Text-content-md5: d3b07384d113edec49eaa6238ad5ff00
|
||||||
|
Content-length: 14
|
||||||
|
|
||||||
|
PROPS-END
|
||||||
|
foo
|
||||||
|
|
||||||
|
|
||||||
|
Revision-number: 4
|
||||||
|
Prop-content-length: 116
|
||||||
|
Content-length: 116
|
||||||
|
|
||||||
|
K 7
|
||||||
|
svn:log
|
||||||
|
V 17
|
||||||
|
change foo to bar
|
||||||
|
K 10
|
||||||
|
svn:author
|
||||||
|
V 4
|
||||||
|
alec
|
||||||
|
K 8
|
||||||
|
svn:date
|
||||||
|
V 27
|
||||||
|
2008-09-14T19:53:17.339884Z
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
Node-path: trunk/project/foo
|
||||||
|
Node-kind: file
|
||||||
|
Node-action: change
|
||||||
|
Text-content-length: 4
|
||||||
|
Text-content-md5: c157a79031e1c40f85931829bc5fc552
|
||||||
|
Content-length: 4
|
||||||
|
|
||||||
|
bar
|
||||||
|
|
||||||
|
|
||||||
|
Revision-number: 5
|
||||||
|
Prop-content-length: 114
|
||||||
|
Content-length: 114
|
||||||
|
|
||||||
|
K 7
|
||||||
|
svn:log
|
||||||
|
V 15
|
||||||
|
don't like that
|
||||||
|
K 10
|
||||||
|
svn:author
|
||||||
|
V 4
|
||||||
|
alec
|
||||||
|
K 8
|
||||||
|
svn:date
|
||||||
|
V 27
|
||||||
|
2008-09-14T19:53:19.335001Z
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
Node-path: trunk/project
|
||||||
|
Node-action: delete
|
||||||
|
|
||||||
|
|
||||||
|
Revision-number: 6
|
||||||
|
Prop-content-length: 110
|
||||||
|
Content-length: 110
|
||||||
|
|
||||||
|
K 7
|
||||||
|
svn:log
|
||||||
|
V 11
|
||||||
|
reset trunk
|
||||||
|
K 10
|
||||||
|
svn:author
|
||||||
|
V 4
|
||||||
|
alec
|
||||||
|
K 8
|
||||||
|
svn:date
|
||||||
|
V 27
|
||||||
|
2008-09-14T19:53:19.845897Z
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
Node-path: trunk/project
|
||||||
|
Node-kind: dir
|
||||||
|
Node-action: add
|
||||||
|
Node-copyfrom-rev: 4
|
||||||
|
Node-copyfrom-path: trunk/project
|
||||||
|
|
||||||
|
|
||||||
|
Revision-number: 7
|
||||||
|
Prop-content-length: 113
|
||||||
|
Content-length: 113
|
||||||
|
|
||||||
|
K 7
|
||||||
|
svn:log
|
||||||
|
V 14
|
||||||
|
change to quux
|
||||||
|
K 10
|
||||||
|
svn:author
|
||||||
|
V 4
|
||||||
|
alec
|
||||||
|
K 8
|
||||||
|
svn:date
|
||||||
|
V 27
|
||||||
|
2008-09-14T19:53:21.367947Z
|
||||||
|
PROPS-END
|
||||||
|
|
||||||
|
Node-path: trunk/project/foo
|
||||||
|
Node-kind: file
|
||||||
|
Node-action: change
|
||||||
|
Text-content-length: 5
|
||||||
|
Text-content-md5: d3b07a382ec010c01889250fce66fb13
|
||||||
|
Content-length: 5
|
||||||
|
|
||||||
|
quux
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user