Update to 1.4.1
Signed-off-by: Igor Raits <igor.raits@gmail.com>
This commit is contained in:
parent
2dcfd91312
commit
392736b607
1
.gitignore
vendored
1
.gitignore
vendored
@ -38,3 +38,4 @@
|
|||||||
/libgit2-1.0.1.tar.gz
|
/libgit2-1.0.1.tar.gz
|
||||||
/libgit2-1.1.0.tar.gz
|
/libgit2-1.1.0.tar.gz
|
||||||
/libgit2-1.3.0.tar.gz
|
/libgit2-1.3.0.tar.gz
|
||||||
|
/libgit2-1.4.1.tar.gz
|
||||||
|
@ -1,76 +0,0 @@
|
|||||||
From d62e44cb8218840a0291fb5fbb7c5106e1e35a12 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Segev Finer <segev@codeocean.com>
|
|
||||||
Date: Mon, 3 Jun 2019 18:35:08 +0300
|
|
||||||
Subject: [PATCH] checkout: Fix removing untracked files by path in
|
|
||||||
subdirectories
|
|
||||||
|
|
||||||
The checkout code didn't iterate into a subdir if it didn't match the
|
|
||||||
pathspec, but since the pathspec might match files in the subdir we
|
|
||||||
should recurse into it (In contrast to gitignore handling).
|
|
||||||
|
|
||||||
Fixes #5089
|
|
||||||
---
|
|
||||||
src/checkout.c | 9 +++++++--
|
|
||||||
tests/checkout/head.c | 26 ++++++++++++++++++++++++++
|
|
||||||
2 files changed, 33 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/checkout.c b/src/checkout.c
|
|
||||||
index f0dd736dc..59ff873dd 100644
|
|
||||||
--- a/src/checkout.c
|
|
||||||
+++ b/src/checkout.c
|
|
||||||
@@ -371,8 +371,13 @@ static int checkout_action_wd_only(
|
|
||||||
if (!git_pathspec__match(
|
|
||||||
pathspec, wd->path,
|
|
||||||
(data->strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH) != 0,
|
|
||||||
- git_iterator_ignore_case(workdir), NULL, NULL))
|
|
||||||
- return git_iterator_advance(wditem, workdir);
|
|
||||||
+ git_iterator_ignore_case(workdir), NULL, NULL)) {
|
|
||||||
+
|
|
||||||
+ if (wd->mode == GIT_FILEMODE_TREE)
|
|
||||||
+ return git_iterator_advance_into(wditem, workdir);
|
|
||||||
+ else
|
|
||||||
+ return git_iterator_advance(wditem, workdir);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/* check if item is tracked in the index but not in the checkout diff */
|
|
||||||
if (data->index != NULL) {
|
|
||||||
diff --git a/tests/checkout/head.c b/tests/checkout/head.c
|
|
||||||
index 799123086..5b3a034e7 100644
|
|
||||||
--- a/tests/checkout/head.c
|
|
||||||
+++ b/tests/checkout/head.c
|
|
||||||
@@ -109,6 +109,32 @@ void test_checkout_head__do_not_remove_untracked_file_in_subdir(void)
|
|
||||||
cl_assert(git_path_isfile("testrepo/tracked/subdir/untracked"));
|
|
||||||
}
|
|
||||||
|
|
||||||
+void test_checkout_head__do_remove_untracked_paths(void)
|
|
||||||
+{
|
|
||||||
+ git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
|
||||||
+ git_index *index;
|
|
||||||
+ char *paths[] = {"tracked/untracked"};
|
|
||||||
+
|
|
||||||
+ cl_git_pass(p_mkdir("testrepo/tracked", 0755));
|
|
||||||
+ cl_git_pass(p_mkdir("testrepo/tracked/subdir", 0755));
|
|
||||||
+ cl_git_mkfile("testrepo/tracked/tracked", "tracked\n");
|
|
||||||
+ cl_git_mkfile("testrepo/tracked/untracked", "untracked\n");
|
|
||||||
+
|
|
||||||
+ cl_git_pass(git_repository_index(&index, g_repo));
|
|
||||||
+ cl_git_pass(git_index_add_bypath(index, "tracked/tracked"));
|
|
||||||
+ cl_git_pass(git_index_write(index));
|
|
||||||
+
|
|
||||||
+ git_index_free(index);
|
|
||||||
+
|
|
||||||
+ opts.checkout_strategy = GIT_CHECKOUT_FORCE | GIT_CHECKOUT_REMOVE_UNTRACKED;
|
|
||||||
+ opts.paths.strings = paths;
|
|
||||||
+ opts.paths.count = 1;
|
|
||||||
+ cl_git_pass(git_checkout_head(g_repo, &opts));
|
|
||||||
+
|
|
||||||
+ cl_assert(git_path_isfile("testrepo/tracked/tracked"));
|
|
||||||
+ cl_assert(!git_path_isfile("testrepo/tracked/untracked"));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void test_checkout_head__do_remove_tracked_subdir(void)
|
|
||||||
{
|
|
||||||
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
10
libgit2.spec
10
libgit2.spec
@ -6,7 +6,7 @@
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: libgit2
|
Name: libgit2
|
||||||
Version: 1.3.0
|
Version: 1.4.1
|
||||||
Release: %autorelease
|
Release: %autorelease
|
||||||
Summary: C implementation of the Git core methods as a library with a solid API
|
Summary: C implementation of the Git core methods as a library with a solid API
|
||||||
License: GPLv2 with exceptions
|
License: GPLv2 with exceptions
|
||||||
@ -63,24 +63,22 @@ rm -vr deps
|
|||||||
-DUSE_SHA1=HTTPS \
|
-DUSE_SHA1=HTTPS \
|
||||||
-DUSE_HTTPS=OpenSSL \
|
-DUSE_HTTPS=OpenSSL \
|
||||||
-DUSE_NTLMCLIENT=OFF \
|
-DUSE_NTLMCLIENT=OFF \
|
||||||
%if %{without libssh2}
|
-DUSE_SSH=%[0%{?with_libssh2} ? "ON" : "OFF"] \
|
||||||
-DUSE_SSH=OFF \
|
|
||||||
%endif
|
|
||||||
%{nil}
|
%{nil}
|
||||||
%cmake_build
|
%cmake_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%cmake_install
|
%cmake_install
|
||||||
# Include previous ABI version for temporary binary compatibility
|
# Include previous ABI version for temporary binary compatibility
|
||||||
cp -a %{_libdir}/libgit2.so.1.1* %{buildroot}%{_libdir}
|
cp -a %{_libdir}/libgit2.so.1.3* %{buildroot}%{_libdir}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
%ctest
|
%ctest
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%license COPYING
|
%license COPYING
|
||||||
|
%{_libdir}/libgit2.so.1.4*
|
||||||
%{_libdir}/libgit2.so.1.3*
|
%{_libdir}/libgit2.so.1.3*
|
||||||
%{_libdir}/libgit2.so.1.1*
|
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%doc AUTHORS docs examples README.md
|
%doc AUTHORS docs examples README.md
|
||||||
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
SHA512 (libgit2-1.3.0.tar.gz) = 842a648a67ff23ba9e6bf14b706ba9081164866e14000ebf3858442b7046925f05e1dbf00a7d740dc4bf32280e260730e23a9492e817094aa90736ae335ee76e
|
SHA512 (libgit2-1.4.1.tar.gz) = 66943d82811c5e24687231696bd1ce8d7d58f44081c00a7030e01a69a7c920605a427c315a26af6c57c9bd7c1d1d31ab857f80615fce1ba4b981d01f733215cd
|
||||||
|
Loading…
Reference in New Issue
Block a user