Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ test:linux:
CC: gcc
artifacts:
paths:
- build/meson-logs
- t/failed-test-artifacts
reports:
junit: build/meson-logs/testlog.junit.xml
when: on_failure
when: always

test:osx:
image: $image
Expand Down Expand Up @@ -111,10 +112,11 @@ test:osx:
CC: clang
artifacts:
paths:
- build/meson-logs
- t/failed-test-artifacts
reports:
junit: build/meson-logs/testlog.junit.xml
when: on_failure
when: always

.windows_before_script: &windows_before_script
# Disabling realtime monitoring fails on some of the runners, but it
Expand Down Expand Up @@ -183,11 +185,14 @@ test:msvc-meson:
- job: "build:msvc-meson"
artifacts: true
script:
- meson test -C build --no-rebuild --print-errorlogs --slice $Env:CI_NODE_INDEX/$Env:CI_NODE_TOTAL
- meson test -C build --test-args=-x --no-rebuild --print-errorlogs --slice $Env:CI_NODE_INDEX/$Env:CI_NODE_TOTAL
parallel: 10
artifacts:
paths:
- build/meson-logs
reports:
junit: build/meson-logs/testlog.junit.xml
when: always

test:fuzz-smoke-tests:
image: ubuntu:latest
Expand Down
19 changes: 14 additions & 5 deletions builtin/last-modified.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void add_path_from_diff(struct diff_queue_struct *q,

static int populate_paths_from_revs(struct last_modified *lm)
{
int num_interesting = 0;
int num_interesting = 0, ret = 0;
struct diff_options diffopt;

/*
Expand All @@ -145,16 +145,25 @@ static int populate_paths_from_revs(struct last_modified *lm)
if (obj->item->flags & UNINTERESTING)
continue;

if (num_interesting++)
return error(_("last-modified can only operate on one tree at a time"));
if (num_interesting++) {
ret = error(_("last-modified can only operate on one commit at a time"));
goto out;
}

if (!repo_peel_to_type(lm->rev.repo, obj->path, 0, obj->item, OBJ_COMMIT)) {
ret = error(_("revision argument '%s' is a %s, not a commit-ish"), obj->name, type_name(obj->item->type));
goto out;
}

diff_tree_oid(lm->rev.repo->hash_algo->empty_tree,
&obj->item->oid, "", &diffopt);
diff_flush(&diffopt);
}

out:
clear_pathspec(&diffopt.pathspec);

return 0;
return ret;
}

static void last_modified_emit(struct last_modified *lm,
Expand Down Expand Up @@ -491,7 +500,7 @@ static int last_modified_init(struct last_modified *lm, struct repository *r,
lm->rev.bloom_filter_settings = get_bloom_filter_settings(lm->rev.repo);

if (populate_paths_from_revs(lm) < 0)
return error(_("unable to setup last-modified"));
return -1;

CALLOC_ARRAY(lm->all_paths, hashmap_get_size(&lm->paths));
lm->all_paths_nr = 0;
Expand Down
10 changes: 9 additions & 1 deletion ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,15 @@ fi
MAKEFLAGS="$MAKEFLAGS --jobs=$JOBS"
GIT_PROVE_OPTS="--timer --jobs $JOBS"

GIT_TEST_OPTS="$GIT_TEST_OPTS --verbose-log -x"
GIT_TEST_OPTS="$GIT_TEST_OPTS -x"

case "$jobname" in
*-meson)
;;
*)
GIT_TEST_OPTS="$GIT_TEST_OPTS --verbose-log";;
esac

case "$CI_OS_NAME" in
windows|windows_nt)
GIT_TEST_OPTS="$GIT_TEST_OPTS --no-chain-lint --no-bin-wrappers"
Expand Down
13 changes: 0 additions & 13 deletions ci/run-test-slice-meson.sh

This file was deleted.

24 changes: 19 additions & 5 deletions t/t8020-last-modified.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ test_expect_success 'setup' '
test_commit 1 file &&
mkdir a &&
test_commit 2 a/file &&
git tag -mA t2 2 &&
mkdir a/b &&
test_commit 3 a/b/file
'

test_expect_success 'cannot run last-modified on two trees' '
test_must_fail git last-modified HEAD HEAD~1
'

check_last_modified() {
local indir= &&
while test $# != 0
Expand Down Expand Up @@ -55,6 +52,13 @@ test_expect_success 'last-modified recursive' '
EOF
'

test_expect_success 'last-modified on annotated tag' '
check_last_modified t2 <<-\EOF
2 a
1 file
EOF
'

test_expect_success 'last-modified recursive with show-trees' '
check_last_modified -r -t <<-\EOF
3 a/b
Expand Down Expand Up @@ -230,9 +234,19 @@ test_expect_success 'last-modified merge undoes changes' '
EOF
'

test_expect_success 'cannot run last-modified on two commits' '
test_must_fail git last-modified HEAD HEAD~1 2>err &&
test_grep "last-modified can only operate on one commit at a time" err
'

test_expect_success 'last-modified complains about unknown arguments' '
test_must_fail git last-modified --foo 2>err &&
grep "unknown last-modified argument: --foo" err
test_grep "unknown last-modified argument: --foo" err
'

test_expect_success 'last-modified expects commit-ish' '
test_must_fail git last-modified HEAD^{tree} 2>err &&
test_grep "revision argument ${SQ}HEAD^{tree}${SQ} is a tree, not a commit-ish" err
'

test_done
Loading