Commit graph

4385 commits

Author SHA1 Message Date
Austin Seipp
b151a08c3b cargo: update to prost 0.14.1
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This requires regenerating the proto files, which now derive Eq and
Hash automatically.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-10-20 19:52:18 +00:00
Martin von Zweigbergk
3a511becd6 cargo: bump ignore crate to 0.4.24
This includes the fix for
https://github.com/BurntSushi/ripgrep/issues/3127. The fix let us
optionally allow unclosed character classes in .gitignore files. It is
allowed by default when using the `GitignoreBuilder` (as we do), so we
get the fix without code changes.
2025-10-20 17:20:14 +00:00
Scott Taylor
cbfceb631c merged_tree: rename take() to into_merge()
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This is consistent with `MergedTreeId::into_merge`.
2025-10-19 13:14:27 +00:00
Scott Taylor
141832414a backend: remove MergedTreeId::Legacy variant
I'm planning to try to add conflict labels to `MergedTree` and
`MergedTreeId`, and it will be easier to add them if both are structs
with similar methods. Since we don't support reading/writing legacy
conflicts anymore (as far as I'm aware), I think it should be safe to
delete the `MergedTreeId::Legacy` variant now.
2025-10-19 13:14:27 +00:00
Benjamin Brittain
730d633c73 op_heads_store: convert OpHeadsStore trait to be async
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This is primarily for consistency with the other storage traits.
2025-10-19 05:58:09 +00:00
Benjamin Brittain
3881bd52d7 op_store: convert OpStore trait to be async
This is primarily for consistency with the other storage traits.
2025-10-19 05:46:00 +00:00
Owen Brooks
f88b0d8093 cli: git clone: add --branch option
When cloning with the branch option:
- Only the specified branch will be fetched
- The trunk alias is only set if the specified branch happens to be the default branch
- The clone fails if the branch does not exist in the remote
2025-10-19 05:14:11 +00:00
Owen Brooks
e98e2e58c8 cli: Add RefExpansionError for expand_fetch_refspecs 2025-10-19 05:14:11 +00:00
Martin von Zweigbergk
e6d23b60dd git_backend: correct comment about reading conflict data from extra table
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This comment currently says that we update all conflicted commits when
reading the derialized extra metadata, but that's not true for commits
with the `jj:trees` commit header.
2025-10-19 02:57:17 +00:00
Yuya Nishihara
e555f863a8 fileset, revset: do not omit parentheses from expression span
If parentheses were omitted, a prefix/postfix expression span reconstructed from
sub expressions would become invalid.

Fixes #7747
2025-10-18 02:45:42 +00:00
Yuya Nishihara
bd98243071 revset: extract test for function call parsing
I'll add a helper function that would be useful only for the function call
tests.
2025-10-18 02:45:42 +00:00
Yuya Nishihara
9f75ee6110 revset: use Pair type consistently when passing parsed tree around 2025-10-18 02:45:42 +00:00
Yuya Nishihara
0fb99c12cc templater: include remote tags in "tags" output
Since we can now update tags internally, local and remote tags may be out of
sync in non-colocated Git repositories. "tags" template should indicate that.
2025-10-16 15:44:50 +00:00
Martin von Zweigbergk
beda1381bd working_copy: make potentially slow methods async
There's no pressing need, but we should do this eventually.
2025-10-15 03:27:06 +00:00
Yuya Nishihara
937d88ff25 cli: bookmark: allow tracking/untracking absent remote bookmarks
#7072
2025-10-15 01:52:19 +00:00
Yuya Nishihara
82dd14fd85 git: ensure RemoteView is created for remote with no existing refs
This will help "jj bookmark track" know whether absent remote ref can be created
for the specified remote. "jj bookmark" subcommands shouldn't depend on
gix::Repository API.
2025-10-15 01:52:19 +00:00
Yuya Nishihara
429fec1ae3 git: export tag changes
Although we don't have "jj git tag set"/"delete" commands, this fixes weird undo
behavior #6325. The discussion in #6325 is derailed, but there would be another
issue for the "abandon unreachable" behavior.

Fixes #6325
2025-10-15 01:31:16 +00:00
Yuya Nishihara
1db9c2def7 git: extract per-ref-type functions that compare and export refs 2025-10-15 01:31:16 +00:00
Yuya Nishihara
2ebc496ca9 git: extract per-ref-type struct from RefsToExport
We'll add tags support.
2025-10-15 01:31:16 +00:00
ase
f34dbabd47 config: add support for --when.workspaces
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-14 17:50:07 +00:00
Martin von Zweigbergk
3a7babe4d9 commit: introduce parent_tree_async(), use in already async callers
I haven't checked if this would make any difference anywhere. It's
nice if we can avoid blocking calls in existing async scopes.
2025-10-12 23:26:29 +00:00
bipul
72bfc1c96f config: add workspace-level configuration support
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
- Added support for workspace-specific configuration using `jj config` commands.
- Introduced `--workspace` option to `jj config edit`, `jj config set`, and `jj config unset`.
- Workspace configuration file is stored in `.jj/workspace-config.toml` per workspace.
- Simplified workspace path handling logic.
- Updated documentation and test snapshots to reflect new behavior.

This improves flexibility for users working across multiple workspaces.

Co-authored-by: Eidolon <furyhunter600@gmail.com>
Co-authored-by: ase <adam@sandbergericsson.se>
2025-10-12 14:43:12 +00:00
Yuya Nishihara
26bbda9d73 git: on import, do not ignore absent tracked remote refs
Since "tracked" state doesn't exist in Git, git::import_refs() should ignore
absent->absent "changes". git::export_refs() just works because it compares only
ref targets.
2025-10-11 11:59:28 +00:00
Yuya Nishihara
081f35d986 view: allow setting tracked state to absent remote refs
This will allow us to set up tracking state and push new bookmarks in two steps
#7072.

Absent tracked remote refs are deleted with the corresponding local ref. I
originally considered this rule could be enforced by git::import/export_refs(),
but it seemed weird if absent remote refs were left when the tracking local ref
was deleted by user. Therefore, this invariant is ensured by the view API.

Since "jj bookmark track" cannot track absent remote refs yet, this patch
doesn't have UX changes that should be documented.
2025-10-11 11:59:28 +00:00
Yuya Nishihara
122acd5a7a test_git: compare state of absent RemoteRef
The next patch will allow setting tracked state to absent remote refs.
2025-10-11 11:59:28 +00:00
Defelo
b38dcbb919 ssh-signing: include key in verification result
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-08 13:02:43 +00:00
Martin von Zweigbergk
92e89350fc repo: drop some leading underscores from function names
I don't know what the leading underscores were supposed to indicate
but we don't use them anywhere else.
2025-10-07 10:39:43 +00:00
Theo Buehler
809941c822 lib: fix test_resolve_os for the unix family
On a unix OS which isn't linux, "--when.platform = ['unix']" matches,
so adjust the assertion accordingly. Fixes this test on OpenBSD and
should fix the tests on other unix systems, in particular other *BSDs.
2025-10-06 15:45:00 +00:00
Anton Älgmyr
41837fe930 bisect: Make bisect able to search for first good/bad revision in the range 2025-10-01 22:24:32 +00:00
Yuya Nishihara
c7ffb5d42a view: rename remaining local "tag" functions 2025-09-30 13:51:40 +00:00
Yuya Nishihara
3d4d372b6c view: rename tags() to local_tags(), make it return iterator
This matches the "bookmark" API.
2025-09-30 13:51:40 +00:00
Yuya Nishihara
baf5f1355f op_store: rename tags field to local_tags
I'm going to rename "tag" in the view API to "local_tag". Since the underlying
data structures are split to View and RemoteView, it's not important to add
"local_" prefix. However, I think this change is good for consistency.
2025-09-30 13:51:40 +00:00
Steven Sherry
71ea0d2372 gitignore: don't parse .gitignore comments
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-09-28 14:08:34 +00:00
Yuya Nishihara
744631d2bf cleanup: use method version of str::from_utf8()
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
MSRV is now 1.88.

https://doc.rust-lang.org/stable/std/primitive.str.html#method.from_utf8
2025-09-27 09:26:05 +00:00
Yuya Nishihara
e894882633 git: split reset_head() to inner functions
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This might help skip unneeded operations or extract function that just updates
the Git HEAD.
2025-09-26 03:12:07 +00:00
Martin von Zweigbergk
29991bb6d0 git: avoid an unnecessary clone of a MergedTree
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-09-25 09:42:37 +00:00
Yuya Nishihara
120d492d4e git, op_store: migrate and import "refs/tags/*" as @git remote tags
The migration logic is basically the same as 717d0d3d6d "git: on
deserialize/import/export, copy refs/heads/* to remote named git." Now
git::import_refs() processes bookmarks and tags in the same way.
git::export_refs() is unchanged because we don't have any commands that would
move local tags internally.
2025-09-24 09:09:52 +00:00
Yuya Nishihara
a89680d34b op_store: add remote tags storage and basic accessors
Git-tracking tags will be stored there. I don't have a concrete plan for proper
remote tags support, but I think tags fetched/pushed internally can be recorded
as remote tags.
2025-09-24 09:09:52 +00:00
Yuya Nishihara
0dc1beba12 op_store: make local/remote refs helper generic over RemoteView fields 2025-09-24 09:09:52 +00:00
Yuya Nishihara
aac63636cb op_store: reorganize proto reflecting new RemoteView structure
I'm thinking of adding remote tags table to support tag mutation commands, so I
think it's time to update the storage format. RefTarget is serialized to a list
of alternate terms because we don't need to support legacy formats here.
2025-09-24 09:09:52 +00:00
Ilya Grigoriev
09dea71a15 git-backend: test and make public change id reading from headers
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Having tests illustrates the behavior. Making this public de-duplicates
the code with ERSC. This also allows determining whether a change id
comes from the header or is synthetic.

This is just a nice-to-have for me, we will also duplicate the code
until this is merged (if that happens).
2025-09-23 03:47:15 +00:00
Ilya Grigoriev
cefc0db81b git_subprocess: make sure we do not try to fetch submodules regardless of .gitconfig
This fixes the bug described below.

I have `submodule.recurse=true` set in my .gitconfig. When trying
to fetch repos with submodules (e.g. git/git), I got errors like these:

```console
$ jj git fetch
remote: Enumerating objects: 853, done.
remote: Total 853 (delta 448), reused 439 (delta 413), pack-reused 315 (from 2)
Error: Git process failed: External git program failed:
Could not access submodule 'sha1collisiondetection'
```

This error occured when fetching only, *not* when cloning. It occured
even when there wasn't anything to fetch.

I only tested repositories that never had submodules initialized or
fetched (which would have to be done with Git).
2025-09-22 20:50:50 +00:00
Yuya Nishihara
9a5e2ae02e op_store: remove stale TODO about renamed remote and view state
We aren't going to fix this problem by inserting another indirection, at least
to the view layer.
2025-09-22 00:08:45 +00:00
Martin von Zweigbergk
4f456ec824 merge: add a generic Diff<T> type, use in TreeDiffEntry
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
I think this helps readability a bit. I updated `TreeDiffEntry` and a
few related places. I think there are many other places where we could
use the new type.
2025-09-21 16:16:33 +00:00
Martin von Zweigbergk
452a1a454c cli_util: rename Diff to ContentDiff
I'm about to add a generic `Diff<T>` that's more similar to
`Merge<T>`, so I want to free up the name. It seems better to have
`Diff<T>` and `ContentDiff` than e.g. `GenericDiff<T>` and `Diff` or
having to use qualified imports.
2025-09-21 16:16:33 +00:00
Yuya Nishihara
1d80c19aea revset: leverage trait upcasting in InternalRevset 2025-09-20 01:22:47 +00:00
Yuya Nishihara
46d5555be4 cleanup: leverage trait upcasting, delete as_any*()
This patch also adds .downcast*() wrappers to prevent misuse of as &Any casting.
The compiler wouldn't help detect &Arc<T> as &Any, for example.

https://blog.rust-lang.org/2025/04/03/Rust-1.86.0/#trait-upcasting
2025-09-20 01:22:47 +00:00
Yuya Nishihara
bd2807fdbc store: downcast to implementation type by backend_impl()
It should be safer to restrict the type here.
2025-09-20 01:22:47 +00:00
Yuya Nishihara
819065000e cleanup: use .as_chunks() instead of chunks_exact() 2025-09-19 09:41:32 +00:00
Austin Seipp
419bd51496 cargo: bump MSRV to 1.88
1.90 was just released, so this seems reasonable, and it finally lets us
use let-chains. This includes all the clippy fixups too, and some small
changes suggested by Ilya.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-09-19 01:03:21 +00:00