Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/git2-rs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: libgit2-sys-0.18.0+1.9.0
Choose a base ref
...
head repository: rust-lang/git2-rs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: libgit2-sys-0.18.1+1.9.0
Choose a head ref

Commits on Jan 5, 2025

  1. Copy the full SHA
    7173e50 View commit details
  2. Merge pull request #1117 from ehuss/relnotes-1.9

    Add release notes for 1.9 changes
    ehuss authored Jan 5, 2025
    Copy the full SHA
    8152297 View commit details

Commits on Jan 20, 2025

  1. Add triagebot

    ehuss committed Jan 20, 2025
    Copy the full SHA
    8c18658 View commit details
  2. Merge pull request #1119 from ehuss/triagebot

    Add triagebot
    ehuss authored Jan 20, 2025
    Copy the full SHA
    f095112 View commit details

Commits on Jan 21, 2025

  1. Copy the full SHA
    f0a296c View commit details

Commits on Jan 22, 2025

  1. Copy the full SHA
    f0847fc View commit details
  2. Merge pull request #1120 from divine/patch-1

    fix: prevent crash when repository url is empty
    ehuss authored Jan 22, 2025
    Copy the full SHA
    a3b90cb View commit details

Commits on Jan 25, 2025

  1. Copy the full SHA
    09ad565 View commit details
  2. nit: remove unused import

    vcfxb committed Jan 25, 2025
    Copy the full SHA
    c54f448 View commit details

Commits on Feb 4, 2025

  1. Copy the full SHA
    5e09a91 View commit details
  2. Merge pull request #1123 from MrSubidubi/patch-1

    docs: Update link to libgit2 homepage
    ehuss authored Feb 4, 2025
    Copy the full SHA
    bc646ee View commit details

Commits on Feb 6, 2025

  1. Copy the full SHA
    09bb3a7 View commit details
  2. Merge pull request #1124 from xtexx/clarify-doc

    docs: Document that pushurl_bytes returns null if no push url is set
    ehuss authored Feb 6, 2025
    Copy the full SHA
    7b7be43 View commit details

Commits on Feb 22, 2025

  1. Update url to 2.5.4

    This also resolves the security warning that comes from idna 0.5.0 being
    vulnerable.
    ericswpark committed Feb 22, 2025
    Copy the full SHA
    c6dd1ac View commit details
  2. Merge pull request #1128 from ericswpark/idna-patch

    Update url to min `2.5.4`
    weihanglo authored Feb 22, 2025
    Copy the full SHA
    64017cd View commit details

Commits on Feb 28, 2025

  1. Copy the full SHA
    fb614e0 View commit details
  2. fix formatting

    vlad-anger committed Feb 28, 2025
    Copy the full SHA
    84e39e4 View commit details
  3. Merge pull request #1131 from vlad-anger/expose/git_branch_upstream_m…

    …erge
    
    expose libgit2 `git_branch_upstream_merge`
    weihanglo authored Feb 28, 2025
    Copy the full SHA
    d1ae3b6 View commit details

Commits on Mar 4, 2025

  1. Copy the full SHA
    0088ea0 View commit details

Commits on Mar 10, 2025

  1. Copy the full SHA
    adbbbf4 View commit details
  2. Fix CredentialHelper::add_command

    Fixes #1136
    aibaars committed Mar 10, 2025
    Copy the full SHA
    c776e8d View commit details

Commits on Mar 12, 2025

  1. Copy the full SHA
    4c92a5c View commit details
  2. Merge pull request #1141 from ehuss/patch-lifetime

    Fix lifetimes of outputs for Patch
    weihanglo authored Mar 12, 2025
    Copy the full SHA
    e8c9126 View commit details

Commits on Mar 17, 2025

  1. Fix advapi32 linking on Windows

    ehuss committed Mar 17, 2025
    Copy the full SHA
    892215d View commit details
  2. Merge pull request #1143 from ehuss/fix-windows-advapi32

    Fix advapi32 linking on Windows
    ehuss authored Mar 17, 2025
    Copy the full SHA
    b6d5975 View commit details
  3. Merge pull request #1134 from yuanyan3060/git_index_conflict_get

    Added git_index_conflict_get
    ehuss authored Mar 17, 2025
    Copy the full SHA
    af81314 View commit details
  4. Added index_conflict_remove

    yuanyan3060 authored and ehuss committed Mar 17, 2025
    Copy the full SHA
    c979b22 View commit details
  5. Merge pull request #1133 from yuanyan3060/master

    Added index_conflict_remove
    ehuss authored Mar 17, 2025
    Copy the full SHA
    bce4478 View commit details
  6. Merge pull request #1121 from vcfxb/master

    Remove panic wrapper in tracing callback
    ehuss authored Mar 17, 2025
    Copy the full SHA
    c737cea View commit details
  7. Merge pull request #1118 from qaqland/add-opts

    Add binding for GIT_OPT_SET_CACHE_OBJECT_LIMIT
    ehuss authored Mar 17, 2025
    Copy the full SHA
    10771e4 View commit details
  8. feat(merge): add merge_file_from_index

    MikeJerred authored and ehuss committed Mar 17, 2025
    Copy the full SHA
    2572c23 View commit details
  9. style: fix code formatting

    MikeJerred authored and ehuss committed Mar 17, 2025
    Copy the full SHA
    e80d1ab View commit details
  10. fix: review comments

    MikeJerred authored and ehuss committed Mar 17, 2025
    Copy the full SHA
    742c630 View commit details
  11. Copy the full SHA
    b76c8be View commit details
  12. fix: mark to_raw as unsafe

    MikeJerred authored and ehuss committed Mar 17, 2025
    Copy the full SHA
    e1e933b View commit details
  13. fix: type mismatch error

    MikeJerred authored and ehuss committed Mar 17, 2025
    Copy the full SHA
    3cc3e25 View commit details
  14. Make MergeFileOptions::raw pub(crate)

    For now I feel more comfortable not exposing this unless it is needed.
    ehuss committed Mar 17, 2025
    Copy the full SHA
    8381b72 View commit details
  15. Drop Copy/Clone from git_merge_file_result

    I don't feel comfortable making this copy, since it could accidentally
    lead to creating multiple copies, which could then be confused as the
    memory of these needs to be managed.
    ehuss committed Mar 17, 2025
    Copy the full SHA
    197106b View commit details
  16. Drop lifetime for MergeFileResult

    I feel comfortable not tying the lifetime here, since libgit2 fairly
    clearly keeps only owned data in git_merge_file_result, without any
    pointers to anything outside of it.
    ehuss committed Mar 17, 2025
    Copy the full SHA
    d1b40aa View commit details
  17. Merge pull request #1062 from MikeJerred/master

    Add function: git_merge_file_from_index
    ehuss authored Mar 17, 2025
    Copy the full SHA
    258d3b6 View commit details
  18. Merge pull request #1137 from aibaars/fix-credential-helper

    Fix CredentialHelper::add_command
    ehuss authored Mar 17, 2025
    Copy the full SHA
    1e1687e View commit details
  19. Copy the full SHA
    8980c61 View commit details
  20. Merge pull request #1144 from ehuss/bump-version

    Bump versions of git2 and libgit2-sys
    ehuss authored Mar 17, 2025
    Copy the full SHA
    62d353e View commit details
Showing with 709 additions and 41 deletions.
  1. +73 −0 CHANGELOG.md
  2. +2 −2 Cargo.lock
  3. +3 −3 Cargo.toml
  4. +1 −1 README.md
  5. +5 −0 git2-curl/CHANGELOG.md
  6. +1 −1 git2-curl/Cargo.toml
  7. +32 −0 libgit2-sys/CHANGELOG.md
  8. +1 −1 libgit2-sys/Cargo.toml
  9. +1 −0 libgit2-sys/build.rs
  10. +41 −1 libgit2-sys/lib.rs
  11. +11 −5 src/cred.rs
  12. +88 −0 src/index.rs
  13. +2 −2 src/lib.rs
  14. +221 −1 src/merge.rs
  15. +23 −1 src/opts.rs
  16. +5 −5 src/patch.rs
  17. +4 −2 src/remote.rs
  18. +142 −4 src/repo.rs
  19. +27 −12 src/tracing.rs
  20. +26 −0 triagebot.toml
73 changes: 73 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,78 @@
# Changelog

## 0.20.1 - 2025-03-17
[0.20.0...0.20.1](https://github.com/rust-lang/git2-rs/compare/git2-0.20.0...git2-0.20.1)

### Added

- Added `Repository::branch_upstream_merge()`
[#1131](https://github.com/rust-lang/git2-rs/pull/1131)
- Added `Index::conflict_get()`
[#1134](https://github.com/rust-lang/git2-rs/pull/1134)
- Added `Index::conflict_remove()`
[#1133](https://github.com/rust-lang/git2-rs/pull/1133)
- Added `opts::set_cache_object_limit()`
[#1118](https://github.com/rust-lang/git2-rs/pull/1118)
- Added `Repo::merge_file_from_index()` and associated `MergeFileOptions` and `MergeFileResult`.
[#1062](https://github.com/rust-lang/git2-rs/pull/1062)

### Changed

- The `url` dependency minimum raised to 2.5.4
[#1128](https://github.com/rust-lang/git2-rs/pull/1128)
- Changed the tracing callback to abort the process if the callback panics instead of randomly detecting the panic in some other function.
[#1121](https://github.com/rust-lang/git2-rs/pull/1121)
- Credential helper config (loaded with `CredentialHelper::config`) now checks for helpers that start with something that looks like an absolute path, rather than checking for a `/` or `\` anywhere in the helper string (which resolves an issue if the helper had arguments with `/` or `\`).
[#1137](https://github.com/rust-lang/git2-rs/pull/1137)

### Fixed

- Fixed panic in `Remote::url_bytes` if the url is empty.
[#1120](https://github.com/rust-lang/git2-rs/pull/1120)
- Fixed incorrect lifetimes on `Patch::delta`, `Patch::hunk`, and `Patch::line_in_hunk`. The return values must not outlive the `Patch`.
[#1141](https://github.com/rust-lang/git2-rs/pull/1141)
- Bumped requirement to libgit2-sys 0.18.1, which fixes linking of advapi32 on Windows.
[#1143](https://github.com/rust-lang/git2-rs/pull/1143)


## 0.20.0 - 2025-01-04
[0.19.0...0.20.0](https://github.com/rust-lang/git2-rs/compare/git2-0.19.0...git2-0.20.0)

### Added

- `Debug` is now implemented for `transport::Service`
[#1074](https://github.com/rust-lang/git2-rs/pull/1074)
- Added `Repository::commondir`
[#1079](https://github.com/rust-lang/git2-rs/pull/1079)
- Added `Repository::merge_base_octopus`
[#1088](https://github.com/rust-lang/git2-rs/pull/1088)
- Restored impls for `PartialOrd`, `Ord`, and `Hash` for bitflags types that were inadvertently removed in a prior release.
[#1096](https://github.com/rust-lang/git2-rs/pull/1096)
- Added `CheckoutBuilder::disable_pathspec_match`
[#1107](https://github.com/rust-lang/git2-rs/pull/1107)
- Added `PackBuilder::write`
[#1110](https://github.com/rust-lang/git2-rs/pull/1110)

### Changed

- ❗ Updated to libgit2 [1.9.0](https://github.com/libgit2/libgit2/releases/tag/v1.9.0)
[#1111](https://github.com/rust-lang/git2-rs/pull/1111)
- ❗ Removed the `ssh_key_from_memory` Cargo feature, it was unused.
[#1087](https://github.com/rust-lang/git2-rs/pull/1087)
- ❗ Errors from `Tree::walk` are now correctly reported to the caller.
[#1098](https://github.com/rust-lang/git2-rs/pull/1098)
- ❗ The `trace_set` callback now takes a `&[u8]` instead of a `&str`.
[#1071](https://github.com/rust-lang/git2-rs/pull/1071)
-`Error::last_error` now returns `Error` instead of `Option<Error>`.
[#1072](https://github.com/rust-lang/git2-rs/pull/1072)

### Fixed

- Fixed `OdbReader::read` return value.
[#1061](https://github.com/rust-lang/git2-rs/pull/1061)
- When a credential helper executes a shell command, don't pop open a console window on Windows.
[#1075](https://github.com/rust-lang/git2-rs/pull/1075)

## 0.19.0 - 2024-06-13
[0.18.3...0.19.0](https://github.com/rust-lang/git2-rs/compare/git2-0.18.3...git2-0.19.0)

4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "git2"
version = "0.20.0"
version = "0.20.1"
authors = ["Josh Triplett <josh@joshtriplett.org>", "Alex Crichton <alex@alexcrichton.com>"]
license = "MIT OR Apache-2.0"
readme = "README.md"
@@ -16,11 +16,11 @@ categories = ["api-bindings"]
edition = "2018"

[dependencies]
url = "2.0"
url = "2.5.4"
bitflags = "2.1.0"
libc = "0.2"
log = "0.4.8"
libgit2-sys = { path = "libgit2-sys", version = "0.18.0" }
libgit2-sys = { path = "libgit2-sys", version = "0.18.1" }

[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
openssl-sys = { version = "0.9.45", optional = true }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ libgit2 bindings for Rust.

```toml
[dependencies]
git2 = "0.20.0"
git2 = "0.20.1"
```

## Rust version requirements
5 changes: 5 additions & 0 deletions git2-curl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.21.0 - 2025-01-04
[0.20.0...0.21.0](https://github.com/rust-lang/git2-rs/compare/git2-curl-0.20.0...git2-curl-0.21.0)

- Updated to [git2 0.20.0](../CHANGELOG.md#0200---2025-01-04)

## 0.20.0 - 2024-06-13
[0.19.0...0.20.0](https://github.com/rust-lang/git2-rs/compare/git2-curl-0.19.0...git2-curl-0.20.0)

2 changes: 1 addition & 1 deletion git2-curl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ edition = "2018"

[dependencies]
curl = "0.4.33"
url = "2.0"
url = "2.5.4"
log = "0.4"
git2 = { path = "..", version = "0.20", default-features = false }

32 changes: 32 additions & 0 deletions libgit2-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## 0.18.1+1.9.0 - 2025-03-17
[0.18.0...0.18.1](https://github.com/rust-lang/git2-rs/compare/libgit2-sys-0.18.0+1.9.0...libgit2-sys-0.18.1+1.9.0)

### Added

- Added binding for `git_branch_upstream_merge`
[#1131](https://github.com/rust-lang/git2-rs/pull/1131)
- Added bindings for `git_merge_file_options` and `git_merge_file_result`, `git_merge_file_options_init`, `git_merge_file_from_index`, `git_merge_file_result_free`, and updated `git_merge_file_flag_t`.
[#1062](https://github.com/rust-lang/git2-rs/pull/1062)

### Fixed

- Fixed linking to advapi32 on Windows for recent nightly versions of Rust.
[#1143](https://github.com/rust-lang/git2-rs/pull/1143)

## 0.18.0+1.9.0 - 2025-01-04
[0.16.2...0.17.0](https://github.com/rust-lang/git2-rs/compare/libgit2-sys-0.17.0+1.8.1...libgit2-sys-0.18.0+1.9.0)

### Added

- Added bindings for `git_repository_commondir`
[#1079](https://github.com/rust-lang/git2-rs/pull/1079)
- Added bindings for `git_merge_base_octopus`
[#1088](https://github.com/rust-lang/git2-rs/pull/1088)

### Changed

- ❗ Updated to libgit2 [1.9.0](https://github.com/libgit2/libgit2/releases/tag/v1.9.0)
[#1111](https://github.com/rust-lang/git2-rs/pull/1111)
- ❗ Removed the `ssh_key_from_memory` Cargo feature, it was unused.
[#1087](https://github.com/rust-lang/git2-rs/pull/1087)

## 0.17.0+1.8.1 - 2024-06-13
[0.16.2...0.17.0](https://github.com/rust-lang/git2-rs/compare/libgit2-sys-0.16.2+1.7.2...libgit2-sys-0.17.0+1.8.1)

2 changes: 1 addition & 1 deletion libgit2-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libgit2-sys"
version = "0.18.0+1.9.0"
version = "0.18.1+1.9.0"
authors = ["Josh Triplett <josh@joshtriplett.org>", "Alex Crichton <alex@alexcrichton.com>"]
links = "git2"
build = "build.rs"
1 change: 1 addition & 0 deletions libgit2-sys/build.rs
Original file line number Diff line number Diff line change
@@ -252,6 +252,7 @@ The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VEN
println!("cargo:rustc-link-lib=ole32");
println!("cargo:rustc-link-lib=crypt32");
println!("cargo:rustc-link-lib=secur32");
println!("cargo:rustc-link-lib=advapi32");
}

if target.contains("apple") {
42 changes: 41 additions & 1 deletion libgit2-sys/lib.rs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
// This is required to link libz when libssh2-sys is not included.
extern crate libz_sys as libz;

use libc::{c_char, c_int, c_uchar, c_uint, c_void, size_t};
use libc::{c_char, c_int, c_uchar, c_uint, c_ushort, c_void, size_t};
#[cfg(feature = "ssh")]
use libssh2_sys as libssh2;
use std::ffi::CStr;
@@ -1361,6 +1361,26 @@ pub struct git_merge_options {
pub file_flags: u32,
}

#[repr(C)]
pub struct git_merge_file_options {
pub version: c_uint,
pub ancestor_label: *const c_char,
pub our_label: *const c_char,
pub their_label: *const c_char,
pub favor: git_merge_file_favor_t,
pub flags: u32,
pub marker_size: c_ushort,
}

#[repr(C)]
pub struct git_merge_file_result {
pub automergeable: c_uint,
pub path: *const c_char,
pub mode: c_uint,
pub ptr: *const c_char,
pub len: size_t,
}

git_enum! {
pub enum git_merge_flag_t {
GIT_MERGE_FIND_RENAMES = 1 << 0,
@@ -1390,6 +1410,8 @@ git_enum! {
GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL = 1 << 5,
GIT_MERGE_FILE_DIFF_PATIENCE = 1 << 6,
GIT_MERGE_FILE_DIFF_MINIMAL = 1 << 7,
GIT_MERGE_FILE_STYLE_ZDIFF3 = 1 << 8,
GIT_MERGE_FILE_ACCEPT_CONFLICTS = 1 << 9,
}
}

@@ -3018,6 +3040,11 @@ extern "C" {
repo: *mut git_repository,
refname: *const c_char,
) -> c_int;
pub fn git_branch_upstream_merge(
out: *mut git_buf,
repo: *mut git_repository,
refname: *const c_char,
) -> c_int;

// index
pub fn git_index_version(index: *mut git_index) -> c_uint;
@@ -3390,6 +3417,8 @@ extern "C" {
their_tree: *const git_tree,
opts: *const git_merge_options,
) -> c_int;
pub fn git_merge_file_options_init(opts: *mut git_merge_file_options, version: c_uint)
-> c_int;
pub fn git_repository_state_cleanup(repo: *mut git_repository) -> c_int;

// merge analysis
@@ -3538,6 +3567,17 @@ extern "C" {
input_array: *const git_oid,
) -> c_int;

pub fn git_merge_file_from_index(
out: *mut git_merge_file_result,
repo: *mut git_repository,
ancestor: *const git_index_entry,
ours: *const git_index_entry,
theirs: *const git_index_entry,
opts: *const git_merge_file_options,
) -> c_int;

pub fn git_merge_file_result_free(file_result: *mut git_merge_file_result);

// pathspec
pub fn git_pathspec_free(ps: *mut git_pathspec);
pub fn git_pathspec_match_diff(
16 changes: 11 additions & 5 deletions src/cred.rs
Original file line number Diff line number Diff line change
@@ -299,7 +299,7 @@ impl CredentialHelper {

if cmd.starts_with('!') {
self.commands.push(cmd[1..].to_string());
} else if cmd.contains("/") || cmd.contains("\\") {
} else if is_absolute_path(cmd) {
self.commands.push(cmd.to_string());
} else {
self.commands.push(format!("git credential-{}", cmd));
@@ -481,6 +481,12 @@ impl CredentialHelper {
}
}

fn is_absolute_path(path: &str) -> bool {
path.starts_with('/')
|| path.starts_with('\\')
|| cfg!(windows) && path.chars().nth(1).is_some_and(|x| x == ':')
}

#[cfg(test)]
mod test {
use std::env;
@@ -578,13 +584,13 @@ echo username=c
return;
} // shell scripts don't work on Windows
let td = TempDir::new().unwrap();
let path = td.path().join("git-credential-script");
let path = td.path().join("git-credential-some-script");
File::create(&path)
.unwrap()
.write(
br"\
#!/bin/sh
echo username=c
echo username=$1
",
)
.unwrap();
@@ -596,14 +602,14 @@ echo username=c
env::set_var("PATH", &env::join_paths(paths).unwrap());

let cfg = test_cfg! {
"credential.https://example.com.helper" => "script",
"credential.https://example.com.helper" => "some-script \"value/with\\slashes\"",
"credential.helper" => "!f() { echo username=a; echo password=b; }; f"
};
let (u, p) = CredentialHelper::new("https://example.com/foo/bar")
.config(&cfg)
.execute()
.unwrap();
assert_eq!(u, "c");
assert_eq!(u, "value/with\\slashes");
assert_eq!(p, "b");
}

Loading