Merge git://github.com/git-l10n/git-po
authorJunio C Hamano <gitster@pobox.com>
Mon, 4 Mar 2013 09:16:02 +0000 (01:16 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 4 Mar 2013 09:16:02 +0000 (01:16 -0800)
* git://github.com/git-l10n/git-po:
l10n: de.po: correct translation of "bisect" messages
l10n: de.po: translate 5 new messages
l10n: de.po: translate 35 new messages

16 files changed:
Documentation/RelNotes/1.8.1.5.txt
Documentation/RelNotes/1.8.2.txt
Documentation/git-submodule.txt
Documentation/git.txt
Documentation/githooks.txt
GIT-VERSION-GEN
Makefile
attr.c
compat/strtok_r.c [deleted file]
config.mak.uname
configure.ac
contrib/credential/wincred/git-credential-wincred.c
git-compat-util.h
setup.c
t/t0003-attributes.sh
t/t1504-ceiling-dirs.sh
index 92da6b27779814fe47ce72eaf9026f56695f7da1..efa68aef226c502f757a586406fa571ca346c01b 100644 (file)
@@ -1,9 +1,19 @@
 Git 1.8.1.5 Release Notes
 =========================
 
-Fixes since v1.8.1.5
+Fixes since v1.8.1.4
 --------------------
 
+ * Given a string with a multi-byte character that begins with '-' on
+   the command line where an option is expected, the option parser
+   used just one byte of the unknown letter when reporting an error.
+
+ * In v1.8.1, the attribute parser was tightened too restrictive to
+   error out upon seeing an entry that begins with an ! (exclamation),
+   which may confuse users to expect a "negative match", which does
+   not exist.  This has been demoted to a warning; such an entry is
+   still ignored.
+
  * "git apply --summary" has been taught to make sure the similarity
    value shown in its output is sensible, even when the input had a
    bogus value.
index 861ef026d625ba01351861fd49f51eae740ba12e..78c65776657d135e775e8f06a0973c407279ca14 100644 (file)
@@ -29,10 +29,15 @@ Many users found this counter-intuitive, given that "git commit -a"
 and other commands operate on the entire tree regardless of where you
 are. In this release, these commands give warning in such a case and
 encourage the user to say "git add -u/-A ." instead when restricting
-the scope to the current directory. At Git 2.0 (not *this* one), we
-plan to change these commands without pathspec to operate on the
-entire tree, and training your fingers to type "." will protect you
-against the future change.
+the scope to the current directory.
+
+At Git 2.0 (not *this* one), we plan to change these commands without
+pathspec to operate on the entire tree.  Forming a habit to type "."
+when you mean to limit the command to the current working directory
+will protect you against the planned future change, and that is the
+whole point of the new message (there will be no configuration
+variable to squelch this warning---it goes against the "habit forming"
+objective).
 
 
 Updates since v1.8.1
@@ -463,3 +468,20 @@ details).
 
  * Scripts to test bash completion was inherently flaky as it was
    affected by whatever random things the user may have on $PATH.
+
+ * An element on GIT_CEILING_DIRECTORIES could be a "logical" pathname
+   that uses a symbolic link to point at somewhere else (e.g. /home/me
+   that points at /net/host/export/home/me, and the latter directory
+   is automounted). Earlier when Git saw such a pathname e.g. /home/me
+   on this environment variable, the "ceiling" mechanism did not take
+   effect. With this release (the fix has also been merged to the
+   v1.8.1.x maintenance series), elements on GIT_CEILING_DIRECTORIES
+   are by default checked for such aliasing coming from symbolic
+   links. As this needs to actually resolve symbolic links for each
+   element on the GIT_CEILING_DIRECTORIES, you can disable this
+   mechanism for some elements by listing them after an empty element
+   on the GIT_CEILING_DIRECTORIES. e.g. Setting /home/me::/home/him to
+   GIT_CEILING_DIRECTORIES makes Git resolve symbolic links in
+   /home/me when checking if the current directory is under /home/me,
+   but does not do so for /home/him.
+   (merge 7ec30aa mh/maint-ceil-absolute later to maint).
index a0c9df85f419b319e38c49999f90cdfcc6928799..c99d795618f59bf98969b551f2a931680534f18e 100644 (file)
@@ -13,8 +13,9 @@ SYNOPSIS
              [--reference <repository>] [--] <repository> [<path>]
 'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]
 'git submodule' [--quiet] init [--] [<path>...]
-'git submodule' [--quiet] update [--init] [--remote] [-N|--no-fetch] [--rebase]
-             [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
+'git submodule' [--quiet] update [--init] [--remote] [-N|--no-fetch]
+             [-f|--force] [--rebase] [--reference <repository>]
+             [--merge] [--recursive] [--] [<path>...]
 'git submodule' [--quiet] summary [--cached|--files] [(-n|--summary-limit) <n>]
              [commit] [--] [<path>...]
 'git submodule' [--quiet] foreach [--recursive] <command>
index 0847cdcc6803f0af19d203b613222ac7e22d0cdd..9d29ed55042432bb976836347203b2d83dc27056 100644 (file)
@@ -43,9 +43,10 @@ unreleased) version of Git, that is available from 'master'
 branch of the `git.git` repository.
 Documentation for older releases are available here:
 
-* link:v1.8.1.4/git.html[documentation for release 1.8.1.4]
+* link:v1.8.1.5/git.html[documentation for release 1.8.1.5]
 
 * release notes for
+  link:RelNotes/1.8.1.5.txt[1.8.1.5],
   link:RelNotes/1.8.1.4.txt[1.8.1.4],
   link:RelNotes/1.8.1.3.txt[1.8.1.3],
   link:RelNotes/1.8.1.2.txt[1.8.1.2],
@@ -678,12 +679,19 @@ Git so take care if using Cogito etc.
        The '--namespace' command-line option also sets this value.
 
 'GIT_CEILING_DIRECTORIES'::
-       This should be a colon-separated list of absolute paths.
-       If set, it is a list of directories that Git should not chdir
-       up into while looking for a repository directory.
-       It will not exclude the current working directory or
-       a GIT_DIR set on the command line or in the environment.
-       (Useful for excluding slow-loading network directories.)
+       This should be a colon-separated list of absolute paths.  If
+       set, it is a list of directories that Git should not chdir up
+       into while looking for a repository directory (useful for
+       excluding slow-loading network directories).  It will not
+       exclude the current working directory or a GIT_DIR set on the
+       command line or in the environment.  Normally, Git has to read
+       the entries in this list and resolve any symlink that
+       might be present in order to compare them with the current
+       directory.  However, if even this access is slow, you
+       can add an empty entry to the list to tell Git that the
+       subsequent entries are not symlinks and needn't be resolved;
+       e.g.,
+       'GIT_CEILING_DIRECTORIES=/maybe/symlink::/very/slow/non/symlink'.
 
 'GIT_DISCOVERY_ACROSS_FILESYSTEM'::
        When run in a directory that does not have ".git" repository
index 8181e4ed2ad815e5cdc3fe840c9bcdad33ffdd2d..eab9b356cd67cff9221aec16b34204622f15116f 100644 (file)
@@ -365,7 +365,7 @@ preceding SP is also omitted.  Currently, no commands pass any
 'extra-info'.
 
 The hook always runs after the automatic note copying (see
-"notes.rewrite.<command>" in linkgit:git-config.txt) has happened, and
+"notes.rewrite.<command>" in linkgit:git-config.txt[1]) has happened, and
 thus has access to these notes.
 
 The following command-specific comments apply:
index 795203945337296eca8a7c0b30dfd135a1ac22fc..6b96d6addcfaf29273017419ecaa0eabca942af5 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.8.2-rc1
+DEF_VER=v1.8.2-rc2
 
 LF='
 '
index 7c75e3b1081b2bb5a93245eb960ead6f0b67c3b5..26d333275517943c629e9600525f292d4c91d32a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -101,8 +101,6 @@ all::
 #
 # Define NO_MKSTEMPS if you don't have mkstemps in the C library.
 #
-# Define NO_STRTOK_R if you don't have strtok_r in the C library.
-#
 # Define NO_FNMATCH if you don't have fnmatch in the C library.
 #
 # Define NO_FNMATCH_CASEFOLD if your fnmatch function doesn't have the
@@ -1249,10 +1247,6 @@ endif
 ifdef NO_STRTOULL
        COMPAT_CFLAGS += -DNO_STRTOULL
 endif
-ifdef NO_STRTOK_R
-       COMPAT_CFLAGS += -DNO_STRTOK_R
-       COMPAT_OBJS += compat/strtok_r.o
-endif
 ifdef NO_FNMATCH
        COMPAT_CFLAGS += -Icompat/fnmatch
        COMPAT_CFLAGS += -DNO_FNMATCH
diff --git a/attr.c b/attr.c
index 4657cc233c4aa7cff90e745a58ac7ad0a5fa8cd2..e2f9377891a7f6e0d56803016726e3cd3137fdc2 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -255,9 +255,11 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
                                      &res->u.pat.patternlen,
                                      &res->u.pat.flags,
                                      &res->u.pat.nowildcardlen);
-               if (res->u.pat.flags & EXC_FLAG_NEGATIVE)
-                       die(_("Negative patterns are forbidden in git attributes\n"
-                             "Use '\\!' for literal leading exclamation."));
+               if (res->u.pat.flags & EXC_FLAG_NEGATIVE) {
+                       warning(_("Negative patterns are ignored in git attributes\n"
+                                 "Use '\\!' for literal leading exclamation."));
+                       return NULL;
+               }
        }
        res->is_macro = is_macro;
        res->num_attr = num_attr;
diff --git a/compat/strtok_r.c b/compat/strtok_r.c
deleted file mode 100644 (file)
index 7b5d568..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Reentrant string tokenizer.  Generic version.
-   Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "../git-compat-util.h"
-
-/* Parse S into tokens separated by characters in DELIM.
-   If S is NULL, the saved pointer in SAVE_PTR is used as
-   the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = strtok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
-*/
-char *
-gitstrtok_r (char *s, const char *delim, char **save_ptr)
-{
-  char *token;
-
-  if (s == NULL)
-    s = *save_ptr;
-
-  /* Scan leading delimiters.  */
-  s += strspn (s, delim);
-  if (*s == '\0')
-    {
-      *save_ptr = s;
-      return NULL;
-    }
-
-  /* Find the end of the token.  */
-  token = s;
-  s = strpbrk (token, delim);
-  if (s == NULL)
-    /* This token finishes the string.  */
-    *save_ptr = token + strlen (token);
-  else
-    {
-      /* Terminate the token and make *SAVE_PTR point past it.  */
-      *s = '\0';
-      *save_ptr = s + 1;
-    }
-  return token;
-}
index 8743a6d0af8f193c22eab4bf3791c3a8cc876502..e09af8fc13ec4c3c6fa326e8208c98be52347a10 100644 (file)
@@ -321,7 +321,6 @@ ifeq ($(uname_S),Windows)
        NO_UNSETENV = YesPlease
        NO_STRCASESTR = YesPlease
        NO_STRLCPY = YesPlease
-       NO_STRTOK_R = YesPlease
        NO_FNMATCH = YesPlease
        NO_MEMMEM = YesPlease
        # NEEDS_LIBICONV = YesPlease
@@ -476,7 +475,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
        NO_UNSETENV = YesPlease
        NO_STRCASESTR = YesPlease
        NO_STRLCPY = YesPlease
-       NO_STRTOK_R = YesPlease
        NO_FNMATCH = YesPlease
        NO_MEMMEM = YesPlease
        NEEDS_LIBICONV = YesPlease
index 1991258ae031cd656a8b599fda16ec73695216cb..f3462d9c81f12ea07229128f6bef7a4ff3fcfe10 100644 (file)
@@ -901,12 +901,6 @@ GIT_CHECK_FUNC(strcasestr,
 [NO_STRCASESTR=YesPlease])
 GIT_CONF_SUBST([NO_STRCASESTR])
 #
-# Define NO_STRTOK_R if you don't have strtok_r
-GIT_CHECK_FUNC(strtok_r,
-[NO_STRTOK_R=],
-[NO_STRTOK_R=YesPlease])
-GIT_CONF_SUBST([NO_STRTOK_R])
-#
 # Define NO_FNMATCH if you don't have fnmatch
 GIT_CHECK_FUNC(fnmatch,
 [NO_FNMATCH=],
index cbaec5f24b9c2b4a1fb1b25af57a826a053da037..dac19eac81665b4f809688255b2eb9aca6874f20 100644 (file)
@@ -9,6 +9,8 @@
 
 /* common helpers */
 
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+
 static void die(const char *err, ...)
 {
        char msg[4096];
@@ -30,14 +32,6 @@ static void *xmalloc(size_t size)
        return ret;
 }
 
-static char *xstrdup(const char *str)
-{
-       char *ret = strdup(str);
-       if (!ret)
-               die("Out of memory");
-       return ret;
-}
-
 /* MinGW doesn't have wincred.h, so we need to define stuff */
 
 typedef struct _CREDENTIAL_ATTRIBUTEW {
@@ -67,20 +61,14 @@ typedef struct _CREDENTIALW {
 #define CRED_MAX_ATTRIBUTES 64
 
 typedef BOOL (WINAPI *CredWriteWT)(PCREDENTIALW, DWORD);
-typedef BOOL (WINAPI *CredUnPackAuthenticationBufferWT)(DWORD, PVOID, DWORD,
-    LPWSTR, DWORD *, LPWSTR, DWORD *, LPWSTR, DWORD *);
 typedef BOOL (WINAPI *CredEnumerateWT)(LPCWSTR, DWORD, DWORD *,
     PCREDENTIALW **);
-typedef BOOL (WINAPI *CredPackAuthenticationBufferWT)(DWORD, LPWSTR, LPWSTR,
-    PBYTE, DWORD *);
 typedef VOID (WINAPI *CredFreeT)(PVOID);
 typedef BOOL (WINAPI *CredDeleteWT)(LPCWSTR, DWORD, DWORD);
 
-static HMODULE advapi, credui;
+static HMODULE advapi;
 static CredWriteWT CredWriteW;
-static CredUnPackAuthenticationBufferWT CredUnPackAuthenticationBufferW;
 static CredEnumerateWT CredEnumerateW;
-static CredPackAuthenticationBufferWT CredPackAuthenticationBufferW;
 static CredFreeT CredFree;
 static CredDeleteWT CredDeleteW;
 
@@ -88,74 +76,84 @@ static void load_cred_funcs(void)
 {
        /* load DLLs */
        advapi = LoadLibrary("advapi32.dll");
-       credui = LoadLibrary("credui.dll");
-       if (!advapi || !credui)
-               die("failed to load DLLs");
+       if (!advapi)
+               die("failed to load advapi32.dll");
 
        /* get function pointers */
        CredWriteW = (CredWriteWT)GetProcAddress(advapi, "CredWriteW");
-       CredUnPackAuthenticationBufferW = (CredUnPackAuthenticationBufferWT)
-           GetProcAddress(credui, "CredUnPackAuthenticationBufferW");
        CredEnumerateW = (CredEnumerateWT)GetProcAddress(advapi,
            "CredEnumerateW");
-       CredPackAuthenticationBufferW = (CredPackAuthenticationBufferWT)
-           GetProcAddress(credui, "CredPackAuthenticationBufferW");
        CredFree = (CredFreeT)GetProcAddress(advapi, "CredFree");
        CredDeleteW = (CredDeleteWT)GetProcAddress(advapi, "CredDeleteW");
-       if (!CredWriteW || !CredUnPackAuthenticationBufferW ||
-           !CredEnumerateW || !CredPackAuthenticationBufferW || !CredFree ||
-           !CredDeleteW)
+       if (!CredWriteW || !CredEnumerateW || !CredFree || !CredDeleteW)
                die("failed to load functions");
 }
 
-static char target_buf[1024];
-static char *protocol, *host, *path, *username;
-static WCHAR *wusername, *password, *target;
+static WCHAR *wusername, *password, *protocol, *host, *path, target[1024];
 
-static void write_item(const char *what, WCHAR *wbuf)
+static void write_item(const char *what, LPCWSTR wbuf, int wlen)
 {
        char *buf;
-       int len = WideCharToMultiByte(CP_UTF8, 0, wbuf, -1, NULL, 0, NULL,
+       int len = WideCharToMultiByte(CP_UTF8, 0, wbuf, wlen, NULL, 0, NULL,
            FALSE);
        buf = xmalloc(len);
 
-       if (!WideCharToMultiByte(CP_UTF8, 0, wbuf, -1, buf, len, NULL, FALSE))
+       if (!WideCharToMultiByte(CP_UTF8, 0, wbuf, wlen, buf, len, NULL, FALSE))
                die("WideCharToMultiByte failed!");
 
        printf("%s=", what);
-       fwrite(buf, 1, len - 1, stdout);
+       fwrite(buf, 1, len, stdout);
        putchar('\n');
        free(buf);
 }
 
-static int match_attr(const CREDENTIALW *cred, const WCHAR *keyword,
-    const char *want)
+/*
+ * Match an (optional) expected string and a delimiter in the target string,
+ * consuming the matched text by updating the target pointer.
+ */
+static int match_part(LPCWSTR *ptarget, LPCWSTR want, LPCWSTR delim)
 {
-       int i;
-       if (!want)
-               return 1;
-
-       for (i = 0; i < cred->AttributeCount; ++i)
-               if (!wcscmp(cred->Attributes[i].Keyword, keyword))
-                       return !strcmp((const char *)cred->Attributes[i].Value,
-                           want);
-
-       return 0; /* not found */
+       LPCWSTR delim_pos, start = *ptarget;
+       int len;
+
+       /* find start of delimiter (or end-of-string if delim is empty) */
+       if (*delim)
+               delim_pos = wcsstr(start, delim);
+       else
+               delim_pos = start + wcslen(start);
+
+       /*
+        * match text up to delimiter, or end of string (e.g. the '/' after
+        * host is optional if not followed by a path)
+        */
+       if (delim_pos)
+               len = delim_pos - start;
+       else
+               len = wcslen(start);
+
+       /* update ptarget if we either found a delimiter or need a match */
+       if (delim_pos || want)
+               *ptarget = delim_pos ? delim_pos + wcslen(delim) : start + len;
+
+       return !want || (!wcsncmp(want, start, len) && !want[len]);
 }
 
 static int match_cred(const CREDENTIALW *cred)
 {
-       return (!wusername || !wcscmp(wusername, cred->UserName)) &&
-           match_attr(cred, L"git_protocol", protocol) &&
-           match_attr(cred, L"git_host", host) &&
-           match_attr(cred, L"git_path", path);
+       LPCWSTR target = cred->TargetName;
+       if (wusername && wcscmp(wusername, cred->UserName))
+               return 0;
+
+       return match_part(&target, L"git", L":") &&
+               match_part(&target, protocol, L"://") &&
+               match_part(&target, wusername, L"@") &&
+               match_part(&target, host, L"/") &&
+               match_part(&target, path, L"");
 }
 
 static void get_credential(void)
 {
-       WCHAR *user_buf, *pass_buf;
-       DWORD user_buf_size = 0, pass_buf_size = 0;
-       CREDENTIALW **creds, *cred = NULL;
+       CREDENTIALW **creds;
        DWORD num_creds;
        int i;
 
@@ -165,90 +163,36 @@ static void get_credential(void)
        /* search for the first credential that matches username */
        for (i = 0; i < num_creds; ++i)
                if (match_cred(creds[i])) {
-                       cred = creds[i];
+                       write_item("username", creds[i]->UserName,
+                               wcslen(creds[i]->UserName));
+                       write_item("password",
+                               (LPCWSTR)creds[i]->CredentialBlob,
+                               creds[i]->CredentialBlobSize / sizeof(WCHAR));
                        break;
                }
-       if (!cred)
-               return;
-
-       CredUnPackAuthenticationBufferW(0, cred->CredentialBlob,
-           cred->CredentialBlobSize, NULL, &user_buf_size, NULL, NULL,
-           NULL, &pass_buf_size);
-
-       user_buf = xmalloc(user_buf_size * sizeof(WCHAR));
-       pass_buf = xmalloc(pass_buf_size * sizeof(WCHAR));
-
-       if (!CredUnPackAuthenticationBufferW(0, cred->CredentialBlob,
-           cred->CredentialBlobSize, user_buf, &user_buf_size, NULL, NULL,
-           pass_buf, &pass_buf_size))
-               die("CredUnPackAuthenticationBuffer failed");
 
        CredFree(creds);
-
-       /* zero-terminate (sizes include zero-termination) */
-       user_buf[user_buf_size - 1] = L'\0';
-       pass_buf[pass_buf_size - 1] = L'\0';
-
-       write_item("username", user_buf);
-       write_item("password", pass_buf);
-
-       free(user_buf);
-       free(pass_buf);
-}
-
-static void write_attr(CREDENTIAL_ATTRIBUTEW *attr, const WCHAR *keyword,
-    const char *value)
-{
-       attr->Keyword = (LPWSTR)keyword;
-       attr->Flags = 0;
-       attr->ValueSize = strlen(value) + 1; /* store zero-termination */
-       attr->Value = (LPBYTE)value;
 }
 
 static void store_credential(void)
 {
        CREDENTIALW cred;
-       BYTE *auth_buf;
-       DWORD auth_buf_size = 0;
-       CREDENTIAL_ATTRIBUTEW attrs[CRED_MAX_ATTRIBUTES];
 
        if (!wusername || !password)
                return;
 
-       /* query buffer size */
-       CredPackAuthenticationBufferW(0, wusername, password,
-           NULL, &auth_buf_size);
-
-       auth_buf = xmalloc(auth_buf_size);
-
-       if (!CredPackAuthenticationBufferW(0, wusername, password,
-           auth_buf, &auth_buf_size))
-               die("CredPackAuthenticationBuffer failed");
-
        cred.Flags = 0;
        cred.Type = CRED_TYPE_GENERIC;
        cred.TargetName = target;
        cred.Comment = L"saved by git-credential-wincred";
-       cred.CredentialBlobSize = auth_buf_size;
-       cred.CredentialBlob = auth_buf;
+       cred.CredentialBlobSize = (wcslen(password)) * sizeof(WCHAR);
+       cred.CredentialBlob = (LPVOID)password;
        cred.Persist = CRED_PERSIST_LOCAL_MACHINE;
-       cred.AttributeCount = 1;
-       cred.Attributes = attrs;
+       cred.AttributeCount = 0;
+       cred.Attributes = NULL;
        cred.TargetAlias = NULL;
        cred.UserName = wusername;
 
-       write_attr(attrs, L"git_protocol", protocol);
-
-       if (host) {
-               write_attr(attrs + cred.AttributeCount, L"git_host", host);
-               cred.AttributeCount++;
-       }
-
-       if (path) {
-               write_attr(attrs + cred.AttributeCount, L"git_path", path);
-               cred.AttributeCount++;
-       }
-
        if (!CredWriteW(&cred, 0))
                die("CredWrite failed");
 }
@@ -284,10 +228,13 @@ static void read_credential(void)
 
        while (fgets(buf, sizeof(buf), stdin)) {
                char *v;
+               int len = strlen(buf);
+               /* strip trailing CR / LF */
+               while (len && strchr("\r\n", buf[len - 1]))
+                       buf[--len] = 0;
 
-               if (!strcmp(buf, "\n"))
+               if (!*buf)
                        break;
-               buf[strlen(buf)-1] = '\0';
 
                v = strchr(buf, '=');
                if (!v)
@@ -295,13 +242,12 @@ static void read_credential(void)
                *v++ = '\0';
 
                if (!strcmp(buf, "protocol"))
-                       protocol = xstrdup(v);
+                       protocol = utf8_to_utf16_dup(v);
                else if (!strcmp(buf, "host"))
-                       host = xstrdup(v);
+                       host = utf8_to_utf16_dup(v);
                else if (!strcmp(buf, "path"))
-                       path = xstrdup(v);
+                       path = utf8_to_utf16_dup(v);
                else if (!strcmp(buf, "username")) {
-                       username = xstrdup(v);
                        wusername = utf8_to_utf16_dup(v);
                } else if (!strcmp(buf, "password"))
                        password = utf8_to_utf16_dup(v);
@@ -330,22 +276,20 @@ int main(int argc, char *argv[])
                return 0;
 
        /* prepare 'target', the unique key for the credential */
-       strncat(target_buf, "git:", sizeof(target_buf));
-       strncat(target_buf, protocol, sizeof(target_buf));
-       strncat(target_buf, "://", sizeof(target_buf));
-       if (username) {
-               strncat(target_buf, username, sizeof(target_buf));
-               strncat(target_buf, "@", sizeof(target_buf));
+       wcscpy(target, L"git:");
+       wcsncat(target, protocol, ARRAY_SIZE(target));
+       wcsncat(target, L"://", ARRAY_SIZE(target));
+       if (wusername) {
+               wcsncat(target, wusername, ARRAY_SIZE(target));
+               wcsncat(target, L"@", ARRAY_SIZE(target));
        }
        if (host)
-               strncat(target_buf, host, sizeof(target_buf));
+               wcsncat(target, host, ARRAY_SIZE(target));
        if (path) {
-               strncat(target_buf, "/", sizeof(target_buf));
-               strncat(target_buf, path, sizeof(target_buf));
+               wcsncat(target, L"/", ARRAY_SIZE(target));
+               wcsncat(target, path, ARRAY_SIZE(target));
        }
 
-       target = utf8_to_utf16_dup(target_buf);
-
        if (!strcmp(argv[1], "get"))
                get_credential();
        else if (!strcmp(argv[1], "store"))
index b7eaaa99a802018a657e81e4421e40fb806b97b3..b636e0dd0c2ea8284ed6f34e32c448eae433a20a 100644 (file)
@@ -421,11 +421,6 @@ extern uintmax_t gitstrtoumax(const char *, char **, int);
 extern intmax_t gitstrtoimax(const char *, char **, int);
 #endif
 
-#ifdef NO_STRTOK_R
-#define strtok_r gitstrtok_r
-extern char *gitstrtok_r(char *s, const char *delim, char **save_ptr);
-#endif
-
 #ifdef NO_HSTRERROR
 #define hstrerror githstrerror
 extern const char *githstrerror(int herror);
diff --git a/setup.c b/setup.c
index 2e1521b09e5e6a0de585225293805b1d30a03cd4..1dee47e0850369c87408c540ce2b2251db17be3d 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -650,22 +650,32 @@ static dev_t get_device_or_die(const char *path, const char *prefix, int prefix_
 /*
  * A "string_list_each_func_t" function that canonicalizes an entry
  * from GIT_CEILING_DIRECTORIES using real_path_if_valid(), or
- * discards it if unusable.
+ * discards it if unusable.  The presence of an empty entry in
+ * GIT_CEILING_DIRECTORIES turns off canonicalization for all
+ * subsequent entries.
  */
 static int canonicalize_ceiling_entry(struct string_list_item *item,
-                                     void *unused)
+                                     void *cb_data)
 {
+       int *empty_entry_found = cb_data;
        char *ceil = item->string;
-       const char *real_path;
 
-       if (!*ceil || !is_absolute_path(ceil))
+       if (!*ceil) {
+               *empty_entry_found = 1;
                return 0;
-       real_path = real_path_if_valid(ceil);
-       if (!real_path)
+       } else if (!is_absolute_path(ceil)) {
                return 0;
-       free(item->string);
-       item->string = xstrdup(real_path);
-       return 1;
+       } else if (*empty_entry_found) {
+               /* Keep entry but do not canonicalize it */
+               return 1;
+       } else {
+               const char *real_path = real_path_if_valid(ceil);
+               if (!real_path)
+                       return 0;
+               free(item->string);
+               item->string = xstrdup(real_path);
+               return 1;
+       }
 }
 
 /*
@@ -705,9 +715,11 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
                return setup_explicit_git_dir(gitdirenv, cwd, len, nongit_ok);
 
        if (env_ceiling_dirs) {
+               int empty_entry_found = 0;
+
                string_list_split(&ceiling_dirs, env_ceiling_dirs, PATH_SEP, -1);
                filter_string_list(&ceiling_dirs, 0,
-                                  canonicalize_ceiling_entry, NULL);
+                                  canonicalize_ceiling_entry, &empty_entry_found);
                ceil_offset = longest_ancestor_length(cwd, &ceiling_dirs);
                string_list_clear(&ceiling_dirs, 0);
        }
index 43b25137e9878e41557fd7d095cc991c27efdfc7..0b98b6f8d090ecc3dfb48fe6fda5889dfbc5e018 100755 (executable)
@@ -198,7 +198,8 @@ test_expect_success 'root subdir attribute test' '
 
 test_expect_success 'negative patterns' '
        echo "!f test=bar" >.gitattributes &&
-       test_must_fail git check-attr test -- f
+       git check-attr test -- '"'"'!f'"'"' 2>errors &&
+       test_i18ngrep "Negative patterns are ignored" errors
 '
 
 test_expect_success 'patterns starting with exclamation' '
index cce87a5ab523d3a4232e9e11863aa3a6e8ca0211..3d51615e42d53a0c7794533eb27049606981fbf3 100755 (executable)
@@ -44,6 +44,10 @@ test_prefix ceil_at_sub ""
 GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/"
 test_prefix ceil_at_sub_slash ""
 
+if test_have_prereq SYMLINKS
+then
+       ln -s sub top
+fi
 
 mkdir -p sub/dir || exit 1
 cd sub/dir || exit 1
@@ -68,6 +72,19 @@ test_fail subdir_ceil_at_sub
 GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/"
 test_fail subdir_ceil_at_sub_slash
 
+if test_have_prereq SYMLINKS
+then
+       GIT_CEILING_DIRECTORIES="$TRASH_ROOT/top"
+       test_fail subdir_ceil_at_top
+       GIT_CEILING_DIRECTORIES="$TRASH_ROOT/top/"
+       test_fail subdir_ceil_at_top_slash
+
+       GIT_CEILING_DIRECTORIES=":$TRASH_ROOT/top"
+       test_prefix subdir_ceil_at_top_no_resolve "sub/dir/"
+       GIT_CEILING_DIRECTORIES=":$TRASH_ROOT/top/"
+       test_prefix subdir_ceil_at_top_slash_no_resolve "sub/dir/"
+fi
+
 GIT_CEILING_DIRECTORIES="$TRASH_ROOT/sub/dir"
 test_prefix subdir_ceil_at_subdir "sub/dir/"