Imported Upstream version 2.13.4 upstream/2.13.4
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 3 Mar 2021 06:16:11 +0000 (15:16 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 3 Mar 2021 06:16:11 +0000 (15:16 +0900)
24 files changed:
Documentation/RelNotes/2.13.4.txt [new file with mode: 0644]
Documentation/git-commit.txt
Documentation/git-rebase.txt
Documentation/i18n.txt
GIT-VERSION-GEN
RelNotes
alias.c
apply.c
builtin/gc.c
compat/cygwin.c [new file with mode: 0644]
compat/cygwin.h [new file with mode: 0644]
config.mak.uname
git-add--interactive.perl
git-compat-util.h
perl/Git.pm
progress.c
sha1_file.c
t/t0060-path-utils.sh
t/t1300-repo-config.sh
t/t6500-gc.sh
t/t9700/test.pl
t/test-lib-functions.sh
templates/hooks--pre-rebase.sample
unicode_width.h

diff --git a/Documentation/RelNotes/2.13.4.txt b/Documentation/RelNotes/2.13.4.txt
new file mode 100644 (file)
index 0000000..9a9f8f9
--- /dev/null
@@ -0,0 +1,28 @@
+Git v2.13.4 Release Notes
+=========================
+
+Fixes since v2.13.3
+-------------------
+
+ * Update the character width tables.
+
+ * A recent update broke an alias that contained an uppercase letter,
+   which has been fixed.
+
+ * On Cygwin, similar to Windows, "git push //server/share/repository"
+   ought to mean a repository on a network share that can be accessed
+   locally, but this did not work correctly due to stripping the double
+   slashes at the beginning.
+
+ * The progress meter did not give a useful output when we haven't had
+   0.5 seconds to measure the throughput during the interval.  Instead
+   show the overall throughput rate at the end, which is a much more
+   useful number.
+
+ * We run an early part of "git gc" that deals with refs before
+   daemonising (and not under lock) even when running a background
+   auto-gc, which caused multiple gc processes attempting to run the
+   early part at the same time.  This is now prevented by running the
+   early part also under the GC lock.
+
+Also contains a handful of small code and documentation clean-ups.
index afb06ad..8c74a2c 100644 (file)
@@ -196,11 +196,12 @@ whitespace::
 verbatim::
        Do not change the message at all.
 scissors::
-       Same as `whitespace`, except that everything from (and
-       including) the line
-       "`# ------------------------ >8 ------------------------`"
-       is truncated if the message is to be edited. "`#`" can be
-       customized with core.commentChar.
+       Same as `whitespace` except that everything from (and including)
+       the line found below is truncated, if the message is to be edited.
+       "`#`" can be customized with core.commentChar.
+
+               # ------------------------ >8 ------------------------
+
 default::
        Same as `strip` if the message is to be edited.
        Otherwise `whitespace`.
index 53f4e14..652a990 100644 (file)
@@ -675,7 +675,7 @@ on this 'subsystem'.  You might end up with a history like the
 following:
 
 ------------
-    o---o---o---o---o---o---o---o---o  master
+    o---o---o---o---o---o---o---o  master
         \
          o---o---o---o---o  subsystem
                           \
index 2dd79db..7e36e5b 100644 (file)
@@ -42,11 +42,11 @@ mind.
 +
 ------------
 [i18n]
-       commitencoding = ISO-8859-1
+       commitEncoding = ISO-8859-1
 ------------
 +
 Commit objects created with the above setting record the value
-of `i18n.commitencoding` in its `encoding` header.  This is to
+of `i18n.commitEncoding` in its `encoding` header.  This is to
 help other people who look at them later.  Lack of this header
 implies that the commit log message is encoded in UTF-8.
 
@@ -54,15 +54,15 @@ implies that the commit log message is encoded in UTF-8.
   `encoding` header of a commit object, and try to re-code the
   log message into UTF-8 unless otherwise specified.  You can
   specify the desired output encoding with
-  `i18n.logoutputencoding` in `.git/config` file, like this:
+  `i18n.logOutputEncoding` in `.git/config` file, like this:
 +
 ------------
 [i18n]
-       logoutputencoding = ISO-8859-1
+       logOutputEncoding = ISO-8859-1
 ------------
 +
 If you do not have this configuration variable, the value of
-`i18n.commitencoding` is used instead.
+`i18n.commitEncoding` is used instead.
 
 Note that we deliberately chose not to re-code the commit log
 message when a commit is made to force UTF-8 at the commit
index 7ba5c25..7e56143 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.13.3
+DEF_VER=v2.13.4
 
 LF='
 '
index 6740545..c5702b3 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.13.3.txt
\ No newline at end of file
+Documentation/RelNotes/2.13.4.txt
\ No newline at end of file
diff --git a/alias.c b/alias.c
index 0526304..caa88e0 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -10,7 +10,7 @@ static int config_alias_cb(const char *key, const char *value, void *d)
        struct config_alias_data *data = d;
        const char *p;
 
-       if (skip_prefix(key, "alias.", &p) && !strcmp(p, data->alias))
+       if (skip_prefix(key, "alias.", &p) && !strcasecmp(p, data->alias))
                return git_config_string((const char **)&data->v, key, value);
 
        return 0;
diff --git a/apply.c b/apply.c
index 7a9f4c8..f8bf0bd 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -972,13 +972,12 @@ static int gitdiff_verify_name(struct apply_state *state,
        }
 
        if (*name) {
-               int len = strlen(*name);
                char *another;
                if (isnull)
                        return error(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"),
                                     *name, state->linenr);
                another = find_name(state, line, NULL, state->p_value, TERM_TAB);
-               if (!another || memcmp(another, *name, len + 1)) {
+               if (!another || strcmp(another, *name)) {
                        free(another);
                        return error((side == DIFF_NEW_NAME) ?
                            _("git apply: bad git-diff - inconsistent new filename on line %d") :
@@ -986,8 +985,7 @@ static int gitdiff_verify_name(struct apply_state *state,
                }
                free(another);
        } else {
-               /* expect "/dev/null" */
-               if (memcmp("/dev/null", line, 9) || line[9] != '\n')
+               if (!starts_with(line, "/dev/null\n"))
                        return error(_("git apply: bad git-diff - expected /dev/null on line %d"), state->linenr);
        }
 
index 91f7696..2d2027d 100644 (file)
@@ -413,8 +413,12 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                        if (report_last_gc_error())
                                return -1;
 
+                       if (lock_repo_for_gc(force, &pid))
+                               return 0;
                        if (gc_before_repack())
                                return -1;
+                       delete_tempfile(&pidfile);
+
                        /*
                         * failure to daemonize is ok, we'll continue
                         * in foreground
diff --git a/compat/cygwin.c b/compat/cygwin.c
new file mode 100644 (file)
index 0000000..b9862d6
--- /dev/null
@@ -0,0 +1,19 @@
+#include "../git-compat-util.h"
+#include "../cache.h"
+
+int cygwin_offset_1st_component(const char *path)
+{
+       const char *pos = path;
+       /* unc paths */
+       if (is_dir_sep(pos[0]) && is_dir_sep(pos[1])) {
+               /* skip server name */
+               pos = strchr(pos + 2, '/');
+               if (!pos)
+                       return 0; /* Error: malformed unc path */
+
+               do {
+                       pos++;
+               } while (*pos && pos[0] != '/');
+       }
+       return pos + is_dir_sep(*pos) - path;
+}
diff --git a/compat/cygwin.h b/compat/cygwin.h
new file mode 100644 (file)
index 0000000..8e52de4
--- /dev/null
@@ -0,0 +1,2 @@
+int cygwin_offset_1st_component(const char *path);
+#define offset_1st_component cygwin_offset_1st_component
index 192629f..6367cc0 100644 (file)
@@ -181,6 +181,7 @@ ifeq ($(uname_O),Cygwin)
        UNRELIABLE_FSTAT = UnfortunatelyYes
        SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
        OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
+       COMPAT_OBJS += compat/cygwin.o
 endif
 ifeq ($(uname_S),FreeBSD)
        NEEDS_LIBICONV = YesPlease
index c55c612..daef1c1 100755 (executable)
@@ -3,7 +3,7 @@
 use 5.008;
 use strict;
 use warnings;
-use Git;
+use Git qw(unquote_path);
 use Git::I18N;
 
 binmode(STDOUT, ":raw");
@@ -175,47 +175,6 @@ if (!defined $GIT_DIR) {
 }
 chomp($GIT_DIR);
 
-my %cquote_map = (
- "b" => chr(8),
- "t" => chr(9),
- "n" => chr(10),
- "v" => chr(11),
- "f" => chr(12),
- "r" => chr(13),
- "\\" => "\\",
- "\042" => "\042",
-);
-
-sub unquote_path {
-       local ($_) = @_;
-       my ($retval, $remainder);
-       if (!/^\042(.*)\042$/) {
-               return $_;
-       }
-       ($_, $retval) = ($1, "");
-       while (/^([^\\]*)\\(.*)$/) {
-               $remainder = $2;
-               $retval .= $1;
-               for ($remainder) {
-                       if (/^([0-3][0-7][0-7])(.*)$/) {
-                               $retval .= chr(oct($1));
-                               $_ = $2;
-                               last;
-                       }
-                       if (/^([\\\042btnvfr])(.*)$/) {
-                               $retval .= $cquote_map{$1};
-                               $_ = $2;
-                               last;
-                       }
-                       # This is malformed -- just return it as-is for now.
-                       return $_[0];
-               }
-               $_ = $remainder;
-       }
-       $retval .= $_;
-       return $retval;
-}
-
 sub refresh {
        my $fh;
        open $fh, 'git update-index --refresh |'
index 199042a..59866d7 100644 (file)
 #include <sys/sysctl.h>
 #endif
 
+#if defined(__CYGWIN__)
+#include "compat/cygwin.h"
+#endif
 #if defined(__MINGW32__)
 /* pull in Windows compatibility stuff */
 #include "compat/mingw.h"
index bfce1f7..f4b56e6 100644 (file)
@@ -61,7 +61,8 @@ require Exporter;
                 remote_refs prompt
                 get_tz_offset get_record
                 credential credential_read credential_write
-                temp_acquire temp_is_locked temp_release temp_reset temp_path);
+                temp_acquire temp_is_locked temp_release temp_reset temp_path
+                unquote_path);
 
 
 =head1 DESCRIPTION
@@ -1451,6 +1452,57 @@ sub prefix_lines {
        return $string;
 }
 
+=item unquote_path ( PATH )
+
+Unquote a quoted path containing c-escapes as returned by ls-files etc.
+when not using -z or when parsing the output of diff -u.
+
+=cut
+
+{
+       my %cquote_map = (
+               "a" => chr(7),
+               "b" => chr(8),
+               "t" => chr(9),
+               "n" => chr(10),
+               "v" => chr(11),
+               "f" => chr(12),
+               "r" => chr(13),
+               "\\" => "\\",
+               "\042" => "\042",
+       );
+
+       sub unquote_path {
+               local ($_) = @_;
+               my ($retval, $remainder);
+               if (!/^\042(.*)\042$/) {
+                       return $_;
+               }
+               ($_, $retval) = ($1, "");
+               while (/^([^\\]*)\\(.*)$/) {
+                       $remainder = $2;
+                       $retval .= $1;
+                       for ($remainder) {
+                               if (/^([0-3][0-7][0-7])(.*)$/) {
+                                       $retval .= chr(oct($1));
+                                       $_ = $2;
+                                       last;
+                               }
+                               if (/^([\\\042abtnvfr])(.*)$/) {
+                                       $retval .= $cquote_map{$1};
+                                       $_ = $2;
+                                       last;
+                               }
+                               # This is malformed
+                               throw Error::Simple("invalid quoted path $_[0]");
+                       }
+                       $_ = $remainder;
+               }
+               $retval .= $_;
+               return $retval;
+       }
+}
+
 =item get_comment_line_char ( )
 
 Gets the core.commentchar configuration value.
index 29378ca..73e36d4 100644 (file)
@@ -36,6 +36,7 @@ struct progress {
        unsigned delay;
        unsigned delayed_percent_treshold;
        struct throughput *throughput;
+       uint64_t start_ns;
 };
 
 static volatile sig_atomic_t progress_update;
@@ -221,6 +222,7 @@ struct progress *start_progress_delay(const char *title, unsigned total,
        progress->delayed_percent_treshold = percent_treshold;
        progress->delay = delay;
        progress->throughput = NULL;
+       progress->start_ns = getnanotime();
        set_progress_signal();
        return progress;
 }
@@ -247,8 +249,10 @@ void stop_progress_msg(struct progress **p_progress, const char *msg)
                struct throughput *tp = progress->throughput;
 
                if (tp) {
-                       unsigned int rate = !tp->avg_misecs ? 0 :
-                                       tp->avg_bytes / tp->avg_misecs;
+                       uint64_t now_ns = getnanotime();
+                       unsigned int misecs, rate;
+                       misecs = ((now_ns - progress->start_ns) * 4398) >> 32;
+                       rate = tp->curr_total / (misecs ? misecs : 1);
                        throughput_string(&tp->display, tp->curr_total, rate);
                }
                progress_update = 1;
index 59a4ed2..dd90a78 100644 (file)
@@ -1684,14 +1684,14 @@ int git_open_cloexec(const char *name, int flags)
                fd = open(name, flags | o_cloexec);
        }
 
-#if defined(F_GETFL) && defined(F_SETFL) && defined(FD_CLOEXEC)
+#if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
        {
                static int fd_cloexec = FD_CLOEXEC;
 
                if (!o_cloexec && 0 <= fd && fd_cloexec) {
                        /* Opened w/o O_CLOEXEC?  try with fcntl(2) to add it */
-                       int flags = fcntl(fd, F_GETFL);
-                       if (fcntl(fd, F_SETFL, flags | fd_cloexec))
+                       int flags = fcntl(fd, F_GETFD);
+                       if (fcntl(fd, F_SETFD, flags | fd_cloexec))
                                fd_cloexec = 0;
                }
        }
index 444b5a4..7ea2bb5 100755 (executable)
@@ -70,6 +70,8 @@ ancestor() {
 case $(uname -s) in
 *MINGW*)
        ;;
+*CYGWIN*)
+       ;;
 *)
        test_set_prereq POSIX
        ;;
index a37ef04..364a537 100755 (executable)
@@ -1075,6 +1075,13 @@ test_expect_success 'git -c works with aliases of builtins' '
        test_cmp expect actual
 '
 
+test_expect_success 'aliases can be CamelCased' '
+       test_config alias.CamelCased "rev-parse HEAD" &&
+       git CamelCased >out &&
+       git rev-parse HEAD >expect &&
+       test_cmp expect out
+'
+
 test_expect_success 'git -c does not split values on equals' '
        echo "value with = in it" >expect &&
        git -c core.foo="value with = in it" config core.foo >actual &&
index cc7acd1..41b0be5 100755 (executable)
@@ -95,6 +95,27 @@ test_expect_success 'background auto gc does not run if gc.log is present and re
        test_line_count = 1 packs
 '
 
+test_expect_success 'background auto gc respects lock for all operations' '
+       # make sure we run a background auto-gc
+       test_commit make-pack &&
+       git repack &&
+       test_config gc.autopacklimit 1 &&
+       test_config gc.autodetach true &&
+
+       # create a ref whose loose presence we can use to detect a pack-refs run
+       git update-ref refs/heads/should-be-loose HEAD &&
+       test_path_is_file .git/refs/heads/should-be-loose &&
+
+       # now fake a concurrent gc that holds the lock; we can use our
+       # shell pid so that it looks valid.
+       hostname=$(hostname || echo unknown) &&
+       printf "$$ %s" "$hostname" >.git/gc.pid &&
+
+       # our gc should exit zero without doing anything
+       run_and_wait_for_auto_gc &&
+       test_path_is_file .git/refs/heads/should-be-loose
+'
+
 # DO NOT leave a detached auto gc process running near the end of the
 # test script: it can run long enough in the background to racily
 # interfere with the cleanup in 'test_done'.
index 1b75c91..34cd013 100755 (executable)
@@ -133,6 +133,13 @@ close TEMPFILE3;
 unlink $tmpfile3;
 chdir($abs_repo_dir);
 
+# unquoting paths
+is(Git::unquote_path('abc'), 'abc', 'unquote unquoted path');
+is(Git::unquote_path('"abc def"'), 'abc def', 'unquote simple quoted path');
+is(Git::unquote_path('"abc\"\\\\ \a\b\t\n\v\f\r\001\040"'),
+                    "abc\"\\ \x07\x08\x09\x0a\x0b\x0c\x0d\x01 ",
+                    'unquote escape sequences');
+
 printf "1..%d\n", Test::More->builder->current_test;
 
 my $is_passing = eval { Test::More->is_passing };
index db622c3..50a9a1d 100644 (file)
@@ -999,6 +999,7 @@ test_copy_bytes () {
                        my $s;
                        my $nread = sysread(STDIN, $s, $len);
                        die "cannot read: $!" unless defined($nread);
+                       last unless $nread;
                        print $s;
                        $len -= $nread;
                }
index 053f111..b7f81c1 100755 (executable)
@@ -88,9 +88,7 @@ else
        exit 1
 fi
 
-exit 0
-
-################################################################
+<<\DOC_END
 
 This sample hook safeguards topic branches that have been
 published from being rewound.
@@ -167,3 +165,5 @@ To compute (2):
        git rev-list master..topic
 
        if this is empty, it is fully merged to "master".
+
+DOC_END
index 02207be..6dee2c7 100644 (file)
@@ -51,6 +51,7 @@ static const struct interval zero_width[] = {
 { 0x0AC7, 0x0AC8 },
 { 0x0ACD, 0x0ACD },
 { 0x0AE2, 0x0AE3 },
+{ 0x0AFA, 0x0AFF },
 { 0x0B01, 0x0B01 },
 { 0x0B3C, 0x0B3C },
 { 0x0B3F, 0x0B3F },
@@ -73,7 +74,8 @@ static const struct interval zero_width[] = {
 { 0x0CC6, 0x0CC6 },
 { 0x0CCC, 0x0CCD },
 { 0x0CE2, 0x0CE3 },
-{ 0x0D01, 0x0D01 },
+{ 0x0D00, 0x0D01 },
+{ 0x0D3B, 0x0D3C },
 { 0x0D41, 0x0D44 },
 { 0x0D4D, 0x0D4D },
 { 0x0D62, 0x0D63 },
@@ -158,7 +160,7 @@ static const struct interval zero_width[] = {
 { 0x1CED, 0x1CED },
 { 0x1CF4, 0x1CF4 },
 { 0x1CF8, 0x1CF9 },
-{ 0x1DC0, 0x1DF5 },
+{ 0x1DC0, 0x1DF9 },
 { 0x1DFB, 0x1DFF },
 { 0x200B, 0x200F },
 { 0x202A, 0x202E },
@@ -262,6 +264,15 @@ static const struct interval zero_width[] = {
 { 0x1171D, 0x1171F },
 { 0x11722, 0x11725 },
 { 0x11727, 0x1172B },
+{ 0x11A01, 0x11A06 },
+{ 0x11A09, 0x11A0A },
+{ 0x11A33, 0x11A38 },
+{ 0x11A3B, 0x11A3E },
+{ 0x11A47, 0x11A47 },
+{ 0x11A51, 0x11A56 },
+{ 0x11A59, 0x11A5B },
+{ 0x11A8A, 0x11A96 },
+{ 0x11A98, 0x11A99 },
 { 0x11C30, 0x11C36 },
 { 0x11C38, 0x11C3D },
 { 0x11C3F, 0x11C3F },
@@ -269,6 +280,11 @@ static const struct interval zero_width[] = {
 { 0x11CAA, 0x11CB0 },
 { 0x11CB2, 0x11CB3 },
 { 0x11CB5, 0x11CB6 },
+{ 0x11D31, 0x11D36 },
+{ 0x11D3A, 0x11D3A },
+{ 0x11D3C, 0x11D3D },
+{ 0x11D3F, 0x11D45 },
+{ 0x11D47, 0x11D47 },
 { 0x16AF0, 0x16AF4 },
 { 0x16B30, 0x16B36 },
 { 0x16F8F, 0x16F92 },
@@ -339,7 +355,7 @@ static const struct interval double_width[] = {
 { 0x3000, 0x303E },
 { 0x3041, 0x3096 },
 { 0x3099, 0x30FF },
-{ 0x3105, 0x312D },
+{ 0x3105, 0x312E },
 { 0x3131, 0x318E },
 { 0x3190, 0x31BA },
 { 0x31C0, 0x31E3 },
@@ -358,10 +374,11 @@ static const struct interval double_width[] = {
 { 0xFE68, 0xFE6B },
 { 0xFF01, 0xFF60 },
 { 0xFFE0, 0xFFE6 },
-{ 0x16FE0, 0x16FE0 },
+{ 0x16FE0, 0x16FE1 },
 { 0x17000, 0x187EC },
 { 0x18800, 0x18AF2 },
-{ 0x1B000, 0x1B001 },
+{ 0x1B000, 0x1B11E },
+{ 0x1B170, 0x1B2FB },
 { 0x1F004, 0x1F004 },
 { 0x1F0CF, 0x1F0CF },
 { 0x1F18E, 0x1F18E },
@@ -370,6 +387,7 @@ static const struct interval double_width[] = {
 { 0x1F210, 0x1F23B },
 { 0x1F240, 0x1F248 },
 { 0x1F250, 0x1F251 },
+{ 0x1F260, 0x1F265 },
 { 0x1F300, 0x1F320 },
 { 0x1F32D, 0x1F335 },
 { 0x1F337, 0x1F37C },
@@ -392,15 +410,13 @@ static const struct interval double_width[] = {
 { 0x1F6CC, 0x1F6CC },
 { 0x1F6D0, 0x1F6D2 },
 { 0x1F6EB, 0x1F6EC },
-{ 0x1F6F4, 0x1F6F6 },
-{ 0x1F910, 0x1F91E },
-{ 0x1F920, 0x1F927 },
-{ 0x1F930, 0x1F930 },
-{ 0x1F933, 0x1F93E },
-{ 0x1F940, 0x1F94B },
-{ 0x1F950, 0x1F95E },
-{ 0x1F980, 0x1F991 },
+{ 0x1F6F4, 0x1F6F8 },
+{ 0x1F910, 0x1F93E },
+{ 0x1F940, 0x1F94C },
+{ 0x1F950, 0x1F96B },
+{ 0x1F980, 0x1F997 },
 { 0x1F9C0, 0x1F9C0 },
+{ 0x1F9D0, 0x1F9E6 },
 { 0x20000, 0x2FFFD },
 { 0x30000, 0x3FFFD }
 };