Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo: enable vendored-libgit2, document how to properly dynamically link libgit2 #4163

Merged
merged 1 commit into from
Jul 28, 2024

Conversation

ilyagr
Copy link
Contributor

@ilyagr ilyagr commented Jul 26, 2024

This PR succeeds #4120.

This changes less than it seems. Our CI builds already mostly linked a vendored copy of libgit2. This is because before this commit, it turns out that git2 could link libgit2 either statically or dynamically based on whether it could find a version of libgit2 it liked to link dynamically. Our CI builds usually did not provide such a version AFAIK.

This made the kind of binary cargo install would produce unpredictable and may have contributed to #2896. I was once very surprised when I did brew upgrade libgit2 and then
cargo build --release suddenly switched from building dynamically linked jj to the vendored version.

Instead, if a packager wants to link libgit2 dynamically, they should set an environment variable, as described inside the diff of this commit. I also think we should recommend static linking as git2 is quite picky about the versions of libgit2 it supports. See also rust-lang/git2-rs#1073

This might be related to #4115.

Also cc #4080, though I think this is orthogonal to upgrading out git2 version.

@ilyagr ilyagr force-pushed the vendor-libgit2-2 branch from 1091f79 to 67cadf7 Compare July 26, 2024 02:16
@ilyagr ilyagr marked this pull request as ready for review July 26, 2024 02:20
@ilyagr ilyagr force-pushed the vendor-libgit2-2 branch from 67cadf7 to 3d02b94 Compare July 26, 2024 02:33
Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm not a big fan of static linking, but) this should be better than ./configure-like auto detection.

Cargo.toml Show resolved Hide resolved
…link libgit2

This changes less than it seems. Our CI builds already mostly linked a vendored
copy of libgit2. This is because before this commit, it turns out that `git2`
could link `libgit2` *either* statically or dynamically based on whether it could
find a version of libgit2 it liked to link dynamically. Our CI builds usually did
not provide such a version AFAIK.

This made the kind of binary `cargo install` would produce unpredictable and may
have contributed to jj-vcs#2896.  I was once very surprised when I did `brew upgrade libgit2` and then
`cargo build --release` suddenly switched from building dynamically linked `jj` to the vendored version.

Instead, if a packager wants to link `libgit2` dynamically, they should set an
environment variable, as described inside the diff of this commit. I also think
we should recommend static linking as `git2` is quite picky about the versions of
`libgit2` it supports. See also rust-lang/git2-rs#1073

This might be related to jj-vcs#4115.
@ilyagr ilyagr force-pushed the vendor-libgit2-2 branch from 3d02b94 to 96300fb Compare July 28, 2024 01:24
Cargo.toml Show resolved Hide resolved
@ilyagr ilyagr merged commit ce29824 into jj-vcs:main Jul 28, 2024
17 checks passed
@ilyagr ilyagr deleted the vendor-libgit2-2 branch July 28, 2024 19:51
@ilyagr ilyagr mentioned this pull request Jul 28, 2024
4 tasks
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Aug 15, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [martinvonz/jj](https://github.com/martinvonz/jj) | minor | `v0.19.0` -> `v0.20.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>martinvonz/jj (martinvonz/jj)</summary>

### [`v0.20.0`](https://github.com/martinvonz/jj/releases/tag/v0.20.0)

[Compare Source](jj-vcs/jj@v0.19.0...v0.20.0)

##### Note to packagers

-   `jj` now links `libgit2` statically by default. To use dynamic linking, you
    need to set the environment variable `LIBGIT2_NO_VENDOR=1` while compiling.
    ([#&#8203;4163](jj-vcs/jj#4163))

##### Breaking changes

-   `jj rebase --skip-empty` has been renamed to `jj rebase --skip-emptied`

-   `jj backout --revision` has been renamed to `jj backout --revisions`.
    The short alias `-r` is still supported.

-   [The default `immutable_heads()` set](docs/config.md#set-of-immutable-commits)
    now includes `untracked_remote_branches()` with the assumption that untracked
    branches aren't managed by you. Therefore, untracked branches are no longer
    displayed in `jj log` by default.

-   Updated defaults for graph node symbol templates `templates.log_node` and
    `templates.op_log_node`.

-   [The "fileset" language](docs/filesets.md) is now enabled by default. It can
    still be disable by setting `ui.allow-filesets=false`.

-   On `jj git fetch`/`import`, commits referred to by `HEAD@git` are no longer
    preserved. If a checked-out named branch gets deleted locally or remotely, the
    corresponding commits will be abandoned.

-   `jj --at-op=@&#8203;` no longer merges concurrent operations if explicitly specified.

-   `jj obslog -p` no longer shows diffs at non-partial squash operations.
    Previously, it showed the same diffs as the second predecessor.

##### Deprecations

-   The original configuration syntax for `jj fix` is now deprecated in favor of
    one that allows defining multiple tools that can affect different filesets.
    These can be used in combination for now. See `jj help fix` for details.

##### New features

-   External diff tools can now be configured to invoke the tool on each file
    individually instead of being passed a directory by setting
    `merge-tools.$TOOL.diff-invocation-mode="file-by-file"` in config.toml.

-   In git diffs, word-level hunks are now highlighted with underline. See [diff
    colors and styles](docs/config.md#diff-colors-and-styles) for customization.

-   New `.diff().<format>()` commit template methods are added. They can be used
    in order to show diffs conditionally. For example,
    `if(current_working_copy, diff.summary())`.

-   `jj git clone` and `jj git init` with an existing git repository adds the
    default branch of the remote as repository settings for
    `revset-aliases."trunk()"`.\`

-   `jj workspace forget` now abandons the workspace's working-copy commit if it
    was empty.

-   `jj backout` now includes the backed out commit's subject in the new commit
    message.

-   `jj backout` can now back out multiple commits at once.

-   `jj git clone some/nested/path` now creates the full directory tree for
    nested destination paths if they don't exist.

-   String patterns now support case‐insensitive matching by suffixing any
    pattern kind with `-i`. `mine()` uses case‐insensitive matching on your email
    address unconditionally. Only ASCII case folding is currently implemented,
    but this will likely change in the future.

-   String patterns now support `regex:"pattern"`.

-   New `tracked_remote_branches()` and `untracked_remote_branches()` revset
    functions can be used to select tracked/untracked remote branches.

-   The `file()` revset function now accepts fileset as argument.

-   New `diff_contains()` revset function can be used to search diffs.

-   New command `jj operation diff` that can compare changes made between two
    operations.

-   New command `jj operation show` that can show the changes made in a single
    operation.

-   New config setting `git.private-commits` to prevent commits from being pushed.

-   [The default commit description template](docs/config.md#default-description)
    can now be configured by `templates.draft_commit_description`.

-   `jj fix` can now be configured to run different tools on different filesets.
    This simplifies the use case of configuring code formatters for specific file
    types. See `jj help fix` for details.

-   Added revset functions `author_date` and `committer_date`.

-   `jj describe` can now update the description of multiple commits.

##### Fixed bugs

-   `jj status` will show different messages in a conflicted tree, depending
    on the state of the working commit. In particular, if a child commit fixes
    a conflict in the parent, this will be reflected in the hint provided
    by `jj status`

-   `jj diff --git` no longer shows the contents of binary files.

-   Windows binaries no longer require `vcruntime140.dll` to be installed
    (normally through Visual Studio.)

-   On quit, the builtin pager no longer waits for all outputs to be discarded.

-   `jj branch rename` no longer shows a warning in colocated repos.

##### Contributors

Thanks to the people who made this release happen!

-   Anton Älgmyr ([@&#8203;algmyr](https://github.com/algmyr))
-   Austin Seipp ([@&#8203;thoughtpolice](https://github.com/thoughtpolice))
-   Benjamin Tan ([@&#8203;bnjmnt4n](https://github.com/bnjmnt4n))
-   Daniel Ploch ([@&#8203;torquestomp](https://github.com/torquestomp))
-   Danny Hooper ([@&#8203;hooper](https://github.com/hooper))
-   Emily ([@&#8203;emilazy](https://github.com/emilazy))
-   Essien Ita Essien ([@&#8203;essiene](https://github.com/essiene))
-   Erich Gubler ([@&#8203;ErichDonGubler](https://github.com/ErichDonGubler))
-   Fedor Sheremetyev ([@&#8203;sheremetyev](https://github.com/sheremetyev))
-   Ilya Grigoriev ([@&#8203;ilyagr](https://github.com/ilyagr))
-   Jonathan Tan ([@&#8203;jonathantanmy](https://github.com/jonathantanmy))
-   Julien Vincent ([@&#8203;julienvincent](https://github.com/julienvincent))
-   Martin von Zweigbergk ([@&#8203;martinvonz](https://github.com/martinvonz))
-   Matt Kulukundis ([@&#8203;fowles](https://github.com/fowles))
-   Matt Stark ([@&#8203;matts1](https://github.com/matts1))
-   mlcui ([@&#8203;mlcui-corp](https://github.com/mlcui-corp))
-   Philip Metzger ([@&#8203;PhilipMetzger](https://github.com/PhilipMetzger))
-   Scott Taylor ([@&#8203;scott2000](https://github.com/scott2000))
-   Skyler Grey ([@&#8203;Minion3665](https://github.com/Minion3665))
-   Stephen Jennings ([@&#8203;jennings](https://github.com/jennings))
-   Tim Janik ([@&#8203;tim-janik](https://github.com/tim-janik))
-   Vincent Ging Ho Yim ([@&#8203;cenviity](https://github.com/cenviity))
-   Vladimír Čunát ([@&#8203;vcunat](https://github.com/vcunat))
-   Vladimir ([@&#8203;0xdeafbeef](https://github.com/0xdeafbeef))
-   Yuya Nishihara ([@&#8203;yuja](https://github.com/yuja))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants