Accepting request 678866 from devel:tools:scm

OBS-URL: https://build.opensuse.org/request/show/678866
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/git?expand=0&rev=230
This commit is contained in:
Stephan Kulow 2019-02-28 20:37:43 +00:00 committed by Git OBS Bridge
parent e1a815f477
commit d471f1092d
8 changed files with 172 additions and 4 deletions

Binary file not shown.

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9d2e91e2faa2ea61ba0a70201d023b36f54d846314591a002c610ea2ab81c3e9
size 5359872

BIN
git-2.21.0.tar.sign Normal file

Binary file not shown.

3
git-2.21.0.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ccb1ce743ee991d91697e163c47c11be4bf81efbdd9fb0b4a7ad77cc0020d28
size 5491296

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Mon Feb 25 09:56:24 UTC 2019 - Marketa Calabkova <mcalabkova@suse.com>
- git 2.21.0
* Historically, the "-m" (mainline) option can only be used for "git
cherry-pick" and "git revert" when working with a merge commit.
This version of Git no longer warns or errors out when working with
a single-parent commit, as long as the argument to the "-m" option
is 1 (i.e. it has only one parent, and the request is to pick or
revert relative to that first parent). Scripts that relied on the
behaviour may get broken with this change.
* Small fixes and features for fast-export and fast-import.
* The "http.version" configuration variable can be used with recent
enough versions of cURL library to force the version of HTTP used
to talk when fetching and pushing.
* "git push $there $src:$dst" rejects when $dst is not a fully
qualified refname and it is not clear what the end user meant.
* Update "git multimail" from the upstream.
* A new date format "--date=human" that morphs its output depending
on how far the time is from the current time has been introduced.
"--date=auto:human" can be used to use this new format (or any
existing format) when the output is going to the pager or to the
terminal, and otherwise the default format.
-------------------------------------------------------------------
Wed Feb 13 09:45:58 UTC 2019 - Michal Suchanek <msuchanek@suse.com>
- Fix worktree creation race (bsc#1114225).
worktree-fix-worktree-add-race.patch
setup-don-t-fail-if-commondir-reference-is-deleted.patch
-------------------------------------------------------------------
Tue Jan 22 09:29:14 UTC 2019 - Marketa Calabkova <mcalabkova@suse.com>

View File

@ -30,7 +30,7 @@
%bcond_without git_libsecret
%bcond_without docs
Name: git
Version: 2.20.1
Version: 2.21.0
Release: 0
Summary: Fast, scalable, distributed revision control system
License: GPL-2.0-only
@ -54,6 +54,8 @@ Patch6: git-tcsh-completion-fixes.diff
# adapt paths in zsh completion (bnc#853183)
Patch7: git-zsh-completion-fixes.diff
Patch8: git-asciidoc.patch
Patch9: worktree-fix-worktree-add-race.patch
Patch10: setup-don-t-fail-if-commondir-reference-is-deleted.patch
BuildRequires: curl
BuildRequires: fdupes
BuildRequires: gpg2
@ -288,6 +290,8 @@ directory /git/ that calls the cgi script.
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
cat > .make <<'EOF'

View File

@ -0,0 +1,70 @@
From 37df7fd81c3dee990bd7723f18c94713a0d842b6 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 15 Feb 2019 18:46:20 +0100
Subject: [PATCH] setup: don't fail if commondir reference is deleted.
Apparently it can happen that stat() claims there is a commondir file but when
trying to open the file it is missing.
Another even rarer issue is that the file might be zero size because another
process initializing a worktree opened the file but has not written is content
yet.
When any of this happnes git aborts failing to perform perfectly valid
command because unrelated worktree is not yet fully initialized.
Rather than testing if the file exists before reading it handle ENOENT
and ENOTDIR.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v2:
- do not test file existence first, just read it and handle ENOENT.
- handle zero size file correctly
v3:
- handle ENOTDIR as well
- add more details to commit message
---
setup.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/setup.c b/setup.c
index ca9e8a949ed8..49306e36990d 100644
--- a/setup.c
+++ b/setup.c
@@ -270,12 +270,20 @@ int get_common_dir_noenv(struct strbuf *sb, const char *gitdir)
{
struct strbuf data = STRBUF_INIT;
struct strbuf path = STRBUF_INIT;
- int ret = 0;
+ int ret;
strbuf_addf(&path, "%s/commondir", gitdir);
- if (file_exists(path.buf)) {
- if (strbuf_read_file(&data, path.buf, 0) <= 0)
+ ret = strbuf_read_file(&data, path.buf, 0);
+ if (ret <= 0) {
+ /*
+ * if file is missing or zero size (just being written)
+ * assume default, bail otherwise
+ */
+ if (ret && errno != ENOENT && errno != ENOTDIR)
die_errno(_("failed to read %s"), path.buf);
+ strbuf_addstr(sb, gitdir);
+ ret = 0;
+ } else {
while (data.len && (data.buf[data.len - 1] == '\n' ||
data.buf[data.len - 1] == '\r'))
data.len--;
@@ -286,8 +294,6 @@ int get_common_dir_noenv(struct strbuf *sb, const char *gitdir)
strbuf_addbuf(&path, &data);
strbuf_add_real_path(sb, path.buf);
ret = 1;
- } else {
- strbuf_addstr(sb, gitdir);
}
strbuf_release(&data);
--
2.20.1

View File

@ -0,0 +1,63 @@
From e134801d570d0a0c85424eb80b41893f4d8383ca Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Wed, 13 Feb 2019 10:40:42 +0100
Subject: [PATCH] worktree: fix worktree add race.
Git runs a stat loop to find a worktree name that's available and then does
mkdir on the found name. Turn it to mkdir loop to avoid another invocation of
worktree add finding the same free name and creating the directory first.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v2:
- simplify loop exit condition
- exit early if the mkdir fails for reason other than already present
worktree
- make counter unsigned
---
builtin/worktree.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 3f9907fcc994..85a604cfe98c 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -268,10 +268,10 @@ static int add_worktree(const char *path, const char *refname,
struct strbuf sb_git = STRBUF_INIT, sb_repo = STRBUF_INIT;
struct strbuf sb = STRBUF_INIT;
const char *name;
- struct stat st;
struct child_process cp = CHILD_PROCESS_INIT;
struct argv_array child_env = ARGV_ARRAY_INIT;
- int counter = 0, len, ret;
+ unsigned int counter = 0;
+ int len, ret;
struct strbuf symref = STRBUF_INIT;
struct commit *commit = NULL;
int is_branch = 0;
@@ -295,8 +295,12 @@ static int add_worktree(const char *path, const char *refname,
if (safe_create_leading_directories_const(sb_repo.buf))
die_errno(_("could not create leading directories of '%s'"),
sb_repo.buf);
- while (!stat(sb_repo.buf, &st)) {
+
+ while (mkdir(sb_repo.buf, 0777)) {
counter++;
+ if ((errno != EEXIST) || !counter /* overflow */)
+ die_errno(_("could not create directory of '%s'"),
+ sb_repo.buf);
strbuf_setlen(&sb_repo, len);
strbuf_addf(&sb_repo, "%d", counter);
}
@@ -306,8 +310,6 @@ static int add_worktree(const char *path, const char *refname,
atexit(remove_junk);
sigchain_push_common(remove_junk_on_signal);
- if (mkdir(sb_repo.buf, 0777))
- die_errno(_("could not create directory of '%s'"), sb_repo.buf);
junk_git_dir = xstrdup(sb_repo.buf);
is_junk = 1;
--
2.20.1