Skip to content

Commit

Permalink
Update libgit2 to 0.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jul 28, 2015
1 parent c9bbc6e commit 44c5c6b
Show file tree
Hide file tree
Showing 19 changed files with 557 additions and 490 deletions.
6 changes: 4 additions & 2 deletions examples/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern crate rustc_serialize;

use docopt::Docopt;
use git2::build::{RepoBuilder, CheckoutBuilder};
use git2::{RemoteCallbacks, Progress};
use git2::{RemoteCallbacks, Progress, FetchOptions};
use std::cell::RefCell;
use std::io::{self, Write};
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -94,7 +94,9 @@ fn run(args: &Args) -> Result<(), git2::Error> {
print(&mut *state);
});

try!(RepoBuilder::new().remote_callbacks(cb).with_checkout(co)
let mut fo = FetchOptions::new();
fo.remote_callbacks(cb);
try!(RepoBuilder::new().fetch_options(fo).with_checkout(co)
.clone(&args.arg_url, Path::new(&args.arg_path)));
println!("");

Expand Down
13 changes: 7 additions & 6 deletions examples/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extern crate docopt;
extern crate rustc_serialize;

use docopt::Docopt;
use git2::{Repository, RemoteCallbacks, Direction};
use git2::{Repository, RemoteCallbacks, Direction, AutotagOption, FetchOptions};
use std::io::{self, Write};
use std::str;

Expand All @@ -36,7 +36,7 @@ fn run(args: &Args) -> Result<(), git2::Error> {
println!("Fetcing {} for repo", remote);
let mut cb = RemoteCallbacks::new();
let mut remote = try!(repo.find_remote(remote).or_else(|_| {
repo.remote_anonymous(remote, None)
repo.remote_anonymous(remote)
}));
cb.sideband_progress(|data| {
print!("remote: {}", str::from_utf8(data).unwrap());
Expand Down Expand Up @@ -74,16 +74,16 @@ fn run(args: &Args) -> Result<(), git2::Error> {
true
});

remote.set_callbacks(cb);

// Connect to the remote end specifying that we want to fetch information
// from it.
try!(remote.connect(Direction::Fetch));

// Download the packfile and index it. This function updates the amount of
// received data and the indexer stats which lets you inform the user about
// progress.
try!(remote.download(&[]));
let mut fo = FetchOptions::new();
fo.remote_callbacks(cb);
try!(remote.download(&[], Some(&mut fo)));

{
// If there are local objects (we got a thin pack), then tell the user
Expand All @@ -108,7 +108,8 @@ fn run(args: &Args) -> Result<(), git2::Error> {
// commits. This may be needed even if there was no packfile to download,
// which can happen e.g. when the branches have been changed but all the
// needed objects are available locally.
try!(remote.update_tips(None));
try!(remote.update_tips(None, true,
AutotagOption::Unspecified, None));

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion examples/ls-remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn run(args: &Args) -> Result<(), git2::Error> {
let repo = try!(Repository::open("."));
let remote = &args.arg_remote;
let mut remote = try!(repo.find_remote(remote).or_else(|_| {
repo.remote_anonymous(remote, None)
repo.remote_anonymous(remote)
}));

// Connect to the remote and call the printing function for each of the
Expand Down
7 changes: 3 additions & 4 deletions examples/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern crate rustc_serialize;

use std::str;
use docopt::Docopt;
use git2::{Repository, Error, StatusOptions, ErrorCode};
use git2::{Repository, Error, StatusOptions, ErrorCode, SubmoduleIgnore};

#[derive(RustcDecodable)]
struct Args {
Expand Down Expand Up @@ -288,11 +288,10 @@ fn print_short(repo: &Repository, statuses: git2::Statuses) {
//
// TODO: check for GIT_FILEMODE_COMMIT
let status = entry.index_to_workdir().and_then(|diff| {
let ignore = SubmoduleIgnore::Unspecified;
diff.new_file().path_bytes()
.and_then(|s| str::from_utf8(s).ok())
.and_then(|name| repo.find_submodule(name).ok())
}).and_then(|module| {
module.status().ok()
.and_then(|name| repo.submodule_status(name, ignore).ok())
});
if let Some(status) = status {
if status.contains(git2::SUBMODULE_STATUS_WD_MODIFIED) {
Expand Down
6 changes: 0 additions & 6 deletions libgit2-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ libc = "0.1"
[build-dependencies]
pkg-config = "0.3"

[target.i686-apple-darwin.dependencies]
openssl-sys = "0.6.0"
libz-sys = "0.1.0"
[target.x86_64-apple-darwin.dependencies]
openssl-sys = "0.6.0"
libz-sys = "0.1.0"
[target.i686-unknown-linux-gnu.dependencies]
openssl-sys = "0.6.0"
libz-sys = "0.1.0"
Expand Down
3 changes: 2 additions & 1 deletion libgit2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() {
register_dep("OPENSSL");
let has_pkgconfig = Command::new("pkg-config").output().is_ok();

if env::var("LIBSSH2_SYS_USE_PKG_CONFIG").is_ok() {
if env::var("LIBGIT2_SYS_USE_PKG_CONFIG").is_ok() {
if pkg_config::find_library("libgit2").is_ok() {
return
}
Expand Down Expand Up @@ -98,6 +98,7 @@ fn main() {
};
run(cmd.arg("-DBUILD_SHARED_LIBS=OFF")
.arg("-DBUILD_CLAR=OFF")
.arg("-DCURL=OFF")
.arg(&format!("-DCMAKE_BUILD_TYPE={}", profile))
.arg(&format!("-DCMAKE_INSTALL_PREFIX={}", dst.display()))
.arg(&format!("-DCMAKE_C_FLAGS={}", cflags)), "cmake");
Expand Down
Loading

0 comments on commit 44c5c6b

Please sign in to comment.