Skip to content

Commit 5bfd994

Browse files
authored
Commit LFS rules by default with --use-lfs (#4)
Keeping the rules only in .git/info/attributes left LFS pointer files in the working tree after any checkout, pull or clone. --use-lfs now commits per-extension rules to .gitattributes; --no-lfs-commit-rules restores the old local-only behaviour. Also: release via PyPI trusted publishing (OIDC), add CODEOWNERS, add keywords/classifiers/urls to pyproject.toml, bump to 0.1.2.
1 parent aaf7ff5 commit 5bfd994

12 files changed

Lines changed: 55 additions & 20 deletions

File tree

‎.github/CODEOWNERS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Default owner for everything in the repository
2+
* @coldsofttech

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Release
22

33
# Publishes to PyPI when a version tag such as v0.2.0 is pushed.
4-
# Needs a PYPI_API_TOKEN secret (Settings > Secrets and variables > Actions).
4+
# Uses PyPI trusted publishing (OIDC), so no API token is stored. PyPI needs a
5+
# trusted publisher for this repository: workflow release.yml, environment pypi.
56
on:
67
push:
78
tags: ["v*.*.*"]
@@ -49,6 +50,7 @@ jobs:
4950
environment: pypi
5051
permissions:
5152
contents: write
53+
id-token: write
5254
steps:
5355
- uses: actions/checkout@v7
5456

@@ -58,9 +60,7 @@ jobs:
5860
run: uv build
5961

6062
- name: Publish to PyPI
61-
env:
62-
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
63-
run: uv publish
63+
run: uv publish --trusted-publishing always
6464

6565
- name: GitHub release
6666
uses: softprops/action-gh-release@v3

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## [Unreleased]
44

5+
## [0.1.2] - 2026-10-25
6+
7+
### Changed
8+
- `--use-lfs` now commits LFS rules by default so checkouts and clones get the real files. Use `--no-lfs-commit-rules` for the old per-run behaviour.
9+
- Releases are published to PyPI with trusted publishing instead of an API token.
10+
- The PyPI page now shows keywords, classifiers and project links.
11+
512
## [0.1.1] - 2026-10-24
613

714
### Added

‎README.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ nothing staged, then asks for confirmation.
9898
| `--log-file` | Write the log to this file instead of the default folder |
9999
| `--lfs-threshold-mib` | With `--use-lfs`, files larger than this use LFS (default 100, `0` = every file) |
100100
| `--use-lfs` | Store files over 100 MiB with Git LFS for this run (see below) |
101-
| `--lfs-commit-rules` | With `--use-lfs`, also commit LFS rules so clones get the real files |
101+
| `--no-lfs-commit-rules` | With `--use-lfs`, keep LFS rules local to the run (checkouts and clones then show pointer files, not real files) |
102102
| `--report` | Write a JSON summary of the run to this file |
103103
| `--notify` | Show a desktop notification when the run ends |
104104
| `--notify-webhook` | Send a JSON summary to this web address when the run ends |
@@ -285,7 +285,7 @@ commitrocket --repo . --message "Add assets" # later: pushes the saved commi
285285

286286
**Videos in LFS that clones can download too**
287287
```
288-
commitrocket --repo . --message "Videos" --use-lfs --lfs-commit-rules
288+
commitrocket --repo . --message "Videos" --use-lfs
289289
```
290290

291291
**See what would happen first**
@@ -432,12 +432,13 @@ used up quickly. Git's own settings files (`.gitattributes`, `.gitignore`, `.lfs
432432
always stay as normal files. The threshold cannot be above 100, since larger files are
433433
rejected by hosts.
434434

435-
To let clones receive the real files, add `--lfs-commit-rules`. CommitRocket then commits
435+
So that checkouts and clones receive the real files, CommitRocket commits the LFS rules by default. It commits
436436
one rule per file type (for example `*.mp4`) to `.gitattributes` as `<message> (LFS rules)`,
437437
pushes it first, and your files follow as LFS pointers. Because rules are per type, every
438438
file of that type is stored in LFS from then on, including small ones and future ones.
439439
Files without an extension get an exact-path rule. `.gitattributes` must have no
440-
uncommitted changes beforehand.
440+
uncommitted changes beforehand. Pass `--no-lfs-commit-rules` to skip this; videos then turn into
441+
text pointer files after a pull, reset or clone.
441442

442443
If a run fails after committing LFS files but before pushing them, the LFS hooks are left
443444
installed so the files can still be uploaded. Run CommitRocket again to finish; avoid a

‎docs/architecture.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ remain, `130` interrupted.
7979
`refs/remotes/<remote>/<branch>..HEAD`, or `HEAD --not --remotes=<remote>` when that
8080
branch was never pushed.
8181
- **`--no-push`**: skips push and verification; rejected together with `--use-lfs`.
82-
- **`--lfs-commit-rules`**: `LfsSession.write_committed_rules` appends one rule per
82+
- **`--lfs-commit-rules`** (default on with `--use-lfs`; `--no-lfs-commit-rules` turns it off): `LfsSession.write_committed_rules` appends one rule per
8383
extension (`committed_rule_lines`; exact path for extension-less or odd names) to
8484
`.gitattributes` after checking it is clean. The runner commits it as
8585
`<message> (LFS rules)` and pushes it before the first batch. Local-only rules in

‎pyproject.toml‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,32 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "commitrocket"
7-
version = "0.1.1"
7+
version = "0.1.2"
88
description = "Batch Git changes by size, commit each batch, and push with live progress."
99
readme = "README.md"
1010
license = { file = "LICENSE" }
1111
requires-python = ">=3.11"
12+
keywords = ["git", "commit", "push", "batch", "large-files", "git-lfs", "cli"]
13+
classifiers = [
14+
"Development Status :: 4 - Beta",
15+
"Environment :: Console",
16+
"Intended Audience :: Developers",
17+
"License :: OSI Approved :: MIT License",
18+
"Operating System :: OS Independent",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3 :: Only",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
23+
"Programming Language :: Python :: 3.13",
24+
"Topic :: Software Development :: Version Control :: Git",
25+
"Topic :: Utilities",
26+
]
1227
dependencies = ["rich>=13", "pathspec>=0.12"]
1328

29+
[project.urls]
30+
Homepage = "https://github.com/coldsofttech/CommitRocket"
31+
Issues = "https://github.com/coldsofttech/CommitRocket/issues"
32+
1433
[project.scripts]
1534
commitrocket = "commitrocket.cli:main"
1635

‎src/commitrocket/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""CommitRocket: batch Git changes by size, commit each batch, and push."""
22

3-
__version__ = "0.1.1"
3+
__version__ = "0.1.2"

‎src/commitrocket/cli.py‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,18 @@ def build_parser():
130130
)
131131
parser.add_argument(
132132
"--lfs-commit-rules",
133+
dest="lfs_commit_rules",
133134
action="store_true",
134-
help="With --use-lfs, also commit LFS rules to .gitattributes (one per "
135-
"file extension) so clones get real files and future files of the same "
136-
"type use LFS",
135+
default=True,
136+
help="With --use-lfs, commit LFS rules to .gitattributes (one per file "
137+
"extension) so clones and checkouts get real files (default)",
138+
)
139+
parser.add_argument(
140+
"--no-lfs-commit-rules",
141+
dest="lfs_commit_rules",
142+
action="store_false",
143+
help="With --use-lfs, keep the LFS rules local to this run. Checkouts "
144+
"and clones will then contain LFS pointer files instead of the real files",
137145
)
138146
parser.add_argument(
139147
"--dry-run",
@@ -260,8 +268,6 @@ def validate(parser, args):
260268
"stay local and a later plain 'git push' would publish LFS pointers "
261269
"without their data"
262270
)
263-
if args.lfs_commit_rules and not args.use_lfs:
264-
parser.error("--lfs-commit-rules requires --use-lfs")
265271

266272
for label, value in (("--remote", args.remote), ("--branch", args.branch)):
267273
if value is not None:

‎src/commitrocket/options.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class RunOptions:
2828
lfs_threshold_mib: int = LFS_THRESHOLD_MIB
2929
lfs_threads: int | None = None
3030
lfs_batch_mib: int | None = None
31-
lfs_commit_rules: bool = False
31+
lfs_commit_rules: bool = True
3232
include: list = field(default_factory=list)
3333
exclude: list = field(default_factory=list)
3434
include_from: list = field(default_factory=list)

‎src/commitrocket/runner.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,8 @@ def list_pending():
433433
else:
434434
lfs_scope = (
435435
f"{which} will be stored with Git LFS for this run only; "
436-
"no LFS config is committed."
436+
"no LFS config is committed, so checkouts and clones will "
437+
"contain LFS pointer files instead of the real files."
437438
)
438439
if o.dry_run and not is_lfs_available():
439440
lfs_scope += " git-lfs is not installed and would be installed."

0 commit comments

Comments
 (0)