Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCGitIgnoreZip

A Total Commander packer plugin (WCX) written in Rust that packs files while honoring .gitignore. Files excluded by gitignore rules are silently skipped, so you get a clean archive of just the files you'd actually commit.

Output is a standard ZIP or standard 7z archive (openable by any tool), and the plugin can also list, extract and modify its own archives from within Total Commander.

64-bit Total Commander only (tcgitignorezip.wcx64).

Download

Grab tcgitignorezip.zip from the latest release, then open it inside Total Commander and confirm the install prompt (see Installing). Prefer building it yourself? See Building.

How gitignore filtering works

When packing, the plugin walks the source directory once with the ignore crate (the engine behind ripgrep) to compute the set of files that are not excluded, then packs only those. It also expands any selected directory itself, so packing a folder always pulls in its (non-ignored) contents regardless of how Total Commander hands over the selection.

This honors the full gitignore semantics:

  • nested .gitignore files at any depth,
  • .git/info/exclude,
  • the global git excludes file,
  • negation rules (!pattern),

and it works even when the folder is not inside a .git repository (require_git(false)).

Dotfiles and the .git directory

The behavior matches git, not ripgrep's search defaults:

  • Dotfiles and dot-directories are kept (e.g. .gitignore, .github/, .vscode/, .cargo/config.toml). A leading dot does not mean "ignore".
  • The .git directory is always excluded (as are submodule .git gitlink files), exactly as git never tracks its own metadata.

So if you want to leave a dot-directory out of the archive, add it to a .gitignore just like you would for git (e.g. /.cargo/).

Formats and extensions

Extension Container Notes
.giz ZIP Standard ZIP bytes; rename to .zip to open anywhere.
.gi7 7z Standard 7z bytes; rename to .7z to open anywhere.

Custom extensions are used by default so the plugin does not clash with Total Commander's built-in ZIP/7z handlers. You can register additional extensions (including zip/7z) in Total Commander if you prefer.

Building

Requires the Rust toolchain with the x86_64-pc-windows-msvc target (the default on Windows). The MSVC C runtime is linked statically (.cargo/config.toml), so the resulting plugin has no vcruntime dependency.

# One-shot: build + package into dist\
pwsh -File scripts\build.ps1

# Or manually:
cargo build --release

scripts\build.ps1 produces:

  • dist\tcgitignorezip.wcx64 - the plugin,
  • dist\tcgitignorezip.zip - plugin + pluginst.inf for one-click install.

Run the tests with cargo test.

Installing

  • Easy: open tcgitignorezip.zip inside Total Commander and confirm the install prompt.
  • Manual: Configuration > Options > Plugins > Packer plugins (.WCX) > Configure, add extension giz (and gi7) pointing at tcgitignorezip.wcx64.

After changing plugin capabilities you may need to remove and re-add the plugin, since Total Commander caches the capability flags.

Usage

Packing (gitignore-aware)

  1. Select the folder(s)/file(s) to pack.
  2. Files > Pack (Alt+F5).
  3. Choose the giz (ZIP) or gi7 (7z) format from the packer list.
  4. Pack. Gitignored files (and .git) are excluded automatically.

Browsing / extracting

Press Enter on a .giz/.gi7 archive to browse it like a folder, or use F5 to copy files out (extract). F8/Del removes entries from the archive.

Implemented WCX functions

The plugin exports both the ANSI and the Unicode interfaces. Total Commander only recognizes a library as a packer plugin when the mandatory ANSI base functions are present, and then uses the Unicode (...W) variants when available.

  • Unicode: OpenArchiveW, ReadHeaderExW, ProcessFileW, SetProcessDataProcW, SetChangeVolProcW, CanYouHandleThisFileW, PackFilesW, DeleteFilesW.
  • ANSI: OpenArchive, ReadHeader, ReadHeaderEx, ProcessFile, SetProcessDataProc, SetChangeVolProc, CanYouHandleThisFile, PackFiles, DeleteFiles.
  • Shared: GetPackerCaps, GetBackgroundFlags, CloseArchive.

Capabilities advertised: PK_CAPS_NEW | PK_CAPS_MODIFY | PK_CAPS_MULTIPLE | PK_CAPS_DELETE | PK_CAPS_BY_CONTENT | PK_CAPS_SEARCHTEXT. Background packing and unpacking are supported (no global mutable archive state). Every export is panic-guarded so a Rust panic never crosses the FFI boundary.

Limitations

  • 64-bit Total Commander only (.wcx64).
  • Modifying an existing 7z archive (adding or deleting entries) rewrites the whole archive; extracting from solid 7z archives decodes per file.
  • No encryption, no multi-volume archives.
  • File timestamps are preserved for ZIP entries; extraction does not restore timestamps on disk.
  • Progress/cancel is wired through the Unicode callback; the ANSI progress callback is accepted but not used.

Project layout

File Purpose
src/lib.rs Exported C-ABI WCX entry points (ANSI + Unicode, panic-guarded).
src/ffi.rs WCX structs, flags and error codes (ANSI + Unicode).
src/wstr.rs UTF-16/ANSI conversions and AddList parsing.
src/util.rs Error type, format detection, date/time conversion.
src/ignore_filter.rs Builds the non-ignored file set via the ignore crate.
src/pack.rs PackFiles(W): filter + write ZIP/7z.
src/archive.rs Open/list/extract ZIP and 7z.
src/delete.rs DeleteFiles(W): rewrite without removed entries.
src/progress.rs Progress reporting + cancellation.

Acknowledgments

This plugin was developed with the help of AI (Cursor).

License

Licensed under the MIT License.

Third-party Rust crates bundled into the plugin are listed in THIRD-PARTY-NOTICES.md along with their licenses.

About

Total Commander packer plugin (WCX) that packs files into ZIP/7z while respecting your .gitignore.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages