Merge commit 'junio/maint' into devel

This commit is contained in:
Steffen Prohaska
2008-09-21 13:00:47 +02:00
41 changed files with 489 additions and 132 deletions

View File

@@ -0,0 +1,29 @@
GIT v1.6.0.3 Release Notes
==========================
Fixes since v1.6.0.2
--------------------
* "git archive --format=zip" did not honor core.autocrlf while
--format=tar did.
* Continuing "git rebase -i" was very confused when the user left modified
files in the working tree while resolving conflicts.
* Continuing "git rebase -i" was also very confused when the user left
some staged changes in the index after "edit".
* Behaviour of "git diff --quiet" was inconsistent with "diff --exit-code"
with the output redirected to /dev/null.
* "Git.pm" tests relied on unnecessarily more recent version of Perl.
* "gitweb" triggered undef warning on commits without log messages.
Many other documentation updates.
--
exec >/var/tmp/1
O=v1.6.0.2-32-g8d11fde
echo O=$(git describe maint)
git shortlog --no-merges $O..maint

View File

@@ -160,7 +160,10 @@ Here are the "carry forward" rules:
0 nothing nothing nothing (does not happen)
1 nothing nothing exists use M
2 nothing exists nothing remove path from index
3 nothing exists exists use M
3 nothing exists exists, use M if "initial checkout"
H == M keep index otherwise
exists fail
H != M
clean I==H I==M
------------------
@@ -207,6 +210,12 @@ you picked it up via e-mail in a patch form), `git diff-index
merge, but it would not show in `git diff-index --cached $M`
output after two-tree merge.
Case #3 is slightly tricky and needs explanation. The result from this
rule logically should be to remove the path if the user staged the removal
of the path and then swiching to a new branch. That however will prevent
the initial checkout from happening, so the rule is modified to use M (new
tree) only when the contents of the index is empty. Otherwise the removal
of the path is kept as long as $H and $M are the same.
3-Way Merge
~~~~~~~~~~~

View File

@@ -60,7 +60,7 @@ OPTIONS
linkgit:git-pack-objects[1].
-f::
Pass the `--no-reuse-delta` option to 'git-pack-objects'. See
Pass the `--no-reuse-object` option to `git-pack-objects`, see
linkgit:git-pack-objects[1].
-q::

View File

@@ -270,27 +270,27 @@ See linkgit:git[1] for details.
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:
@@ -k,l +n,m @@ TEXT
The text is called 'hunk header', and by default a line that
begins with an alphabet, an underscore or a dollar sign is used,
which matches what GNU 'diff -p' output uses. This default
selection however is not suited for some contents, and you can
use customized pattern to make a selection.
This is called a 'hunk header'. The "TEXT" portion is by default a line
that begins with an alphabet, an underscore or a dollar sign; this
matches what GNU 'diff -p' output uses. This default selection however
is not suited for some contents, and you can use a customized pattern
to make a selection.
First in .gitattributes, you would assign the `diff` attribute
First, in .gitattributes, you would assign the `diff` attribute
for paths.
------------------------
*.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
want to appear as the hunk header, like this:
want to appear as the hunk header "TEXT", like this:
------------------------
[diff "tex"]

View File

@@ -36,11 +36,25 @@ files:
- 'git-diff-tree' compares contents of two "tree" objects;
In all of these cases, the commands themselves compare
corresponding paths in the two sets of files. The result of
comparison is passed from these commands to what is internally
called "diffcore", in a format similar to what is output when
the -p option is not used. E.g.
In all of these cases, the commands themselves first optionally limit
the two sets of files by any pathspecs given on their command-lines,
and compare corresponding paths in the two resulting sets of files.
The pathspecs are used to limit the world diff operates in. They remove
the filepairs outside the specified sets of pathnames. E.g. If the
input set of filepairs included:
------------------------------------------------
:100644 100644 bcd1234... 0123456... M junkfile
------------------------------------------------
but the command invocation was `git diff-files myfile`, then the
junkfile entry would be removed from the list because only "myfile"
is under consideration.
The result of comparison is passed from these commands to what is
internally called "diffcore", in a format similar to what is output
when the -p option is not used. E.g.
------------------------------------------------
in-place edit :100644 100644 bcd1234... 0123456... M file0
@@ -52,9 +66,8 @@ unmerged :000000 000000 0000000... 0000000... U file6
The diffcore mechanism is fed a list of such comparison results
(each of which is called "filepair", although at this point each
of them talks about a single file), and transforms such a list
into another list. There are currently 6 such transformations:
into another list. There are currently 5 such transformations:
- diffcore-pathspec
- diffcore-break
- diffcore-rename
- diffcore-merge-broken
@@ -62,38 +75,14 @@ into another list. There are currently 6 such transformations:
- diffcore-order
These are applied in sequence. The set of filepairs 'git-diff-{asterisk}'
commands find are used as the input to diffcore-pathspec, and
the output from diffcore-pathspec is used as the input to the
commands find are used as the input to diffcore-break, and
the output from diffcore-break is used as the input to the
next transformation. The final result is then passed to the
output routine and generates either diff-raw format (see Output
format sections of the manual for 'git-diff-{asterisk}' commands) or
diff-patch format.
diffcore-pathspec: For Ignoring Files Outside Our Consideration
---------------------------------------------------------------
The first transformation in the chain is diffcore-pathspec, and
is controlled by giving the pathname parameters to the
'git-diff-{asterisk}' commands on the command line. The pathspec is used
to limit the world diff operates in. It removes the filepairs
outside the specified set of pathnames. E.g. If the input set
of filepairs included:
------------------------------------------------
:100644 100644 bcd1234... 0123456... M junkfile
------------------------------------------------
but the command invocation was `git diff-files myfile`, then the
junkfile entry would be removed from the list because only "myfile"
is under consideration.
Implementation note. For performance reasons, 'git-diff-tree'
uses the pathname parameters on the command line to cull set of
filepairs it feeds the diffcore mechanism itself, and does not
use diffcore-pathspec, but the end result is the same.
diffcore-break: For Splitting Up "Complete Rewrites"
----------------------------------------------------

View File

@@ -1 +1 @@
Documentation/RelNotes-1.6.0.2.txt
Documentation/RelNotes-1.6.0.3.txt

View File

@@ -111,6 +111,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
{
const char *remote = NULL;
git_config(git_default_config, NULL);
remote = extract_remote_arg(&argc, argv);
if (remote)
return run_remote_archiver(remote, argc, argv);

View File

@@ -269,6 +269,8 @@ static int merge_working_tree(struct checkout_opts *opts,
}
/* 2-way merge to the new branch */
topts.initial_checkout = (!active_nr &&
(old->commit == new->commit));
topts.update = 1;
topts.merge = 1;
topts.gently = opts->merge;

View File

@@ -58,7 +58,7 @@ static struct option builtin_clone_options[] = {
OPT_STRING(0, "reference", &option_reference, "repo",
"reference repository"),
OPT_STRING('o', "origin", &option_origin, "branch",
"use <branch> instead or 'origin' to track upstream"),
"use <branch> instead of 'origin' to track upstream"),
OPT_STRING('u', "upload-pack", &option_upload_pack, "path",
"path to git-upload-pack on the remote"),
OPT_STRING(0, "depth", &option_depth, "depth",

View File

@@ -50,7 +50,12 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
3 < rev.max_count)
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.combine_merges = rev.dense_combined_merges = 1;

View File

@@ -223,7 +223,13 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
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->combine_merges = revs->dense_combined_merges = 1;

View File

@@ -37,7 +37,7 @@ static void copy_templates_1(char *path, int baselen,
/* Note: if ".git/hooks" file exists in the repository being
* re-initialized, /etc/core-git/templates/hooks/update would
* cause git-init to fail here. I think this is sane but
* cause "git init" to fail here. I think this is sane but
* it means that the set of templates we ship by default, along
* with the way the namespace under .git/ is organized, should
* be really carefully chosen.

View File

@@ -835,7 +835,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
endpos = strchr(committer, '>');
if (!endpos)
die("bogos committer info %s\n", committer);
die("bogus committer info %s\n", committer);
add_signoff = xmemdupz(committer, endpos - committer + 1);
}
else if (!strcmp(argv[i], "--attach")) {

View File

@@ -23,7 +23,7 @@
#endif
static const char pack_usage[] = "\
git-pack-objects [{ -q | --progress | --all-progress }] \n\
git pack-objects [{ -q | --progress | --all-progress }] \n\
[--max-pack-size=N] [--local] [--incremental] \n\
[--window=N] [--window-memory=N] [--depth=N] \n\
[--no-reuse-delta] [--no-reuse-object] [--delta-base-offset] \n\
@@ -1872,7 +1872,7 @@ static void mark_in_pack_object(struct object *object, struct packed_git *p, str
/*
* Compare the objects in the offset order, in order to emulate the
* "git-rev-list --objects" output that produced the pack originally.
* "git rev-list --objects" output that produced the pack originally.
*/
static int ofscmp(const void *a_, const void *b_)
{

View File

@@ -64,7 +64,7 @@ static void prime_cache_tree(void)
}
static const char read_tree_usage[] = "git-read-tree (<sha> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <sha1> [<sha2> [<sha3>]])";
static const char read_tree_usage[] = "git read-tree (<sha> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <sha1> [<sha2> [<sha3>]])";
static struct lock_file lock_file;
@@ -206,6 +206,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
break;
case 2:
opts.fn = twoway_merge;
opts.initial_checkout = !active_nr;
break;
case 3:
default:

View File

@@ -178,7 +178,7 @@ static void finish_object(struct object_array_entry *p)
static void show_object(struct object_array_entry *p)
{
/* An object with name "foo\n0000000..." can be used to
* confuse downstream git-pack-objects very badly.
* confuse downstream "git pack-objects" very badly.
*/
const char *ep = strchr(p->name, '\n');

View File

@@ -104,7 +104,7 @@ static int check_local_mod(unsigned char *head, int index_only)
"from both the file and the HEAD\n"
"(use -f to force removal)", name);
else if (!index_only) {
/* It's not dangerous to git-rm --cached a
/* It's not dangerous to "git rm --cached" a
* file if the index matches the file or the
* HEAD, since it means the deleted content is
* still available somewhere.

View File

@@ -43,7 +43,7 @@ static int pack_objects(int fd, struct ref *refs)
po.out = fd;
po.git_cmd = 1;
if (start_command(&po))
die("git-pack-objects failed (%s)", strerror(errno));
die("git pack-objects failed (%s)", strerror(errno));
/*
* We feed the pack-objects we just spawned with revision

View File

@@ -9,26 +9,26 @@
static const char tar_tree_usage[] =
"git tar-tree [--remote=<repo>] <tree-ish> [basedir]\n"
"*** Note that this command is now deprecated; use git-archive instead.";
"*** Note that this command is now deprecated; use \"git archive\" instead.";
int cmd_tar_tree(int argc, const char **argv, const char *prefix)
{
/*
* git-tar-tree is now a wrapper around git-archive --format=tar
* "git tar-tree" is now a wrapper around "git archive --format=tar"
*
* $0 --remote=<repo> arg... ==>
* git-archive --format=tar --remote=<repo> arg...
* git archive --format=tar --remote=<repo> arg...
* $0 tree-ish ==>
* git-archive --format=tar tree-ish
* git archive --format=tar tree-ish
* $0 tree-ish basedir ==>
* git-archive --format-tar --prefix=basedir tree-ish
* git archive --format-tar --prefix=basedir tree-ish
*/
int i;
const char **nargv = xcalloc(sizeof(*nargv), argc + 2);
char *basedir_arg;
int nargc = 0;
nargv[nargc++] = "git-archive";
nargv[nargc++] = "archive";
nargv[nargc++] = "--format=tar";
if (2 <= argc && !prefixcmp(argv[1], "--remote=")) {
@@ -53,8 +53,8 @@ int cmd_tar_tree(int argc, const char **argv, const char *prefix)
nargv[nargc] = NULL;
fprintf(stderr,
"*** git-tar-tree is now deprecated.\n"
"*** Running git-archive instead.\n***");
"*** \"git tar-tree\" is now deprecated.\n"
"*** Running \"git archive\" instead.\n***");
for (i = 0; i < nargc; i++) {
fputc(' ', stderr);
sq_quote_print(stderr, nargv[i]);

View File

@@ -13,7 +13,7 @@
#include "fsck.h"
static int dry_run, quiet, recover, has_errors, strict;
static const char unpack_usage[] = "git-unpack-objects [-n] [-q] [-r] [--strict] < pack-file";
static const char unpack_usage[] = "git unpack-objects [-n] [-q] [-r] [--strict] < pack-file";
/* We always read in 4kB chunks. */
static unsigned char buffer[4096];

View File

@@ -14,7 +14,7 @@
* Default to not allowing changes to the list of files. The
* tool doesn't actually care, but this makes it harder to add
* files to the revision control by mistake by doing something
* like "git-update-index *" and suddenly having all the object
* like "git update-index *" and suddenly having all the object
* files be revision controlled.
*/
static int allow_add;
@@ -310,18 +310,18 @@ static void read_index_info(int line_termination)
/* This reads lines formatted in one of three formats:
*
* (1) mode SP sha1 TAB path
* The first format is what "git-apply --index-info"
* The first format is what "git apply --index-info"
* reports, and used to reconstruct a partial tree
* that is used for phony merge base tree when falling
* back on 3-way merge.
*
* (2) mode SP type SP sha1 TAB path
* The second format is to stuff git-ls-tree output
* The second format is to stuff "git ls-tree" output
* into the index file.
*
* (3) mode SP sha1 SP stage TAB path
* This format is to put higher order stages into the
* index file and matches git-ls-files --stage output.
* index file and matches "git ls-files --stage" output.
*/
errno = 0;
ul = strtoul(buf.buf, &ptr, 8);

View File

@@ -750,7 +750,7 @@ _git_commit ()
--*)
__gitcomp "
--all --author= --signoff --verify --no-verify
--edit --amend --include --only
--edit --amend --include --only --interactive
"
return
esac

12
diff.c
View File

@@ -2400,13 +2400,6 @@ int diff_setup_done(struct diff_options *options)
DIFF_OPT_SET(options, EXIT_WITH_STATUS);
}
/*
* If we postprocess in diffcore, we cannot simply return
* upon the first hit. We need to run diff as usual.
*/
if (options->pickaxe || options->filter)
DIFF_OPT_CLR(options, QUIET);
return 0;
}
@@ -3398,10 +3391,7 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
void diffcore_std(struct diff_options *options)
{
if (DIFF_OPT_TST(options, QUIET))
return;
if (options->skip_stat_unmatch && !DIFF_OPT_TST(options, FIND_COPIES_HARDER))
if (options->skip_stat_unmatch)
diffcore_skip_stat_unmatch(options);
if (options->break_opt != -1)
diffcore_break(options->break_opt);

View File

@@ -92,7 +92,6 @@ extern struct diff_filepair *diff_queue(struct diff_queue_struct *,
struct diff_filespec *);
extern void diff_q(struct diff_queue_struct *, struct diff_filepair *);
extern void diffcore_pathspec(const char **pathspec);
extern void diffcore_break(int);
extern void diffcore_rename(struct diff_options *);
extern void diffcore_merge_broken(void);

View File

@@ -284,7 +284,7 @@ do_next () {
pick_one $sha1 ||
die_with_patch $sha1 "Could not apply $sha1... $rest"
make_patch $sha1
: > "$DOTEST"/amend
git rev-parse --verify HEAD > "$DOTEST"/amend
warn "Stopped at $sha1... $rest"
warn "You can amend the commit now, with"
warn
@@ -427,14 +427,22 @@ do
else
. "$DOTEST"/author-script ||
die "Cannot find the author identity"
amend=
if test -f "$DOTEST"/amend
then
amend=$(git rev-parse --verify HEAD)
test "$amend" = $(cat "$DOTEST"/amend) ||
die "\
You have uncommitted changes in your working tree. Please, commit them
first and then run 'git rebase --continue' again."
git reset --soft HEAD^ ||
die "Cannot rewind the HEAD"
fi
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE &&
git commit --no-verify -F "$DOTEST"/message -e ||
die "Could not commit staged changes."
git commit --no-verify -F "$DOTEST"/message -e || {
test -n "$amend" && git reset --soft $amend
die "Could not commit staged changes."
}
fi
require_clean_work_tree

View File

@@ -10,7 +10,7 @@ git repack [options]
a pack everything in a single pack
A same as -a, and turn unreachable objects loose
d remove redundant packs, and run git-prune-packed
f pass --no-reuse-delta to git-pack-objects
f pass --no-reuse-object to git-pack-objects
n do not run git-update-server-info
q,quiet be quiet
l pass --local to git-pack-objects

View File

@@ -3969,21 +3969,21 @@ sub gs_do_switch {
my $old_url = $full_url;
$full_url .= '/' . escape_uri_only($path) if length $path;
my ($ra, $reparented);
if ($old_url ne $full_url) {
if ($old_url !~ m#^svn(\+ssh)?://#) {
SVN::_Ra::svn_ra_reparent($self->{session}, $full_url,
$pool);
$self->{url} = $full_url;
$reparented = 1;
} else {
$_[0] = undef;
$self = undef;
$RA = undef;
$ra = Git::SVN::Ra->new($full_url);
$ra_invalid = 1;
}
if ($old_url =~ m#^svn(\+ssh)?://#) {
$_[0] = undef;
$self = undef;
$RA = undef;
$ra = Git::SVN::Ra->new($full_url);
$ra_invalid = 1;
} elsif ($old_url ne $full_url) {
SVN::_Ra::svn_ra_reparent($self->{session}, $full_url, $pool);
$self->{url} = $full_url;
$reparented = 1;
}
$ra ||= $self;
$url_b = escape_url($url_b);
my $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool);
my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : ();
$reporter->set_path('', $rev_a, 0, @lock, $pool);

View File

@@ -2092,7 +2092,7 @@ sub parse_commit_text {
last;
}
}
if ($co{'title'} eq "") {
if (! defined $co{'title'} || $co{'title'} eq "") {
$co{'title'} = $co{'title_short'} = '(no commit message)';
}
# remove added spaces

11
http.c
View File

@@ -165,7 +165,16 @@ static CURL* get_curl_handle(void)
{
CURL* result = curl_easy_init();
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify);
if (!curl_ssl_verify) {
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0);
} else {
/* Verify authenticity of the peer's certificate */
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1);
/* The name in the cert must match whom we tried to connect */
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
}
#if LIBCURL_VERSION_NUM >= 0x070907
curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
#endif

View File

@@ -1244,6 +1244,7 @@ int discard_index(struct index_state *istate)
istate->cache_nr = 0;
istate->cache_changed = 0;
istate->timestamp = 0;
istate->name_hash_initialized = 0;
free_hash(&istate->name_hash);
cache_tree_free(&(istate->cache_tree));
free(istate->alloc);

View File

@@ -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 ret = link(tmpfile, filename);
int ret = 0;
if (link(tmpfile, filename))
ret = errno;
/*
* Coda hack - coda doesn't like cross-directory links,

View File

@@ -135,3 +135,20 @@ close $wr or die $!;
close $rd or die $!;
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
View 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

View File

@@ -12,19 +12,7 @@ test_description='git-svn dcommit new files over svn:// test'
. ./lib-git-svn.sh
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 &
}
require_svnserve
test_expect_success 'start tracking an empty repo' '
svn mkdir -m "empty dir" "$svnrepo"/empty-dir &&

View File

@@ -6,6 +6,10 @@
test_description='git-svn funky branch names'
. ./lib-git-svn.sh
# Abo-Uebernahme (Bug #994)
scary_uri='Abo-Uebernahme%20%28Bug%20%23994%29'
scary_ref='Abo-Uebernahme%20(Bug%20#994)'
test_expect_success 'setup svnrepo' '
mkdir project project/trunk project/branches project/tags &&
echo foo > project/trunk/foo &&
@@ -15,6 +19,8 @@ test_expect_success 'setup svnrepo' '
"$svnrepo/pr ject/branches/fun plugin" &&
svn cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \
"$svnrepo/pr ject/branches/more fun plugin!" &&
svn cp -m "scary" "$svnrepo/pr ject/branches/fun plugin" \
"$svnrepo/pr ject/branches/$scary_uri" &&
start_httpd
'
@@ -23,6 +29,7 @@ test_expect_success 'test clone with funky branch names' '
cd project &&
git rev-parse "refs/remotes/fun%20plugin" &&
git rev-parse "refs/remotes/more%20fun%20plugin!" &&
git rev-parse "refs/remotes/$scary_ref" &&
cd ..
'
@@ -35,6 +42,15 @@ test_expect_success 'test dcommit to funky branch' "
cd ..
"
test_expect_success 'test dcommit to scary branch' '
cd project &&
git reset --hard "refs/remotes/$scary_ref" &&
echo urls are scary >> foo &&
git commit -m "eep" -- foo &&
git svn dcommit &&
cd ..
'
stop_httpd
test_done

View 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

View 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

View File

@@ -9,7 +9,6 @@ use Test::More qw(no_plan);
use Cwd;
use File::Basename;
use File::Temp;
BEGIN { use_ok('Git') }
@@ -38,7 +37,7 @@ is($r->get_color("color.test.slot1", "red"), $ansi_green, "get_color");
# Failure cases for config:
# Save and restore STDERR; we will probably extract this into a
# "dies_ok" method and possibly move the STDERR handling to Git.pm.
open our $tmpstderr, ">&", STDERR or die "cannot save STDERR"; close STDERR;
open our $tmpstderr, ">&STDERR" or die "cannot save STDERR"; close STDERR;
eval { $r->config("test.dupstring") };
ok($@, "config: duplicate entry in scalar context fails");
eval { $r->config_bool("test.boolother") };
@@ -69,21 +68,25 @@ is($r->ident_person("Name", "email", "123 +0000"), "Name <email>",
# objects and hashes
ok(our $file1hash = $r->command_oneline('rev-parse', "HEAD:file1"), "(get file hash)");
our $tmpfile = File::Temp->new;
is($r->cat_blob($file1hash, $tmpfile), 15, "cat_blob: size");
my $tmpfile = "file.tmp";
open TEMPFILE, "+>$tmpfile" or die "Can't open $tmpfile: $!";
is($r->cat_blob($file1hash, \*TEMPFILE), 15, "cat_blob: size");
our $blobcontents;
{ local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; }
{ local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }
is($blobcontents, "changed file 1\n", "cat_blob: data");
seek $tmpfile, 0, 0;
close TEMPFILE or die "Failed writing to $tmpfile: $!";
is(Git::hash_object("blob", $tmpfile), $file1hash, "hash_object: roundtrip");
$tmpfile = File::Temp->new();
print $tmpfile my $test_text = "test blob, to be inserted\n";
open TEMPFILE, ">$tmpfile" or die "Can't open $tmpfile: $!";
print TEMPFILE my $test_text = "test blob, to be inserted\n";
close TEMPFILE or die "Failed writing to $tmpfile: $!";
like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,
"hash_and_insert_object: returns hash");
$tmpfile = File::Temp->new;
is($r->cat_blob($newhash, $tmpfile), length $test_text, "cat_blob: roundtrip size");
{ local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; }
open TEMPFILE, "+>$tmpfile" or die "Can't open $tmpfile: $!";
is($r->cat_blob($newhash, \*TEMPFILE), length $test_text, "cat_blob: roundtrip size");
{ local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }
is($blobcontents, $test_text, "cat_blob: roundtrip data");
close TEMPFILE;
unlink $tmpfile;
# paths
is($r->repo_path, "./.git", "repo_path");

View File

@@ -23,17 +23,19 @@ all: boilerplates.made custom
bpsrc = $(filter-out %~,$(wildcard *--*))
boilerplates.made : $(bpsrc)
$(QUIET)ls *--* 2>/dev/null | \
$(QUIET)umask 022 && ls *--* 2>/dev/null | \
while read boilerplate; \
do \
case "$$boilerplate" in *~) continue ;; esac && \
dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
dir=`expr "$$dst" : '\(.*\)/'` && \
$(INSTALL) -d -m 755 blt/$$dir && \
mkdir -p blt/$$dir && \
case "$$boilerplate" in \
*--) ;; \
*) cp -p $$boilerplate blt/$$dst ;; \
esac || exit; \
*--) continue;; \
esac && \
cp $$boilerplate blt/$$dst && \
if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \
chmod a+$$rx "blt/$$dst" || exit; \
done && \
date >$@

View File

@@ -941,8 +941,17 @@ int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o)
return -1;
}
}
else if (newtree)
else if (newtree) {
if (oldtree && !o->initial_checkout) {
/*
* deletion of the path was staged;
*/
if (same(oldtree, newtree))
return 1;
return reject_merge(oldtree, o);
}
return merged_entry(newtree, current, o);
}
return deleted_entry(oldtree, current, o);
}

View File

@@ -26,6 +26,7 @@ struct unpack_trees_options {
verbose_update:1,
aggressive:1,
skip_unmerged:1,
initial_checkout:1,
gently:1;
const char *prefix;
int pos;