Commit graph

110 commits

Author SHA1 Message Date
Yuya Nishihara
b9317da0f8 cli: enable glob string matching globally
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
The goal of this change is to unify defaults of string patterns in revsets and
command arguments. Glob is a good default because it's largely the same as exact
matching, and we can easily express substring patterns with globs.

The hint for "jj git fetch -b<glob>" is deleted since exact:<glob> is now
required in order to trigger the error.

This patch also updates help of clone/fetch --branch patterns. Glob and operator
support in refspecs is limited.
2025-12-15 04:27:32 +00:00
xtqqczze
7c89dc3d23 refactor: remove non-binding let
Follow-up https://github.com/jj-vcs/jj/pull/8271
2025-12-11 19:16:16 +00:00
Yuya Nishihara
6ec1c8e7d5 settings: parse auto-track-bookmarks as string matcher expressions
The settings field is now wrapped in Option because [remotes.<name>] may have
multiple fields, and some of them can be omitted.
2025-12-10 11:23:58 +00:00
Yuya Nishihara
406940a1fb cli: git clone: fix cleanup to ignore missing .jj and .git directories
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
fs::remove_dir_all() expects that the specified directory exists.

Fixes #8208
2025-12-04 11:55:28 +00:00
Yuya Nishihara
36143b093e git: add native support for negative fetch patterns
The default patterns are still saved to and loaded from .git/config. Maybe we
can add default fetch patterns to jj's configuration, but I'm not sure whether
we should deprecate .git/config fallback.
2025-12-03 08:12:58 +00:00
Yuya Nishihara
d504ac9482 cli: warn only unmatched exact patterns of cloned bookmarks, use remote default
Since the specified patterns are no longer guaranteed to match at least one
remote branch, the default (remote) branch is taken into account if exact
patterns match nothing. I think this is better because `-b glob:*` is now
identical to the default.
2025-12-02 10:56:39 +00:00
Yuya Nishihara
57cd7842c0 tests: don't create new identical commit in test_git_clone_branch()
It's important in this test that "feature1" points to a different commit than
"main".
2025-12-02 10:56:39 +00:00
Ilya Grigoriev
f0b0171bc5 deps: update gix, test change 2025-11-26 01:14:58 +00:00
Ilya Grigoriev
4b0f493abb test_git_clone: update test to prepare for gitoxide update
The next version of gix would pass invalid port number and
jj would pass the URL to the git binary, resulting in a
different error.
2025-11-26 01:14:58 +00:00
Steve Klabnik
5b3aa51140 docs: jj-vcs.github.io -> jj-vcs.dev
As a follow-up to #8115, this moves all references in the codebase to use the new website.

I didn't update the older CHANGELOG entries because I figured they're intended
to be immutable.
2025-11-26 00:36:39 +00:00
Remo Senekowitsch
0bb55c6252 config: deprecate git.push-new-bookmarks 2025-11-22 07:09:29 +00:00
Remo Senekowitsch
5ada0f7ff2 config: deprecate git.auto-local-bookmark
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-11-21 05:15:55 +00:00
Remo Senekowitsch
e4d45dda34 tests: replace auto-local-bookmark with auto-track-bookmarks
This paves the way to deprecate `git.auto-local-bookmark` without
adding lots of deprecation warnings to test output snapshots.

The behavior of some tests is slightly changed, because
auto-track-bookmarks also tracks bookmarks that were created locally.
I think it just shows up in output snapshots as absent-tracked
bookmarks, without affecting what the test is about.
2025-11-21 05:15:55 +00:00
Remo Senekowitsch
4216aa6758 config: add remotes.<name>.auto-track-bookmarks
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 configuration allows users to express a set of bookmarks that
should be automatically tracked when first encountered. This includes
on clone, fetch, create and set.

Until now, the configuration values `git.push-new-bookmarks` and
`git.auto-local-bookmark` fulfilled parts of those use cases. However,
both options represent an "all or nothing" approach. By turning them on,
users risk tracking and pushing more bookmarks than desired.

By using a bookmark pattern, users can express that they want to
auto-track bookmarks that belong to them (e.g. `glob:my-name/*`).
2025-11-18 15:10:56 +00:00
Yuya Nishihara
34b8191c9f cli: tests: let TestEnvironment store extra env vars in OsString
We don't need to support variables in arbitrary encoding, but it's simpler to
just accept any OsString inputs.
2025-10-22 14:46:24 +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
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
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
Ivan Petkov
3cb62c1e51 cli: fix fetching all tags during jj git clone
By default, `git clone` will fetch all tags (same as `git clone
--tags`), but since we perform a clone by creating a remote first then
fetching it, we have to be a little smarter and keep track of when we're
doing a clone so that we ensure all tags are fetched.

`git clone --no-tags` will skip fetching tags at all, and so this is
also the now the behavior of `jj git clone --fetch-tags none`

Closes #4682
2025-08-17 15:48:36 +00:00
Ivan Petkov
b5b259ad97 cli: refactor test_git_clone_tags to include tags 2025-08-17 15:48:36 +00:00
Ivan Petkov
dc5056ac91 cli: git clone: support --fetch-tags 2025-08-08 15:44:22 +00:00
Austin Seipp
afb1c1446d git: add git.colocate to colocate repos by default
Most users colocate all of their repositories or none of them. A config
option is more convenient in that situation.

There are also plans to make colocated repos the default. This change
paves the way to flip the default easily.

Closes #2507.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-08-08 07:08:46 +00:00
Martin von Zweigbergk
377642004f cli: print warning about git clean -fdx when creating colocated repo
We hear every now and then from users who have run `git clean -fdx`
and accidentally delete their repo. Let's at least warn users about it
when the create a colocated repo.

We could perhaps allow the `.jj/` directory to be inside a `.git/`
directory like Sapling does, but that seems a little ugly and it's a
larger change.
2025-07-28 17:18:49 +00:00
Austin Seipp
ba24140f1d cli, lib: move to Rust 2024 language edition
This applies a `cargo fmt` and fixes clippy lints to keep the build
properly working.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-07-28 17:05:41 +00:00
Yuya Nishihara
42a2a2dd95 repo: store commit predecessors in Operation object
There are two major goals:
1. garbage-collect predecessor commits referenced by immutable commits.
2. show operations alongside predecessors in "jj evolog".

The predecessors field will be removed from the Commit object. Maybe we can
also remove (writer side of) the extras table from GitBackend.

"jj evolog" will traverse the operation history to build an evolution
graph. This will be slower than the current implementation, but it seems
tolerable for mid-size repository stored in a local disk.

    (when the page cache is warm)
    % time jj op log -T'"."' --no-graph | wc -c
    50459
    jj op log -T'"."' --no-graph  0.12s user 0.31s system 103% cpu 0.418 total

Suppose we're interested in recent modifications, the traversal can often be
terminate early. I also have an idea for indexing originating operations.
https://github.com/jj-vcs/jj/pull/6405

For old operations which didn't record predecessors, "jj evolog" will fall back
to commit.predecessor_ids(). That's why commit_predecessors is Option<_>.
2025-05-26 10:23:29 +00:00
Yuya Nishihara
dd33f9ae08 cli: git clone: add config to not track default remote bookmark
Since jj operates in detached HEAD state, a tracking bookmark isn't technically
needed in order to check out a commit. I usually employ this and delete
unmanaged local bookmarks after cloning repository. This option will automate
the setup.
2025-05-15 09:08:07 +00:00
Yuya Nishihara
2ac5ba0c18 cli: git clone: include "tracked" default bookmark in stats output
Since the default remote bookmark is tracked at the end of "jj git clone"
command, it's probably better to show that in the stats output. I originally
implemented it the other way because "git clone --no-checkout" wouldn't create a
local bookmark. However, the tracking bookmark is unrelated to the check-out
state in "jj", so I think it's okay to set up tracking within the "fetch"
transaction.
2025-05-15 09:08:07 +00:00
Yuya Nishihara
2d79c6431d templater: introduce newtype to format ref/remote name in revset syntax
This is the last part of the series 02722eae54 "view: port bookmark/tag name
types to RefName/RemoteName." Templater doesn't use these name types internally
because we wouldn't gain much type safety in template language.

The return type of .remote() is changed to Option<RefSymbol>. An empty symbol is
rendered with quotes, so it would be weird if local_bookmark.remote() returned
an empty RefSymbol.
2025-05-13 23:54:47 +00:00
Martin von Zweigbergk
acd824269f git: write change-id header by default
We haven't had any reports of problems from people who opted in. Since
it's early in the release cycle now, let's now test it on everyone who
builds from head, so we get almost a month of testing from those
people before it's enabled by default in a released version.

This impacts lots of test cases because the change-id header is added
to the Git commit. Most are uninteresting. `test_git_fetch` now sees
some divergent changes where it used to see only divergent bookmarks,
which makes sense.
2025-05-08 23:05:38 +00:00
Emily
1f1440d334 tests: rename test_git_clone_with_depth{_subprocess =>} 2025-05-07 19:29:20 +00:00
Emily
adcc1de466 tests: remove obsolete insta::allow_duplicates! blocks 2025-05-07 19:29:20 +00:00
Emily
d2a8160a7a tests: remove obsolete git2 branches 2025-05-07 19:29:20 +00:00
Emily
2fec09ac60 tests: remove obsolete helpers 2025-05-07 19:29:20 +00:00
Emily
e942744f84 tests: deparameterize Git remote tests 2025-05-07 19:29:20 +00:00
Emily
f3de3858ef git: remove git.subprocess setting 2025-05-07 19:29:20 +00:00
Emily
af67d1d8c4 git: work around gix global remote configuration issue
Closes: #6324
2025-04-13 13:55:09 +00:00
Emily
045b17e38e tests: test behaviour of global Git remote configuration 2025-04-13 13:55:09 +00:00
Emily
333d47f5e5 git: add deprecation warnings for git.subprocess 2025-04-08 10:36:46 +00:00
Emily
370c624518 tests: add TestEnvironment::with_git_subprocess helper 2025-04-04 09:50:20 +00:00
Robin Stocker
0456701e18 cli: Print @ and @- in status and print_updated_working_copy_stats
This helps newcomers learn/remember what @ and @- stand for.
2025-03-31 11:57:04 +00:00
Yuya Nishihara
a36bf18a57 tests: port test_git_clone.rs to TestWorkDir API
In test_git_clone.rs, it's common to execute "jj git clone" or do file operation
at the root directory. This patch adds root_dir: &TestWorkDir references for
that reason. We might want to somehow merge root_dir and test_env later.
2025-03-21 01:19:20 +00:00
Emily
cce229d914 config: warn on unsupported git.subprocess = false 2025-03-16 06:07:28 +00:00
Emily
a56b78bdb6 git: make git2 support optional
This helps us prepare for removing the functionality down the line and
makes things easier for people building or packaging their own Jujutsu.
2025-03-16 06:07:28 +00:00
Baltasar Dinis
4c5800ac4a cli/tests: port test_git_clone to gitoxide 2025-03-05 05:39:19 +00:00
Aleksey Kuznetsov
cfcd034879 docs: Add pointers to usage of jj help -k <keyword>
Relates to #5306
2025-02-28 06:52:52 +00:00
Yuya Nishihara
6c71f3cbf2 git: use RemoteRefSymbolBuf to represent RefName::RemoteBranch variant
This also changes the formatting to use revset compatible form.
2025-02-26 03:17:45 +00:00
Yuya Nishihara
7fa8420908 tests: resolve directory path to run_jj_in() relative to env_root
Suppose we'll add test_env.init_workspace(path) or something, this will probably
make sense.
2025-02-25 15:40:14 +00:00
Yuya Nishihara
28803eef94 tests: rewrite remaining callers of jj_cmd() to use run_jj_in/with() 2025-02-25 15:40:14 +00:00
Yuya Nishihara
3193513049 tests: migrate snapshot users of jj_cmd_ok() to run_jj_in()
These callers were mostly substituted mechanically, then fixed up formatting.
2025-02-24 15:39:11 +00:00
Yuya Nishihara
cdcc777730 tests: migrate snapshot users of jj_cmd_success() to run_jj_in()
These callers were mostly substituted mechanically, then fixed up minor
formatting and name errors.
2025-02-23 13:34:17 +00:00