Skip to content

Commit

Permalink
Merge branch 'dev-on-linux'
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 3, 2023
2 parents e145a74 + 59f21e4 commit 6b4a303
Show file tree
Hide file tree
Showing 107 changed files with 87 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
- name: test
env:
CI: true
GITOXIDE_TEST_IGNORE_ARCHIVES: 1
run: just ci-test

test-fast:
Expand All @@ -60,6 +61,7 @@ jobs:
os:
- windows-latest
- macos-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
60 changes: 44 additions & 16 deletions gix-archive/tests/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod from_tree {
#[test]
fn basic_usage_internal() -> gix_testtools::Result {
basic_usage(gix_archive::Format::InternalTransientNonPersistable, |buf| {
assert_eq!(buf.len(), 551);
assert_eq!(buf.len(), if cfg!(windows) { 565 } else { 551 });

let mut stream = gix_worktree_stream::Stream::from_read(std::io::Cursor::new(buf));
let mut paths_and_modes = Vec::new();
Expand All @@ -28,7 +28,12 @@ mod from_tree {
entry.read_to_end(&mut buf).expect("stream can always be read");
}

let expected_extra_exe_mode = if cfg!(windows) {
let expected_link_mode = if cfg!(windows) {
EntryMode::Blob
} else {
EntryMode::Link
};
let expected_exe_mode = if cfg!(windows) {
EntryMode::Blob
} else {
EntryMode::BlobExecutable
Expand All @@ -48,8 +53,12 @@ mod from_tree {
),
(
"symlink-to-a".into(),
EntryMode::Link,
hex_to_id("2e65efe2a145dda7ee51d1741299f848e5bf752e")
expected_link_mode,
hex_to_id(if cfg!(windows) {
"45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
} else {
"2e65efe2a145dda7ee51d1741299f848e5bf752e"
})
),
(
"dir/b".into(),
Expand All @@ -58,7 +67,7 @@ mod from_tree {
),
(
"dir/subdir/exe".into(),
EntryMode::BlobExecutable,
expected_exe_mode,
hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")
),
(
Expand All @@ -68,7 +77,7 @@ mod from_tree {
),
(
"extra-exe".into(),
expected_extra_exe_mode,
expected_exe_mode,
hex_to_id("0000000000000000000000000000000000000000")
),
(
Expand All @@ -78,7 +87,7 @@ mod from_tree {
),
(
"extra-dir/symlink-to-extra".into(),
EntryMode::Link,
expected_link_mode,
hex_to_id("0000000000000000000000000000000000000000")
)
]
Expand Down Expand Up @@ -111,19 +120,34 @@ mod from_tree {
header.mode()?,
));
}
let expected_extra_exe_mode = if cfg!(windows) { 420 } else { 493 };
let expected_symlink_type = if cfg!(windows) {
EntryType::Regular
} else {
EntryType::Symlink
};
let expected_exe_mode = if cfg!(windows) { 420 } else { 493 };
assert_eq!(
out,
[
("prefix/.gitattributes", EntryType::Regular, 56, 420),
("prefix/a", EntryType::Regular, 3, 420),
("prefix/symlink-to-a", EntryType::Symlink, 0, 420),
(
"prefix/symlink-to-a",
expected_symlink_type,
if cfg!(windows) { 3 } else { 0 },
420
),
("prefix/dir/b", EntryType::Regular, 3, 420),
("prefix/dir/subdir/exe", EntryType::Regular, 0, 493),
("prefix/dir/subdir/exe", EntryType::Regular, 0, expected_exe_mode),
("prefix/extra-file", EntryType::Regular, 21, 420),
("prefix/extra-exe", EntryType::Regular, 0, expected_extra_exe_mode),
("prefix/extra-exe", EntryType::Regular, 0, expected_exe_mode),
("prefix/extra-dir-empty", EntryType::Directory, 0, 420),
("prefix/extra-dir/symlink-to-extra", EntryType::Symlink, 0, 420)
(
"prefix/extra-dir/symlink-to-extra",
expected_symlink_type,
if cfg!(windows) { 21 } else { 0 },
420
)
]
.into_iter()
.map(|(path, b, c, d)| (bstr::BStr::new(path).to_owned(), b, c, d))
Expand Down Expand Up @@ -155,8 +179,8 @@ mod from_tree {
},
|buf| {
assert!(
buf.len() < 1200,
"bigger than uncompressed for some reason: {} < 1200",
buf.len() < 1220,
"bigger than uncompressed for some reason: {} < 1220",
buf.len()
);
let mut ar = zip::ZipArchive::new(std::io::Cursor::new(buf.as_slice()))?;
Expand All @@ -181,10 +205,14 @@ mod from_tree {
let mut link = ar.by_name("prefix/symlink-to-a")?;
assert!(!link.is_dir());
assert!(link.is_file(), "no symlink differentiation");
assert_eq!(link.unix_mode(), Some(0o120644), "it's all in the mode");
assert_eq!(
link.unix_mode(),
Some(if cfg!(windows) { 0o100644 } else { 0o120644 }),
"the mode specifies what it should be"
);
let mut buf = Vec::new();
link.read_to_end(&mut buf)?;
assert_eq!(buf.as_bstr(), "a");
assert_eq!(buf.as_bstr(), if cfg!(windows) { "hi\n" } else { "a" });
Ok(())
},
)
Expand Down
1 change: 1 addition & 0 deletions gix-archive/tests/fixtures/basic.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -eu -o pipefail

git init
Expand Down
1 change: 1 addition & 0 deletions gix-archive/tests/fixtures/generated-archives/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
basic.tar.xz
3 changes: 0 additions & 3 deletions gix-archive/tests/fixtures/generated-archives/basic.tar.xz

This file was deleted.

Empty file modified gix-attributes/tests/fixtures/make_attributes_baseline.sh
100644 → 100755
Empty file.
10 changes: 4 additions & 6 deletions gix-command/tests/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ mod spawn {
#[test]
#[cfg(unix)]
fn disallow_shell() -> crate::Result {
let out = gix_command::prepare("echo hi")
let out = gix_command::prepare("PATH= echo hi")
.with_shell()
.spawn()?
.wait_with_output()?;
assert_eq!(out.stdout.as_bstr(), "hi\n");

let mut cmd: std::process::Command = gix_command::prepare("echo hi").with_shell().without_shell().into();
assert!(
gix_command::prepare("echo hi")
.with_shell()
.without_shell()
.spawn()
.is_err(),
cmd.env_remove("PATH").spawn().is_err(),
"no command named 'echo hi' exists"
);
Ok(())
Expand Down
Empty file modified gix-commitgraph/tests/fixtures/generation_number_overflow.sh
100644 → 100755
Empty file.
Empty file modified gix-commitgraph/tests/fixtures/single_commit_huge_dates.sh
100644 → 100755
Empty file.
Empty file modified gix-config/tests/fixtures/config_with_worktree_extension.sh
100644 → 100755
Empty file.
Empty file modified gix-config/tests/fixtures/make_config_repo.sh
100644 → 100755
Empty file.
Empty file modified gix-credentials/tests/fixtures/all-but-credentials.sh
100644 → 100755
Empty file.
Empty file modified gix-credentials/tests/fixtures/fail.sh
100644 → 100755
Empty file.
Empty file modified gix-credentials/tests/fixtures/last-pass.sh
100644 → 100755
Empty file.
Empty file modified gix-credentials/tests/fixtures/password.sh
100644 → 100755
Empty file.
Empty file modified gix-credentials/tests/fixtures/reflect.sh
100644 → 100755
Empty file.
Empty file modified gix-credentials/tests/fixtures/url.sh
100644 → 100755
Empty file.
Empty file modified gix-credentials/tests/fixtures/username.sh
100644 → 100755
Empty file.
Empty file modified gix-date/tests/fixtures/generate_git_date_baseline.sh
100644 → 100755
Empty file.
Empty file modified gix-discover/tests/fixtures/make_basic_repo.sh
100644 → 100755
Empty file.
Empty file modified gix-discover/tests/fixtures/make_exfat_repo_darwin.sh
100644 → 100755
Empty file.
Empty file modified gix-discover/tests/fixtures/make_submodules.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions gix-filter/tests/fixtures/baseline.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -eu -o pipefail

driver=${1:?First argument is the driver program supporting both process mode and clean/smudge}
Expand Down
1 change: 1 addition & 0 deletions gix-filter/tests/fixtures/pipeline_repos.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -eu -o pipefail

(mkdir all-filters && cd all-filters
Expand Down
Empty file modified gix-glob/tests/fixtures/make_baseline.sh
100644 → 100755
Empty file.
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/V2_empty.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v2.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v2_all_file_kinds.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v2_more_files.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v2_sparse_index_no_dirs.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v2_split_index.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v2_split_index_recursive.sh
100644 → 100755
Empty file.
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v3_added_files.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v3_skip_worktree.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v3_sparse_index.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v3_sparse_index_non_cone.sh
100644 → 100755
Empty file.
Empty file modified gix-index/tests/fixtures/make_index/v4_more_files_IEOT.sh
100644 → 100755
Empty file.
Empty file modified gix-negotiate/tests/fixtures/make_repos.sh
100644 → 100755
Empty file.
Empty file modified gix-object/tests/fixtures/make_trees.sh
100644 → 100755
Empty file.
Empty file modified gix-odb/tests/fixtures/make_alternates_odb.sh
100644 → 100755
Empty file.
Empty file modified gix-odb/tests/fixtures/make_replaced_history.sh
100644 → 100755
Empty file.
Empty file modified gix-odb/tests/fixtures/make_repo_multi_index.sh
100644 → 100755
Empty file.
Empty file modified gix-odb/tests/fixtures/repo_with_loose_objects.sh
100644 → 100755
Empty file.
Empty file modified gix-pathspec/tests/fixtures/generate_pathspec_baseline.sh
100644 → 100755
Empty file.
Empty file modified gix-ref/tests/fixtures/make_namespaced_packed_ref_repository.sh
100644 → 100755
Empty file.
Empty file modified gix-ref/tests/fixtures/make_packed_ref_repository.sh
100644 → 100755
Empty file.
Empty file.
Empty file modified gix-ref/tests/fixtures/make_packed_refs_for_lookup_rules.sh
100644 → 100755
Empty file.
Empty file modified gix-ref/tests/fixtures/make_ref_repository.sh
100644 → 100755
Empty file.
Empty file modified gix-ref/tests/fixtures/make_repo_for_reflog.sh
100644 → 100755
Empty file.
Empty file.
Empty file modified gix-ref/tests/fixtures/make_worktree_repo.sh
100644 → 100755
Empty file.
Empty file modified gix-refspec/tests/fixtures/match_baseline.sh
100644 → 100755
Empty file.
Empty file modified gix-refspec/tests/fixtures/parse_baseline.sh
100644 → 100755
Empty file.
15 changes: 11 additions & 4 deletions gix-revision/fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified gix-revision/tests/fixtures/make_repo_with_branches.sh
100644 → 100755
Empty file.
Empty file modified gix-traverse/tests/fixtures/make_repos.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions gix-worktree-stream/tests/fixtures/basic.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -eu -o pipefail

git init
Expand Down
21 changes: 15 additions & 6 deletions gix-worktree-stream/tests/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,16 @@ mod from_tree {
}
}

let expected_extra_exe_mode = if cfg!(windows) {
let expected_exe_mode = if cfg!(windows) {
EntryMode::Blob
} else {
EntryMode::BlobExecutable
};
let expected_link_mode = if cfg!(windows) {
EntryMode::Blob
} else {
EntryMode::Link
};
assert_eq!(
paths_and_modes,
&[
Expand All @@ -128,8 +133,12 @@ mod from_tree {
),
(
"symlink-to-a".into(),
EntryMode::Link,
hex_to_id("2e65efe2a145dda7ee51d1741299f848e5bf752e")
expected_link_mode,
hex_to_id(if cfg!(windows) {
"45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
} else {
"2e65efe2a145dda7ee51d1741299f848e5bf752e"
})
),
(
"dir/.gitattributes".into(),
Expand All @@ -143,7 +152,7 @@ mod from_tree {
),
(
"dir/subdir/exe".into(),
EntryMode::BlobExecutable,
expected_exe_mode,
hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")
),
(
Expand All @@ -163,7 +172,7 @@ mod from_tree {
),
(
"extra-exe".into(),
expected_extra_exe_mode,
expected_exe_mode,
hex_to_id("0000000000000000000000000000000000000000")
),
(
Expand All @@ -173,7 +182,7 @@ mod from_tree {
),
(
"extra-dir/symlink-to-extra".into(),
EntryMode::Link,
expected_link_mode,
hex_to_id("0000000000000000000000000000000000000000")
)
]
Expand Down
2 changes: 2 additions & 0 deletions gix-worktree/tests/fixtures/generated-archives/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
make_ignore_and_attributes_setup.tar.xz
make_mixed_without_submodules.tar.xz
make_mixed_without_submodules_and_symlinks.tar.xz
make_attributes_baseline.tar.xz
make_dangerous_symlink.tar.xz
status_unchanged.tar.xz
status_changed.tar.xz

This file was deleted.

This file was deleted.

Empty file modified gix-worktree/tests/fixtures/make_attributes_baseline.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/make_dangerous_symlink.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/make_ignore_and_attributes_setup.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/make_ignore_setup.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/make_ignorecase_collisions.sh
100644 → 100755
Empty file.
Empty file.
Empty file modified gix-worktree/tests/fixtures/make_special_exclude_case.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/racy_git.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/status_changed.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/status_conflict.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/status_intent_to_add.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/status_removed.sh
100644 → 100755
Empty file.
Empty file modified gix-worktree/tests/fixtures/status_unchanged.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_am_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_basic_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_bisect_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_cherry_pick_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_cherry_pick_sequence_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_commit_describe_multiple_tags.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_complex_shallow_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_config_repo.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions gix/tests/fixtures/make_config_repos.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -eu -o pipefail

git init http-config
Expand Down
Empty file modified gix/tests/fixtures/make_core_worktree_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_diff_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_empty_repo.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions gix/tests/fixtures/make_fetch_repos.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -eu -o pipefail

# IMPORTANT: keep this repo small as it's used for writes, hence will be executed for each writer!
Expand Down
Empty file modified gix/tests/fixtures/make_merge_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_packed_and_loose.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_pre_epoch_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_rebase_i_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_references_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_remote_repo.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions gix/tests/fixtures/make_remote_repos.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -eu -o pipefail

function tick () {
Expand Down
Empty file modified gix/tests/fixtures/make_repo_with_fork_and_dates.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_rev_spec_parse_repos.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_revert_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_revert_sequence_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_shallow_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_signatures_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_submodules.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_worktree_repo.sh
100644 → 100755
Empty file.
Empty file modified gix/tests/fixtures/make_worktree_repo_with_configs.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion tests/tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ fn scripted_fixture_read_only_with_args_inner(
}
assert!(
output.status.success(),
"fixture script failed: stdout: {}\nstderr: {}",
"fixture script of {cmd:?} failed: stdout: {}\nstderr: {}",
output.stdout.as_bstr(),
output.stderr.as_bstr()
);
Expand Down

0 comments on commit 6b4a303

Please sign in to comment.