Hello community,

here is the log from the commit of package git for openSUSE:Factory checked in 
at 2019-02-28 21:37:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/git (Old)
 and      /work/SRC/openSUSE:Factory/.git.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "git"

Thu Feb 28 21:37:43 2019 rev:230 rq:678866 version:2.21.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/git/git.changes  2019-01-26 22:18:55.839025061 
+0100
+++ /work/SRC/openSUSE:Factory/.git.new.28833/git.changes       2019-02-28 
21:37:47.133651845 +0100
@@ -1,0 +2,31 @@
+Mon Feb 25 09:56:24 UTC 2019 - Marketa Calabkova <mcalabk...@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 <msucha...@suse.com>
+
+- Fix worktree creation race (bsc#1114225).
+  worktree-fix-worktree-add-race.patch
+  setup-don-t-fail-if-commondir-reference-is-deleted.patch
+
+-------------------------------------------------------------------

Old:
----
  git-2.20.1.tar.sign
  git-2.20.1.tar.xz

New:
----
  git-2.21.0.tar.sign
  git-2.21.0.tar.xz
  setup-don-t-fail-if-commondir-reference-is-deleted.patch
  worktree-fix-worktree-add-race.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ git.spec ++++++
--- /var/tmp/diff_new_pack.uswYuQ/_old  2019-02-28 21:37:48.025651565 +0100
+++ /var/tmp/diff_new_pack.uswYuQ/_new  2019-02-28 21:37:48.025651565 +0100
@@ -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 @@
 # 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 @@
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
+%patch9 -p1
+%patch10 -p1
 
 %build
 cat > .make <<'EOF'

++++++ git-2.20.1.tar.xz -> git-2.21.0.tar.xz ++++++
++++ 203042 lines of diff (skipped)


++++++ setup-don-t-fail-if-commondir-reference-is-deleted.patch ++++++
>From 37df7fd81c3dee990bd7723f18c94713a0d842b6 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msucha...@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 <msucha...@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

++++++ worktree-fix-worktree-add-race.patch ++++++
>From e134801d570d0a0c85424eb80b41893f4d8383ca Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msucha...@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 <msucha...@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


Reply via email to