mirror of
https://github.com/git/git.git
synced 2026-03-13 02:13:24 +01:00
Merge branch 'master' into next
* master: stash: suggest the correct command line for unknown options. t7406: Fix submodule init config tests git-svn: make git svn --version work again Revert "git-svn: always initialize with core.autocrlf=false" git-svn: support fetch with autocrlf on hash-object: support --stdin-paths with --no-filters
This commit is contained in:
@@ -10,7 +10,7 @@ SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git hash-object' [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin] [--] <file>...
|
||||
'git hash-object' [-t <type>] [-w] --stdin-paths < <list-of-paths>
|
||||
'git hash-object' [-t <type>] [-w] --stdin-paths [--no-filters] < <list-of-paths>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
@@ -33,6 +33,8 @@ static void hash_object(const char *path, const char *type, int write_object,
|
||||
hash_fd(fd, type, write_object, vpath);
|
||||
}
|
||||
|
||||
static int no_filters;
|
||||
|
||||
static void hash_stdin_paths(const char *type, int write_objects)
|
||||
{
|
||||
struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;
|
||||
@@ -44,7 +46,8 @@ static void hash_stdin_paths(const char *type, int write_objects)
|
||||
die("line is badly quoted");
|
||||
strbuf_swap(&buf, &nbuf);
|
||||
}
|
||||
hash_object(buf.buf, type, write_objects, buf.buf);
|
||||
hash_object(buf.buf, type, write_objects,
|
||||
no_filters ? NULL : buf.buf);
|
||||
}
|
||||
strbuf_release(&buf);
|
||||
strbuf_release(&nbuf);
|
||||
@@ -60,7 +63,6 @@ static const char *type;
|
||||
static int write_object;
|
||||
static int hashstdin;
|
||||
static int stdin_paths;
|
||||
static int no_filters;
|
||||
static const char *vpath;
|
||||
|
||||
static const struct option hash_object_options[] = {
|
||||
@@ -100,8 +102,6 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix)
|
||||
errstr = "Can't specify files with --stdin-paths";
|
||||
else if (vpath)
|
||||
errstr = "Can't use --stdin-paths with --path";
|
||||
else if (no_filters)
|
||||
errstr = "Can't use --stdin-paths with --no-filters";
|
||||
}
|
||||
else {
|
||||
if (hashstdin > 1)
|
||||
|
||||
@@ -151,6 +151,7 @@ save_stash () {
|
||||
;;
|
||||
-*)
|
||||
echo "error: unknown option for 'stash save': $1"
|
||||
echo " To provide a message, use git stash save -- '$1'"
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -351,6 +351,7 @@ information.
|
||||
}
|
||||
|
||||
sub version {
|
||||
::_req_svn();
|
||||
print "git-svn version $VERSION (svn $SVN::Core::VERSION)\n";
|
||||
exit 0;
|
||||
}
|
||||
@@ -369,7 +370,6 @@ sub do_git_init_db {
|
||||
command_noisy(@init_db);
|
||||
$_repository = Git->repository(Repository => ".git");
|
||||
}
|
||||
command_noisy('config', 'core.autocrlf', 'false');
|
||||
my $set;
|
||||
my $pfx = "svn-remote.$Git::SVN::default_repo_id";
|
||||
foreach my $i (keys %icv) {
|
||||
|
||||
@@ -842,7 +842,7 @@ sub _open_hash_and_insert_object_if_needed {
|
||||
|
||||
($self->{hash_object_pid}, $self->{hash_object_in},
|
||||
$self->{hash_object_out}, $self->{hash_object_ctx}) =
|
||||
command_bidi_pipe(qw(hash-object -w --stdin-paths));
|
||||
command_bidi_pipe(qw(hash-object -w --stdin-paths --no-filters));
|
||||
}
|
||||
|
||||
sub _close_hash_and_insert_object {
|
||||
|
||||
@@ -65,10 +65,6 @@ test_expect_success "Can't use --path with --stdin-paths" '
|
||||
echo example | test_must_fail git hash-object --stdin-paths --path=foo
|
||||
'
|
||||
|
||||
test_expect_success "Can't use --stdin-paths with --no-filters" '
|
||||
echo example | test_must_fail git hash-object --stdin-paths --no-filters
|
||||
'
|
||||
|
||||
test_expect_success "Can't use --path with --no-filters" '
|
||||
test_must_fail git hash-object --no-filters --path=foo
|
||||
'
|
||||
@@ -141,6 +137,20 @@ test_expect_success 'check that --no-filters option works' '
|
||||
git config --unset core.autocrlf
|
||||
'
|
||||
|
||||
test_expect_success 'check that --no-filters option works with --stdin-paths' '
|
||||
echo fooQ | tr Q "\\015" >file0 &&
|
||||
cp file0 file1 &&
|
||||
echo "file0 -crlf" >.gitattributes &&
|
||||
echo "file1 crlf" >>.gitattributes &&
|
||||
git config core.autocrlf true &&
|
||||
file0_sha=$(git hash-object file0) &&
|
||||
file1_sha=$(git hash-object file1) &&
|
||||
test "$file0_sha" != "$file1_sha" &&
|
||||
nofilters_file1=$(echo "file1" | git hash-object --stdin-paths --no-filters) &&
|
||||
test "$file0_sha" = "$nofilters_file1" &&
|
||||
git config --unset core.autocrlf
|
||||
'
|
||||
|
||||
pop_repo
|
||||
|
||||
for args in "-w --stdin" "--stdin -w"; do
|
||||
|
||||
@@ -28,6 +28,8 @@ test_expect_success 'setup a submodule tree' '
|
||||
git commit -m upstream
|
||||
git clone . super &&
|
||||
git clone super submodule &&
|
||||
git clone super rebasing &&
|
||||
git clone super merging &&
|
||||
(cd super &&
|
||||
git submodule add ../submodule submodule &&
|
||||
test_tick &&
|
||||
@@ -45,6 +47,16 @@ test_expect_success 'setup a submodule tree' '
|
||||
) &&
|
||||
git add submodule &&
|
||||
git commit -m "submodule update"
|
||||
) &&
|
||||
(cd super &&
|
||||
git submodule add ../rebasing rebasing &&
|
||||
test_tick &&
|
||||
git commit -m "rebasing"
|
||||
) &&
|
||||
(cd super &&
|
||||
git submodule add ../merging merging &&
|
||||
test_tick &&
|
||||
git commit -m "rebasing"
|
||||
)
|
||||
'
|
||||
|
||||
@@ -177,21 +189,17 @@ test_expect_success 'submodule update - checkout in .git/config' '
|
||||
|
||||
test_expect_success 'submodule init picks up rebase' '
|
||||
(cd super &&
|
||||
git config submodule.rebasing.url git://non-existing/git &&
|
||||
git config submodule.rebasing.path does-not-matter &&
|
||||
git config submodule.rebasing.update rebase &&
|
||||
git config -f .gitmodules submodule.rebasing.update rebase &&
|
||||
git submodule init rebasing &&
|
||||
test "rebase" = $(git config submodule.rebasing.update)
|
||||
test "rebase" = "$(git config submodule.rebasing.update)"
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'submodule init picks up merge' '
|
||||
(cd super &&
|
||||
git config submodule.merging.url git://non-existing/git &&
|
||||
git config submodule.merging.path does-not-matter &&
|
||||
git config submodule.merging.update merge &&
|
||||
git config -f .gitmodules submodule.merging.update merge &&
|
||||
git submodule init merging &&
|
||||
test "merge" = $(git config submodule.merging.update)
|
||||
test "merge" = "$(git config submodule.merging.update)"
|
||||
)
|
||||
'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user