]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ak/slab-decl-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Wed, 20 May 2020 15:33:29 +0000 (08:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 May 2020 15:33:29 +0000 (08:33 -0700)
Code clean-up.

* ak/slab-decl-cleanup:
  commit-slab-decl.h: update include guard

13 files changed:
.github/workflows/main.yml
Makefile
ci/git-problem-matcher.json [deleted file]
ci/lib.sh
compat/gmtime.c [deleted file]
config.mak.uname
git-compat-util.h
merge-recursive.c
progress.c
t/t1509-root-work-tree.sh
t/t6042-merge-rename-corner-cases.sh
t/test-lib.sh
unpack-trees.c

index 802a4bf7cd109c22eb11d18dc61eded22200d360..84a5dcff7a05fb724d78826212c5fa22ba5df958 100644 (file)
@@ -44,7 +44,19 @@ jobs:
     - uses: actions/checkout@v1
     - name: download git-sdk-64-minimal
       shell: bash
-      run: a=git-sdk-64-minimal && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
+      run: |
+        ## Get artifact
+        urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
+        id=$(curl "$urlbase?definitions=22&statusFilter=completed&resultFilter=succeeded&\$top=1" |
+          jq -r ".value[] | .id")
+        download_url="$(curl "$urlbase/$id/artifacts" |
+          jq -r '.value[] | select(.name == "git-sdk-64-minimal").resource.downloadUrl')"
+        curl --connect-timeout 10 --retry 5 --retry-delay 0 --retry-max-time 240 \
+          -o artifacts.zip "$download_url"
+
+        ## Unzip and remove the artifact
+        unzip artifacts.zip
+        rm artifacts.zip
     - name: build
       shell: powershell
       env:
@@ -62,6 +74,11 @@ jobs:
       with:
         name: windows-artifacts
         path: artifacts
+    - name: upload git-sdk-64-minimal
+      uses: actions/upload-artifact@v1
+      with:
+        name: git-sdk-64-minimal
+        path: git-sdk-64-minimal
   windows-test:
     runs-on: windows-latest
     needs: [windows-build]
@@ -70,9 +87,6 @@ jobs:
         nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
     steps:
     - uses: actions/checkout@v1
-    - name: download git-sdk-64-minimal
-      shell: bash
-      run: a=git-sdk-64-minimal && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
     - name: download build artifacts
       uses: actions/download-artifact@v1
       with:
@@ -81,6 +95,11 @@ jobs:
     - name: extract build artifacts
       shell: bash
       run: tar xf artifacts.tar.gz
+    - name: download git-sdk-64-minimal
+      uses: actions/download-artifact@v1
+      with:
+        name: git-sdk-64-minimal
+        path: ${{github.workspace}}/git-sdk-64-minimal/
     - name: test
       shell: powershell
       run: |
@@ -113,7 +132,19 @@ jobs:
     - uses: actions/checkout@v1
     - name: download git-sdk-64-minimal
       shell: bash
-      run: a=git-sdk-64-minimal && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
+      run: |
+        ## Get artifact
+        urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
+        id=$(curl "$urlbase?definitions=22&statusFilter=completed&resultFilter=succeeded&\$top=1" |
+          jq -r ".value[] | .id")
+        download_url="$(curl "$urlbase/$id/artifacts" |
+          jq -r '.value[] | select(.name == "git-sdk-64-minimal").resource.downloadUrl')"
+        curl --connect-timeout 10 --retry 5 --retry-delay 0 --retry-max-time 240 \
+          -o artifacts.zip "$download_url"
+
+        ## Unzip and remove the artifact
+        unzip artifacts.zip
+        rm artifacts.zip
     - name: generate Visual Studio solution
       shell: powershell
       run: |
@@ -153,15 +184,17 @@ jobs:
         path: artifacts
   vs-test:
     runs-on: windows-latest
-    needs: [vs-build]
+    needs: [vs-build, windows-build]
     strategy:
       matrix:
         nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
     steps:
     - uses: actions/checkout@v1
-    - name: download git-64-portable
-      shell: bash
-      run: a=git-64-portable && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
+    - name: download git-sdk-64-minimal
+      uses: actions/download-artifact@v1
+      with:
+        name: git-sdk-64-minimal
+        path: ${{github.workspace}}/git-sdk-64-minimal/
     - name: download build artifacts
       uses: actions/download-artifact@v1
       with:
@@ -177,9 +210,9 @@ jobs:
         NO_SVN_TESTS: 1
         GIT_TEST_SKIP_REBASE_P: 1
       run: |
-        & git-64-portable\git-cmd.exe --command=usr\bin\bash.exe -lc @"
+        & .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
           # Let Git ignore the SDK and the test-cache
-          printf '%s\n' /git-64-portable/ /test-cache/ >>.git/info/exclude
+          printf '%s\n' /git-sdk-64-minimal/ /test-cache/ >>.git/info/exclude
 
           cd t &&
           PATH=\"`$PWD/helper:`$PATH\" &&
index 3d3a39fc192d5544a411d4cedb3785473b6f1148..90aa329eb7836824a7a45383e4b5b157124d815c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -399,9 +399,6 @@ all::
 # with a different indexfile format version.  If it isn't set the index
 # file format used is index-v[23].
 #
-# Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not
-# return NULL when it receives a bogus time_t.
-#
 # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
 #
 # Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
@@ -1809,11 +1806,6 @@ ifndef NO_MSGFMT_EXTENDED_OPTIONS
        MSGFMT += --check --statistics
 endif
 
-ifdef GMTIME_UNRELIABLE_ERRORS
-       COMPAT_OBJS += compat/gmtime.o
-       BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS
-endif
-
 ifdef HAVE_CLOCK_GETTIME
        BASIC_CFLAGS += -DHAVE_CLOCK_GETTIME
 endif
diff --git a/ci/git-problem-matcher.json b/ci/git-problem-matcher.json
deleted file mode 100644 (file)
index 506dfbd..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-    "problemMatcher": [
-        {
-            "owner": "git-test-suite",
-            "pattern": [
-                {
-                    "regexp": "^([^ :]+\\.sh):(\\d+): (error|warning|info):\\s+(.*)$",
-                    "file": 1,
-                    "line": 2,
-                    "severity": 3,
-                    "message": 4
-                }
-            ]
-        }
-    ]
-}
index dac36886e3744fba251506be53d48034adcecd17..ff24c547c8bb56a244eb5b1b3ca11e4bd32ea31a 100755 (executable)
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -157,11 +157,6 @@ then
        MAKEFLAGS="$MAKEFLAGS --jobs=10"
        test windows != "$CI_OS_NAME" ||
        GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
-
-       # https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers
-       echo "::add-matcher::ci/git-problem-matcher.json"
-       test linux-musl = "$jobname" ||
-       MAKEFLAGS="$MAKEFLAGS TEST_SHELL_PATH=/bin/sh"
 else
        echo "Could not identify CI type" >&2
        env >&2
diff --git a/compat/gmtime.c b/compat/gmtime.c
deleted file mode 100644 (file)
index e8362dd..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "../git-compat-util.h"
-#undef gmtime
-#undef gmtime_r
-
-struct tm *git_gmtime(const time_t *timep)
-{
-       static struct tm result;
-       return git_gmtime_r(timep, &result);
-}
-
-struct tm *git_gmtime_r(const time_t *timep, struct tm *result)
-{
-       struct tm *ret;
-
-       memset(result, 0, sizeof(*result));
-       ret = gmtime_r(timep, result);
-
-       /*
-        * Rather than NULL, FreeBSD gmtime simply leaves the "struct tm"
-        * untouched when it encounters overflow. Since "mday" cannot otherwise
-        * be zero, we can test this very quickly.
-        */
-       if (ret && !ret->tm_mday) {
-               ret = NULL;
-               errno = EOVERFLOW;
-       }
-
-       return ret;
-}
index 5ad43c80b1aa8f3e13216af557f26405d1778206..c7eba69e54e669c61dd8b7333d97fb587964b68c 100644 (file)
@@ -246,7 +246,6 @@ ifeq ($(uname_S),FreeBSD)
        PYTHON_PATH = /usr/local/bin/python
        PERL_PATH = /usr/local/bin/perl
        HAVE_PATHS_H = YesPlease
-       GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
        HAVE_BSD_SYSCTL = YesPlease
        HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
        PAGER_ENV = LESS=FRX LV=-c MORE=FRX
index 8ba576e81e3e52843cc84350978a26df8e3344e7..a73632e8e43ce997f4bb2abf9c4e5520d2b078e2 100644 (file)
@@ -1216,13 +1216,6 @@ int access_or_die(const char *path, int mode, unsigned flag);
 /* Warn on an inaccessible file if errno indicates this is an error */
 int warn_on_fopen_errors(const char *path);
 
-#ifdef GMTIME_UNRELIABLE_ERRORS
-struct tm *git_gmtime(const time_t *);
-struct tm *git_gmtime_r(const time_t *, struct tm *);
-#define gmtime git_gmtime
-#define gmtime_r git_gmtime_r
-#endif
-
 #if !defined(USE_PARENS_AROUND_GETTEXT_N) && defined(__GNUC__)
 #define USE_PARENS_AROUND_GETTEXT_N 1
 #endif
index d92e2acf1ed2cfb4d4ce1e50fee3a64fb70b91ac..36948eafb750284551a3748405135a685ddba2ff 100644 (file)
@@ -1750,6 +1750,18 @@ static int handle_rename_rename_1to2(struct merge_options *opt,
                        return -1;
        }
 
+       if (!mfi.clean && mfi.blob.mode == a->mode &&
+           oideq(&mfi.blob.oid, &a->oid)) {
+               /*
+                * Getting here means we were attempting to merge a binary
+                * blob.  Since we can't merge binaries, the merge algorithm
+                * just takes one side.  But we don't want to copy the
+                * contents of one side to both paths; we'd rather use the
+                * original content at the given path for each path.
+                */
+               oidcpy(&mfi.blob.oid, &b->oid);
+               mfi.blob.mode = b->mode;
+       }
        add = &ci->ren2->dst_entry->stages[flip_stage(3)];
        if (is_valid(add)) {
                add->path = mfi.blob.path = b->path;
index 6d2dcff0b6920037463f217d3d699305e8ccc491..3eda914518bfdcd211552d41b5439125b1ea27ed 100644 (file)
@@ -329,13 +329,9 @@ void stop_progress(struct progress **p_progress)
                        trace2_data_intmax("progress", the_repository,
                                           "total_bytes",
                                           (*p_progress)->throughput->curr_total);
-       }
 
-       trace2_region_leave("progress",
-                           p_progress && *p_progress
-                               ? (*p_progress)->title
-                               : NULL,
-                           the_repository);
+               trace2_region_leave("progress", (*p_progress)->title, the_repository);
+       }
 
        stop_progress_msg(p_progress, _("done"));
 }
index 553a3f601ba7c76efa193d4a33823197c05281e7..fd2f7abf1c192eebaa98a3b7d3d22433cd523ae4 100755 (executable)
@@ -221,7 +221,7 @@ test_expect_success 'setup' '
        rm -rf /.git &&
        echo "Initialized empty Git repository in /.git/" > expected &&
        git init > result &&
-       test_cmp expected result
+       test_i18ncmp expected result
 '
 
 test_vars 'auto gitdir, root' ".git" "/" ""
@@ -246,7 +246,7 @@ test_expect_success 'setup' '
        cd / &&
        echo "Initialized empty Git repository in /" > expected &&
        git init --bare > result &&
-       test_cmp expected result
+       test_i18ncmp expected result
 '
 
 test_vars 'auto gitdir, root' "." "" ""
index b047cf1c1c3735faa99e3a3b2453503f4f9c4a8f..f163893ff97125c7750b9bd11c273ae8b738436c 100755 (executable)
@@ -1379,4 +1379,59 @@ test_expect_success 'check nested conflicts from rename/rename(2to1)' '
        )
 '
 
+# Testcase rename/rename(1to2) of a binary file
+#   Commit O: orig
+#   Commit A: orig-A
+#   Commit B: orig-B
+#   Expected: CONFLICT(rename/rename) message, three unstaged entries in the
+#             index, and contents of orig-[AB] at path orig-[AB]
+test_setup_rename_rename_1_to_2_binary () {
+       test_create_repo rename_rename_1_to_2_binary &&
+       (
+               cd rename_rename_1_to_2_binary &&
+
+               echo '* binary' >.gitattributes &&
+               git add .gitattributes &&
+
+               test_seq 1 10 >orig &&
+               git add orig &&
+               git commit -m orig &&
+
+               git branch A &&
+               git branch B &&
+
+               git checkout A &&
+               git mv orig orig-A &&
+               test_seq 1 11 >orig-A &&
+               git add orig-A &&
+               git commit -m orig-A &&
+
+               git checkout B &&
+               git mv orig orig-B &&
+               test_seq 0 10 >orig-B &&
+               git add orig-B &&
+               git commit -m orig-B
+
+       )
+}
+
+test_expect_success 'rename/rename(1to2) with a binary file' '
+       test_setup_rename_rename_1_to_2_binary &&
+       (
+               cd rename_rename_1_to_2_binary &&
+
+               git checkout A^0 &&
+
+               test_must_fail git merge -s recursive B^0 &&
+
+               # Make sure the index has the right number of entries
+               git ls-files -s >actual &&
+               test_line_count = 4 actual &&
+
+               git rev-parse A:orig-A B:orig-B >expect &&
+               git hash-object orig-A orig-B >actual &&
+               test_cmp expect actual
+       )
+'
+
 test_done
index baf94546da10b369ba1f96d5d40b8ae43dfafe57..d36b6ddc626cb40e0f485c2c02ce0440b54bf43b 100644 (file)
@@ -675,20 +675,6 @@ die () {
        fi
 }
 
-file_lineno () {
-       test -z "$GIT_TEST_FRAMEWORK_SELFTEST" && test -n "$BASH" || return 0
-       eval '
-               local i
-               for i in ${!BASH_SOURCE[*]}
-               do
-                       case $i,"${BASH_SOURCE[$i]##*/}" in
-                       0,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:$LINENO: ${1+$1: }"; return;;
-                       *,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:${BASH_LINENO[$(($i-1))]}: ${1+$1: }"; return;;
-                       esac
-               done
-       '
-}
-
 GIT_EXIT_OK=
 trap 'die' EXIT
 # Disable '-x' tracing, because with some shells, notably dash, it
@@ -734,7 +720,7 @@ test_failure_ () {
                write_junit_xml_testcase "$1" "      $junit_insert"
        fi
        test_failure=$(($test_failure + 1))
-       say_color error "$(file_lineno error)not ok $test_count - $1"
+       say_color error "not ok $test_count - $1"
        shift
        printf '%s\n' "$*" | sed -e 's/^/#      /'
        test "$immediate" = "" || { finalize_junit_xml; GIT_EXIT_OK=t; exit 1; }
index 02048dfdac8ab721b432f24a3dbcefc67f564e37..4be5fc3075410f4004b9d5fc1902eb84880dded5 100644 (file)
@@ -333,10 +333,10 @@ static void load_gitmodules_file(struct index_state *index,
        }
 }
 
-static struct progress *get_progress(struct unpack_trees_options *o)
+static struct progress *get_progress(struct unpack_trees_options *o,
+                                    struct index_state *index)
 {
        unsigned cnt = 0, total = 0;
-       struct index_state *index = &o->result;
 
        if (!o->update || !o->verbose_update)
                return NULL;
@@ -415,7 +415,7 @@ static int check_updates(struct unpack_trees_options *o,
        if (o->clone)
                setup_collided_checkout_detection(&state, index);
 
-       progress = get_progress(o);
+       progress = get_progress(o, index);
 
        git_attr_set_direction(GIT_ATTR_CHECKOUT);