Merge branch 'ds/repack-fixlets'
Two fixes around "git repack". * ds/repack-fixlets: repack: make '--quiet' disable progress repack: respect kept objects with '--write-midx -b'
This commit is contained in:
@ -76,8 +76,9 @@ to the new separate pack will be written.
|
|||||||
linkgit:git-pack-objects[1].
|
linkgit:git-pack-objects[1].
|
||||||
|
|
||||||
-q::
|
-q::
|
||||||
Pass the `-q` option to 'git pack-objects'. See
|
--quiet::
|
||||||
linkgit:git-pack-objects[1].
|
Show no progress over the standard error stream and pass the `-q`
|
||||||
|
option to 'git pack-objects'. See linkgit:git-pack-objects[1].
|
||||||
|
|
||||||
-n::
|
-n::
|
||||||
Do not update the server information with
|
Do not update the server information with
|
||||||
|
@ -612,7 +612,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
|||||||
struct tempfile *refs_snapshot = NULL;
|
struct tempfile *refs_snapshot = NULL;
|
||||||
int i, ext, ret;
|
int i, ext, ret;
|
||||||
FILE *out;
|
FILE *out;
|
||||||
int show_progress = isatty(2);
|
int show_progress;
|
||||||
|
|
||||||
/* variables to be filled by option parsing */
|
/* variables to be filled by option parsing */
|
||||||
int pack_everything = 0;
|
int pack_everything = 0;
|
||||||
@ -693,7 +693,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
|||||||
write_bitmaps = 0;
|
write_bitmaps = 0;
|
||||||
}
|
}
|
||||||
if (pack_kept_objects < 0)
|
if (pack_kept_objects < 0)
|
||||||
pack_kept_objects = write_bitmaps > 0;
|
pack_kept_objects = write_bitmaps > 0 && !write_midx;
|
||||||
|
|
||||||
if (write_bitmaps && !(pack_everything & ALL_INTO_ONE) && !write_midx)
|
if (write_bitmaps && !(pack_everything & ALL_INTO_ONE) && !write_midx)
|
||||||
die(_(incremental_bitmap_conflict_error));
|
die(_(incremental_bitmap_conflict_error));
|
||||||
@ -725,6 +725,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
prepare_pack_objects(&cmd, &po_args);
|
prepare_pack_objects(&cmd, &po_args);
|
||||||
|
|
||||||
|
show_progress = !po_args.quiet && isatty(2);
|
||||||
|
|
||||||
strvec_push(&cmd.args, "--keep-true-parents");
|
strvec_push(&cmd.args, "--keep-true-parents");
|
||||||
if (!pack_kept_objects)
|
if (!pack_kept_objects)
|
||||||
strvec_push(&cmd.args, "--honor-pack-keep");
|
strvec_push(&cmd.args, "--honor-pack-keep");
|
||||||
@ -926,7 +928,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
|||||||
}
|
}
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
}
|
}
|
||||||
if (!po_args.quiet && show_progress)
|
if (show_progress)
|
||||||
opts |= PRUNE_PACKED_VERBOSE;
|
opts |= PRUNE_PACKED_VERBOSE;
|
||||||
prune_packed_objects(opts);
|
prune_packed_objects(opts);
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ test_description='git repack works correctly'
|
|||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "${TEST_DIRECTORY}/lib-bitmap.sh"
|
. "${TEST_DIRECTORY}/lib-bitmap.sh"
|
||||||
. "${TEST_DIRECTORY}/lib-midx.sh"
|
. "${TEST_DIRECTORY}/lib-midx.sh"
|
||||||
|
. "${TEST_DIRECTORY}/lib-terminal.sh"
|
||||||
|
|
||||||
commit_and_pack () {
|
commit_and_pack () {
|
||||||
test_commit "$@" 1>&2 &&
|
test_commit "$@" 1>&2 &&
|
||||||
@ -372,4 +373,16 @@ test_expect_success '--write-midx with preferred bitmap tips' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success '--write-midx -b packs non-kept objects' '
|
||||||
|
GIT_TRACE2_EVENT="$(pwd)/trace.txt" \
|
||||||
|
git repack --write-midx -a -b &&
|
||||||
|
test_subcommand_inexact git pack-objects --honor-pack-keep <trace.txt
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success TTY '--quiet disables progress' '
|
||||||
|
test_terminal env GIT_PROGRESS_DELAY=0 \
|
||||||
|
git -C midx repack -ad --quiet --write-midx 2>stderr &&
|
||||||
|
test_must_be_empty stderr
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -1759,6 +1759,40 @@ test_subcommand () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check that the given command was invoked as part of the
|
||||||
|
# trace2-format trace on stdin, but without an exact set of
|
||||||
|
# arguments.
|
||||||
|
#
|
||||||
|
# test_subcommand [!] <command> <args>... < <trace>
|
||||||
|
#
|
||||||
|
# For example, to look for an invocation of "git pack-objects"
|
||||||
|
# with the "--honor-pack-keep" argument, use
|
||||||
|
#
|
||||||
|
# GIT_TRACE2_EVENT=event.log git repack ... &&
|
||||||
|
# test_subcommand git pack-objects --honor-pack-keep <event.log
|
||||||
|
#
|
||||||
|
# If the first parameter passed is !, this instead checks that
|
||||||
|
# the given command was not called.
|
||||||
|
#
|
||||||
|
test_subcommand_inexact () {
|
||||||
|
local negate=
|
||||||
|
if test "$1" = "!"
|
||||||
|
then
|
||||||
|
negate=t
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
local expr=$(printf '"%s".*' "$@")
|
||||||
|
expr="${expr%,}"
|
||||||
|
|
||||||
|
if test -n "$negate"
|
||||||
|
then
|
||||||
|
! grep "\"event\":\"child_start\".*\[$expr\]"
|
||||||
|
else
|
||||||
|
grep "\"event\":\"child_start\".*\[$expr\]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Check that the given command was invoked as part of the
|
# Check that the given command was invoked as part of the
|
||||||
# trace2-format trace on stdin.
|
# trace2-format trace on stdin.
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user