Re: [PATCH v3 00/32] nd/multiple-work-trees

2014-09-28 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy  pclo...@gmail.com writes:

 On Fri, Sep 26, 2014 at 4:20 AM, Junio C Hamano gits...@pobox.com wrote:
 It has been a while since the last review exchanges were seen.  Will
 it be time for v3 soon?

 Sorry I've been slow on picking up feedback from v2. v3 is rebased on
 latest master. Other changes are mostly *.txt, and one broken 
 chain.

As there have been quite a lot of changes in overlapping areas
(e.g. with Ronnie and Jonathan's refs.c clean-up series, and also
with Tanay's config API changes in builtin/gc.c), I agree that it no
longer makes sense to stick to the old fork point.

This applies cleanly to the 'master', the result merges cleanly to
where the old series were merged to 'pu', and the difference between
the old/new pu^{/^Merge branch 'nd/multiple-work-trees' into pu}
commits matches what I remember from the review discussion you were
having on the old series with others (attached below for others to
eyeball as a rough substitute for an interdiff).

Thanks.

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 23f0c80..0c13825 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -229,8 +229,8 @@ section of linkgit:git-add[1] to learn how to operate the 
`--patch` mode.
Check out a branch in a separate working directory at
`path`. A new working directory is linked to the current
repository, sharing everything except working directory
-   specific files such as HEAD, index... See MULTIPLE CHECKOUT
-   MODE section for more information.
+   specific files such as HEAD, index... See MULTIPLE WORKING
+   TREES section for more information.
 
 branch::
Branch to checkout; if it refers to a branch (i.e., a name that,
@@ -395,58 +395,66 @@ $ git reflog -2 HEAD # or
 $ git log -g -2 HEAD
 
 
-MULTIPLE CHECKOUT MODE
+MULTIPLE WORKING TREES
 --
-Normally a working directory is attached to repository. When git
-checkout --to is used, a new working directory is attached to the
-current repository. This new working directory is called linked
-checkout as compared to the main checkout prepared by git init or
-git clone. A repository has one main checkout and zero or more
-linked checkouts.
-
-Each linked checkout has a private directory in $GIT_DIR/worktrees in
-the main checkout, usually named after the base name of the new
-working directory, optionally with a number added to make it
-unique. For example, the command `git checkout --to ../test-next next`
-running with $GIT_DIR=/path/main may create the directory
-`$GIT_DIR/worktrees/test-next` (or `$GIT_DIR/worktrees/test-next1` if
-`test-next` is already taken).
-
-Within a linked checkout, $GIT_DIR is set to point to this private
-directory (e.g. `/path/main/worktrees/test-next` in the example) and
-$GIT_COMMON_DIR is set to point back to the main checkout's $GIT_DIR
-(e.g. `/path/main`). Setting is done via a .git file located at the
-top directory of the linked checkout.
-
-Path resolution via `git rev-parse --git-path` would use either
-$GIT_DIR or $GIT_COMMON_DIR depending on the path. For example, the
-linked checkout's `$GIT_DIR/HEAD` resolve to
-`/path/main/worktrees/test-next/HEAD` (not `/path/main/HEAD` which is
-the main checkout's HEAD) while `$GIT_DIR/refs/heads/master` would use
-$GIT_COMMON_DIR and resolve to `/path/main/refs/heads/master`, which
-is shared across checkouts.
+
+A git repository can support multiple working trees, allowing you to check
+out more than one branch at a time.  With `git checkout --to` a new working
+tree is associated with the repository.  This new working tree is called a
+linked working tree as opposed to the main working tree prepared by git
+init or git clone.  A repository has one main working tree (if it's not a
+bare repository) and zero or more linked working trees.
+
+Each linked working tree has a private sub-directory in the repository's
+$GIT_DIR/worktrees directory.  The private sub-directory's name is usually
+the base name of the linked working tree's path, possibly appended with a
+number to make it unique.  For example, when `$GIT_DIR=/path/main/.git` the
+command `git checkout --to /path/other/test-next next` creates the linked
+working tree in `/path/other/test-next` and also creates a
+`$GIT_DIR/worktrees/test-next` directory (or `$GIT_DIR/worktrees/test-next1`
+if `test-next` is already taken).
+
+Within a linked working tree, $GIT_DIR is set to point to this private
+directory (e.g. `/path/main/.git/worktrees/test-next` in the example) and
+$GIT_COMMON_DIR is set to point back to the main working tree's $GIT_DIR
+(e.g. `/path/main/.git`). These settings are made in a `.git` file located at
+the top directory of the linked working tree.
+
+Path resolution via `git rev-parse --git-path` uses either
+$GIT_DIR or $GIT_COMMON_DIR depending on the path. For example, in the
+linked working tree `git rev-parse --git-path HEAD` returns

[PATCH] Do not make trace.c/getnanotime an inlined function

2014-09-28 Thread Ben Walton
Oracle Studio compilers don't allow for static variables in functions
that are defined to be inline. GNU C does permit this. Let's reference
the C99 standard though, which doesn't allow for inline functions to
contain modifiable static variables.

Signed-off-by: Ben Walton bdwal...@gmail.com
---
 trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trace.c b/trace.c
index b6f25a2..4778608 100644
--- a/trace.c
+++ b/trace.c
@@ -385,7 +385,7 @@ static inline uint64_t gettimeofday_nanos(void)
  * Returns nanoseconds since the epoch (01/01/1970), for performance tracing
  * (i.e. favoring high precision over wall clock time accuracy).
  */
-inline uint64_t getnanotime(void)
+uint64_t getnanotime(void)
 {
static uint64_t offset;
if (offset  1) {
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[no subject]

2014-09-28 Thread bambecapuno06
N�r��yb�X��ǧv�^�)޺{.n�+ا���ܨ}���Ơz�j:+v���zZ+��+zf���h���~i���z��w���?��)ߢf

Re: [PATCH RFC] git-am: support any number of signatures

2014-09-28 Thread Christian Couder
From: Junio C Hamano gits...@pobox.com
 On Thu, Sep 25, 2014 at 3:04 AM, Christian Couder
 christian.cou...@gmail.com wrote:
 To an existing message ends with Michael's Signed-off-by:, if his
 git am --trailer arts is called to add these three and then a
 Signed-off-by: from him, should it add an extra S-o-b (because his
 existing S-o-b will no longer be the last one after adding Acked and
 others), or should it refrain from doing so?  Can you express both
 preferences?

 The default for trailer.where is end, and for trailer.ifexists
 it is addIfDifferentNeighbor.
 That means that by default it will add the four new trailers at the end.

 If either trailer.ifexists or trailer.S-o-b.ifexists is set to
 addIfDifferent, then only the first 3 new trailers will be added at
 the end. So yes you can express both preferences.
 
 Suppose that the original ends with Sob, and Michael's am invokes
 interpret-trailers with Acked/Reviewed/Tested/Sob in this order. The first
 three are set to addifDifferent and Sob is set to addIfDifferentNeighbor,
 which would be the traditional and sensible default.
 
 Now, how is addIfDifferentNeighbor interpreted? Adding the new Sob
 with this single request to add these four is done on a message that
 has the same Sob at the end (i.e. Neighbor). Does _you_ adding of
 Acked/Reviewed/Tested invalidate the Neighbor-ness and you add the
 Sob anew?

The trailers are processed in the order they appear on the command
line. And when a trailer is processed, the input message it sees is
the result from the processing of all the previous trailers on the
command line. It is not any more the original input message.

So after Acked/Reviewed/Tested have been added, when the S-o-b at the
end of the command line is processed, it sees an input message that
has the Tested trailer at the end. That's why with
addIfDifferentNeighbor the S-o-b will still be added at the end.

 If that is what happens, it is not a workable workaround to set Sob to
 addIfDifferent only for this invocation.

Setting S-o-b to addIfDifferent for this invocation would not add the
S-o-b at the end, because another S-o-b still exists in the input
message seen when the last S-o-b is processed.

 Alternatively, if Neighbor-ness is evaluated first before you add A/R/T
 in response to this request, then you'd refrain from adding a duplicate
 Sob. It wasn't quite clear from your description what your design was,
 and your explanation above is not still clear, at least to me.

I hope it is clearer now. Maybe I should add something in the doc to
better explain how it works.

Thanks,
Christian.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] init - Honour the global core.filemode setting

2014-09-28 Thread Torsten Bögershausen
On 2014-09-28 02.37, Hilco Wijbenga wrote:
 If ~/.gitconfig contains a core.filemode entry then git init
 should honour that setting.
 
 Signed-off-by: Hilco Wijbenga hilco.wijbe...@gmail.com
 ---
 This bit me at work where I have to work with Windows. Git on Cygwin
 and the Eclipse Git plugin do not agree on file attributes so I had
 set filemode = false in ~/.gitconfig.
This feels strange.
Each and every repo has a core.filemode setting.
Or should have.

Did you manage to create a repo without core.filemode in repo/.git/config ?
And if yes, how?

 
 A few weeks later, I did a git init and, some time later yet, I
 noticed the strange behaviour of Cygwin/Eclipse again.
I do not fully understand which strange behaviour you experied,
so I need to guess.

 This was very
 surprising because things had been working well until then. It took
 quite a bit of research before I realized that git init always sets
 filemode. I think filemode should only be set if not set already
 in the global config (similar to log_all_ref_updates).

That is part of the whole story:
In general, git init probes the file system, if the executable bit
is working as expected.
So if you  create a Git repository under VFAT, the executable bit is not 
supported.

Git will notice that, and set core.filemode = false.

NTFS is a different story:
Cygwin has support for the executable bit under NTFS, but Msysit does not.
So if you share a Git repository between Msysgit and cygwin, it may be better
to set core.filemode to false.


There is however a problem with your patch, or 2:

When you set core.filemode = false in your ~/.gitconfig,
another developer may have core.filemode = true in his config.
If you manage to share the repo using a network, git will behave different
for the 2 users.
Solution:
Set core.filemode for this repo alwways in the repo. (as we do today in git.git)

When you run git init with ~/.gitconfig = true, you should
anyway probe the file system, as it may not support file mode, and 
core.filemode may be false.


So the solution that I can see is:
(Some pseudo-code:)

if (git config (global config ) == false) ||
   (git config (~/.config ) == false) then
  git_config_set(core.filemode, false);
else
  probe the file system and set core.filemode as we do today
fi


 
 The usual caveat applies: this is my first patch. Having said that,
 please feel free to be pedantic and strict. It's a small patch so I
 would imagine that fixing any problems should not take long (assuming
 it is acceptable at all, of course). I'd like to know I did it right.
 :-)
 
 AFAICT, all tests passed. Should a separate test be added for this change?
I think yes.

Under which system did you test ?

Windows?
CYWGIN ?
MingWW/Msysgit ?
Linux ?


 - /* Check filemode trustability */
 - filemode = TEST_FILEMODE;
 - if (TEST_FILEMODE  !lstat(path, st1)) {
 - struct stat st2;
 - filemode = (!chmod(path, st1.st_mode ^ S_IXUSR) 
 - !lstat(path, st2) 
 - st1.st_mode != st2.st_mode);
 + /* Do not override the global filemode setting. */
 + if (trust_executable_bit == -1) {
 + /* Check filemode trustability */
 + filemode = TEST_FILEMODE;
 + if (TEST_FILEMODE  !lstat(path, st1)) {
 + struct stat st2;
 + filemode = (!chmod(path, st1.st_mode ^ S_IXUSR) 
 + !lstat(path, st2) 
 + st1.st_mode != st2.st_mode);
 + }
 + git_config_set(core.filemode, filemode ? true : false);
The indentation seems to be broken ?
(We use one TAB, for better info please see Documentation/CodingGuidelines)
[snip]

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/14] Fix BASIC_LDFLAGS and COMPAT_CFLAGS for 64bit MinGW-w64

2014-09-28 Thread Marat Radchenko
From: Ray Donnelly mingw.andr...@gmail.com

Signed-off-by: Ray Donnelly mingw.andr...@gmail.com
Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 324a7fc..4470a928 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -6,6 +6,7 @@ uname_O := $(shell sh -c 'uname -o 2/dev/null || echo not')
 uname_R := $(shell sh -c 'uname -r 2/dev/null || echo not')
 uname_P := $(shell sh -c 'uname -p 2/dev/null || echo not')
 uname_V := $(shell sh -c 'uname -v 2/dev/null || echo not')
+CC_MACH := $(shell sh -c '$(CC) -dumpmachine 2/dev/null || echo not')
 
 ifdef MSVC
# avoid the MingW and Cygwin configuration sections
@@ -509,12 +510,15 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_POSIX_GOODIES = UnfortunatelyYes
DEFAULT_HELP_FORMAT = html
NO_D_INO_IN_DIRENT = YesPlease
-   COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI 
-Icompat -Icompat/win32
+   COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32
+   ifneq (,$(findstring i686,$(CC_MACH)))
+   COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
+   BASIC_LDFLAGS += -Wl,--large-address-aware
+   endif
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\.exe\
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o
-   BASIC_LDFLAGS += -Wl,--large-address-aware
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/14] MINGW: git-compat-util.h: use inttypes.h for printf macros

2014-09-28 Thread Marat Radchenko
All MinGW flavors have inttypes.h, so just include it.

However, we need to pass -D__USE_MINGW_ANSI_STDIO=1 to select
GNU-compatible macro definitions on MinGW-W64:
http://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/

As a side-effect, Git no longer builds with MSVC  2010 due to
its lack of stdint.h but hopefully that is not a problem.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.h|  2 --
 compat/msvc.h |  3 +++
 config.mak.uname  |  3 ++-
 git-compat-util.h | 11 ++-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index d113b19..4bae842 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -353,8 +353,6 @@ static inline char *mingw_find_last_dir_sep(const char 
*path)
 int mingw_offset_1st_component(const char *path);
 #define offset_1st_component mingw_offset_1st_component
 #define PATH_SEP ';'
-#define PRIuMAX I64u
-#define PRId64 I64d
 
 void mingw_open_html(const char *path);
 #define open_html mingw_open_html
diff --git a/compat/msvc.h b/compat/msvc.h
index a63d878..84a03f9 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -17,6 +17,9 @@
 
 typedef int pid_t;
 
+#define PRIuMAX I64u
+#define PRId64 I64d
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
diff --git a/config.mak.uname b/config.mak.uname
index 4470a928..c7aaa1c 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -328,6 +328,7 @@ ifeq ($(uname_S),Windows)
NO_PREAD = YesPlease
NEEDS_CRYPTO_WITH_SSL = YesPlease
NO_LIBGEN_H = YesPlease
+   NO_INTTYPES_H = UnfortunatelyYes
NO_POLL = YesPlease
NO_SYMLINK_HEAD = YesPlease
NO_IPV6 = YesPlease
@@ -510,7 +511,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_POSIX_GOODIES = UnfortunatelyYes
DEFAULT_HELP_FORMAT = html
NO_D_INO_IN_DIRENT = YesPlease
-   COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32
+   COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D__USE_MINGW_ANSI_STDIO=1 
-DNOGDI -Icompat -Icompat/win32
ifneq (,$(findstring i686,$(CC_MACH)))
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
BASIC_LDFLAGS += -Wl,--large-address-aware
diff --git a/git-compat-util.h b/git-compat-util.h
index 0c4e663..9d2d5ab 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -96,6 +96,12 @@
 #define GIT_WINDOWS_NATIVE
 #endif
 
+#ifndef NO_INTTYPES_H
+#include inttypes.h
+#else
+#include stdint.h
+#endif
+
 #include unistd.h
 #include stdio.h
 #include sys/stat.h
@@ -147,11 +153,6 @@
 #include netdb.h
 #include pwd.h
 #include sys/un.h
-#ifndef NO_INTTYPES_H
-#include inttypes.h
-#else
-#include stdint.h
-#endif
 #ifdef NO_INTPTR_T
 /*
  * On I16LP32, ILP32 and LP64 long is the save bet, however
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/14] MINGW: config.mak.uname: allow using cURL for non-msysGit builds

2014-09-28 Thread Marat Radchenko
Is it absolutely valid and possible to have cURL in generic
MinGW environment. Building Git without cURL is still possible
by passing NO_CURL=1

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 --
 1 file changed, 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 20cbdcf..324a7fc 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -531,8 +531,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
-else
-   NO_CURL = YesPlease
 endif
 endif
 ifeq ($(uname_S),QNX)
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


MinGW(-W64) compilation

2014-09-28 Thread Marat Radchenko
This patch series fixes building on modern MinGW and MinGW-W64 (including 
x86_64!).

*Compilation* tested on:
 - MSVC (via WinGit environment)
 - msysGit environment
 - Linux cross-toolchain i686-pc-mingw32
 - Linux cross-toolchain i686-w64-mingw32
 - Linux cross-toolchain x86_64-w64-mingw32

Attention: in order to build on MinGW-W64, you need to use 'sf/v3.x' branch
from MinGW-W64 repo because MinGW-W64 releases do not yet have a fix
for https://sourceforge.net/p/mingw-w64/bugs/397

Workaround that allows to also build on older MinGW-W64 is currently
pending [1] on gnulib ML. If it is accepted, same fix [2] can be applied
to Git copy of poll.c.

[1]: http://lists.gnu.org/archive/html/bug-gnulib/2014-09/msg00076.html
[2]: 
http://git.661346.n2.nabble.com/PATCH-v2-MinGW-W64-cross-compilation-tp7609085p7609093.html

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/14] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS

2014-09-28 Thread Marat Radchenko
-D__USE_MINGW_ACCESS only affects MinGW and does nothing when
MSVC is used.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index a2f380f..20cbdcf 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -368,7 +368,7 @@ ifeq ($(uname_S),Windows)
COMPAT_OBJS = compat/msvc.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/dirent.o
-   COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat 
-Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\.exe\
+   COMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex 
-Icompat/win32 -DSTRIP_EXTENSION=\.exe\
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib 
invalidcontinue.obj
PTHREAD_LIBS =
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/14] MINGW: compat/winansi.c: do not redefine CONSOLE_FONT_INFOEX

2014-09-28 Thread Marat Radchenko
Unlike MinGW, MinGW-W64 has CONSOLE_FONT_INFOEX already properly defined
in wincon.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/winansi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/winansi.c b/compat/winansi.c
index efc5bb3..0ac3297 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -22,7 +22,7 @@ static int non_ascii_used = 0;
 static HANDLE hthread, hread, hwrite;
 static HANDLE hconsole1, hconsole2;
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__)  !defined(__MINGW64_VERSION_MAJOR)
 typedef struct _CONSOLE_FONT_INFOEX {
ULONG cbSize;
DWORD nFont;
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/14] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64

2014-09-28 Thread Marat Radchenko
Unlike MinGW, MinGW-W64 has lseek already properly defined in io.h.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compat/mingw.h b/compat/mingw.h
index df0e320..ed79368 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -281,7 +281,9 @@ static inline int getrlimit(int resource, struct rlimit 
*rlp)
  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.
  */
 #define off_t off64_t
+#ifndef lseek
 #define lseek _lseeki64
+#endif
 
 /* use struct stat with 64 bit st_size */
 #ifdef stat
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/14] MINGW: do not fail at redefining pid_t on MinGW-W64

2014-09-28 Thread Marat Radchenko
pid_t is available in sys/types.h on both MinGW and MinGW-W64

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 1 -
 compat/msvc.h  | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 948a174..d113b19 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -5,7 +5,6 @@
  * things that are not available in header files
  */
 
-typedef int pid_t;
 typedef int uid_t;
 typedef int socklen_t;
 #define hstrerror strerror
diff --git a/compat/msvc.h b/compat/msvc.h
index 580bb55..a63d878 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -15,6 +15,8 @@
 #define strtoull _strtoui64
 #define strtoll  _strtoi64
 
+typedef int pid_t;
+
 static __inline int strcasecmp (const char *s1, const char *s2)
 {
int size1 = strlen(s1);
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/14] MINGW: config.mak.uname: reorganize MinGW settings

2014-09-28 Thread Marat Radchenko
HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to
msysGit, they're general MinGW settings.

Logic behind HAVE_LIBCHARSET_H: if user is on MinGW and has iconv,
we expect him to have libcharset.h. If user doesn't have iconv,
he has to explicitly say so via NO_ICONV=1 regardless of this
commit.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7aaa1c..f79c0e0 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -532,11 +532,11 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
prefix =
INSTALL = /bin/install
EXTLIBS += /mingw/lib/libz.a
-   NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease
-   HAVE_LIBCHARSET_H = YesPlease
NO_GETTEXT = YesPlease
 endif
+   HAVE_LIBCHARSET_H = YesPlease
+   NO_R_TO_GCC_LINKER = YesPlease
 endif
 ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/14] MINGW: compat/mingw.h: drop fork() definition

2014-09-28 Thread Marat Radchenko
fork() is not used in MinGW builds but causes a compiler warning
on x86_64 MinGW-W64: conflicting types for built-in function 'fork'

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
Acked-by: Eric Faye-Lund kusmab...@gmail.com
---
 compat/mingw.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index ed79368..948a174 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -93,8 +93,6 @@ static inline int symlink(const char *oldpath, const char 
*newpath)
 { errno = ENOSYS; return -1; }
 static inline int fchmod(int fildes, mode_t mode)
 { errno = ENOSYS; return -1; }
-static inline pid_t fork(void)
-{ errno = ENOSYS; return -1; }
 static inline unsigned int alarm(unsigned int seconds)
 { return 0; }
 static inline int fsync(int fd)
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/14] Makefile: introduce CROSS_COMPILE variable

2014-09-28 Thread Marat Radchenko
To ease cross-compilation process, introduce a single variable
with the prefix to all compiler-related executables.

Define CROSS_COMPILE=foo- if your compiler and binary utilities
are foo-cc, foo-ar, foo-strip, etc.  More specific variables
override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 Makefile | 19 +--
 config.mak.uname |  2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index f34a2d4..c412996 100644
--- a/Makefile
+++ b/Makefile
@@ -339,6 +339,11 @@ all::
 # return NULL when it receives a bogus time_t.
 #
 # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
+#
+# Define CROSS_COMPILE=foo- if your compiler and binary utilities
+# are foo-cc, foo-ar, foo-strip, etc.  More specific variables
+# override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-
+# then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.
 
 GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -350,7 +355,6 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-STRIP ?= strip
 
 # Among the variables below, these:
 #   gitexecdir
@@ -390,8 +394,12 @@ htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
 
-CC = cc
-AR = ar
+AR = $(CROSS_COMPILE)ar
+CC = $(CROSS_COMPILE)cc
+GCOV = $(CROSS_COMPILE)gcov
+RC = $(CROSS_COMPILE)windres
+STRIP = $(CROSS_COMPILE)strip
+
 RM = rm -f
 DIFF = diff
 TAR = tar
@@ -404,13 +412,12 @@ XGETTEXT = xgettext
 MSGFMT = msgfmt
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
-GCOV = gcov
 
 export TCL_PATH TCLTK_PATH
 
 SPARSE_FLAGS =
 
-
+RCFLAGS =
 
 ### --- END CONFIGURATION SECTION ---
 
@@ -1669,7 +1676,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
mv $@+ $@
 
 git.res: git.rc GIT-VERSION-FILE
-   $(QUIET_RC)$(RC) \
+   $(QUIET_RC)$(RC) $(RCFLAGS) \
  $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., 
,$(GIT_VERSION) \
  -DGIT_VERSION=\\\$(GIT_VERSION)\\\ $ -o $@
 
diff --git a/config.mak.uname b/config.mak.uname
index f79c0e0..9f7037e 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -523,7 +523,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
EXTLIBS += -lws2_32
GITLIBS += git.res
PTHREAD_LIBS =
-   RC = windres -O coff
+   RCFLAGS += -O coff
NATIVE_CRLF = YesPlease
X = .exe
SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/14] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64

2014-09-28 Thread Marat Radchenko
1. Unlike MinGW, MinGW-W64 already provides _ReadWriteBarrier macro,
   so don't try to redefine it.

2. MinGW-W64 has a strange definition FORCEINLINE as
   extern __inline__ __attribute__((__always_inline__,__gnu_inline__))

   'extern' doesn't work together with 'static', so #undef MinGW-W64
   version of FORCEINLINE.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/nedmalloc/malloc.c.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index f216a2a..a6c8cac 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -715,6 +715,10 @@ struct mallinfo {
 #endif /* HAVE_USR_INCLUDE_MALLOC_H */
 #endif /* NO_MALLINFO */
 
+#ifdef __MINGW64_VERSION_MAJOR
+  #undef FORCEINLINE
+#endif
+
 /*
   Try to persuade compilers to inline. The most critical functions for
   inlining are defined as macros, so these aren't used for them.
@@ -1382,7 +1386,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, 
LONG Value);
 
   /*** Atomic operations ***/
   #if (__GNUC__ * 1 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)  40100
-#define _ReadWriteBarrier() __sync_synchronize()
+#ifndef _ReadWriteBarrier
+  #define _ReadWriteBarrier() __sync_synchronize()
+#endif
   #else
 static __inline__ __attribute__((always_inline)) long 
__sync_lock_test_and_set(volatile long * const Target, const long Value)
 {
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/14] MINGW: config.mak.uname: auto-detect MinGW build from compiler

2014-09-28 Thread Marat Radchenko
When crosscompiling, one cannot rely on `uname` from host system.

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 config.mak.uname | 5 +
 1 file changed, 5 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index 9f7037e..182da50 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -14,6 +14,11 @@ ifdef MSVC
uname_O := Windows
 endif
 
+ifneq (,$(findstring mingw,$(CC_MACH)))
+   uname_S := MINGW
+   uname_O := MINGW
+endif
+
 # We choose to avoid if .. else if .. else .. endif endif
 # because maintaining the nesting to match is a pain.  If
 # we had elif things would have been much nicer...
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/14] Fix pointer - integer casts on IL32P64 systems

2014-09-28 Thread Marat Radchenko
This commit touches regcomp.c and poll.c from Gnulib,
both were fixed upstream in 2012 the same way.

Wrt ShellExecute, see [1].

[1]: http://blogs.msdn.com/b/oldnewthing/archive/2006/11/08/1035971.aspx

Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 compat/mingw.c | 8 
 compat/poll/poll.c | 2 +-
 compat/regex/regcomp.c | 4 ++--
 compat/win32/pthread.h | 2 +-
 compat/winansi.c   | 2 +-
 pack-revindex.c| 2 +-
 sha1_file.c| 8 
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index c5c37e5..27925d9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -674,13 +674,13 @@ int pipe(int filedes[2])
errno = err_win_to_posix(GetLastError());
return -1;
}
-   filedes[0] = _open_osfhandle((int)h[0], O_NOINHERIT);
+   filedes[0] = _open_osfhandle((intptr_t)h[0], O_NOINHERIT);
if (filedes[0]  0) {
CloseHandle(h[0]);
CloseHandle(h[1]);
return -1;
}
-   filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
+   filedes[1] = _open_osfhandle((intptr_t)h[1], O_NOINHERIT);
if (filedes[0]  0) {
close(filedes[0]);
CloseHandle(h[1]);
@@ -1819,7 +1819,7 @@ void mingw_open_html(const char *unixpath)
const char *, const char *, const char *, INT);
T ShellExecute;
HMODULE shell32;
-   int r;
+   intptr_t r;
 
shell32 = LoadLibrary(shell32.dll);
if (!shell32)
@@ -1829,7 +1829,7 @@ void mingw_open_html(const char *unixpath)
die(cannot run browser);
 
printf(Launching default browser to display HTML ...\n);
-   r = (int)ShellExecute(NULL, open, htmlpath, NULL, \\, 
SW_SHOWNORMAL);
+   r = (intptr_t)ShellExecute(NULL, open, htmlpath, NULL, \\, 
SW_SHOWNORMAL);
FreeLibrary(shell32);
/* see the MSDN documentation referring to the result codes here */
if (r = 32) {
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index a9b41d8..8941249 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -76,7 +76,7 @@
 
 #ifdef WIN32_NATIVE
 
-#define IsConsoleHandle(h) (((long) (h)  3) == 3)
+#define IsConsoleHandle(h) (((intptr_t) (h)  3) == 3)
 
 static BOOL
 IsSocketHandle (HANDLE h)
diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 06f3088..d8bde06 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -2577,7 +2577,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, 
re_dfa_t *dfa,
 old_tree = NULL;
 
   if (elem-token.type == SUBEXP)
-postorder (elem, mark_opt_subexp, (void *) (long) elem-token.opr.idx);
+postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem-token.opr.idx);
 
   tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT));
   if (BE (tree == NULL, 0))
@@ -3806,7 +3806,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, 
bin_tree_t *right,
 static reg_errcode_t
 mark_opt_subexp (void *extra, bin_tree_t *node)
 {
-  int idx = (int) (long) extra;
+  int idx = (int) (intptr_t) extra;
   if (node-token.type == SUBEXP  node-token.opr.idx == idx)
 node-token.opt_subexp = 1;
 
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index 8ad1873..6ccfb7b 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -77,7 +77,7 @@ extern pthread_t pthread_self(void);
 
 static inline int pthread_exit(void *ret)
 {
-   ExitThread((DWORD)ret);
+   ExitThread((DWORD)(uintptr_t)ret);
 }
 
 typedef DWORD pthread_key_t;
diff --git a/compat/winansi.c b/compat/winansi.c
index 0ac3297..ca4c295 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -452,7 +452,7 @@ static HANDLE duplicate_handle(HANDLE hnd)
HANDLE hresult, hproc = GetCurrentProcess();
if (!DuplicateHandle(hproc, hnd, hproc, hresult, 0, TRUE,
DUPLICATE_SAME_ACCESS))
-   die_lasterr(DuplicateHandle(%li) failed, (long) hnd);
+   die_lasterr(DuplicateHandle(%p) failed, hnd);
return hresult;
 }
 
diff --git a/pack-revindex.c b/pack-revindex.c
index 5c8376e..df02e9f 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -21,7 +21,7 @@ static int pack_revindex_hashsz;
 
 static int pack_revindex_ix(struct packed_git *p)
 {
-   unsigned long ui = (unsigned long)p;
+   uintptr_t ui = (uintptr_t)p;
int i;
 
ui = ui ^ (ui  16); /* defeat structure alignment */
diff --git a/sha1_file.c b/sha1_file.c
index c08c0cb..a534fda 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1966,11 +1966,11 @@ static struct delta_base_cache_entry {
enum object_type type;
 } delta_base_cache[MAX_DELTA_CACHE];
 
-static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset)
+static uintptr_t pack_entry_hash(struct packed_git *p, off_t base_offset)
 {
-   unsigned long hash;
+   uintptr_t hash;
 
-   

[PATCH 13/14] git-compat-util.h: fix integer overflow on IL32P64 systems

2014-09-28 Thread Marat Radchenko
Signed-off-by: Marat Radchenko ma...@slonopotamus.org
---
 git-compat-util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 9d2d5ab..5f6659c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -474,7 +474,7 @@ extern int git_munmap(void *start, size_t length);
 #endif
 
 #define DEFAULT_PACKED_GIT_LIMIT \
-   ((1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
+   ((size_t)(1024L * 1024L) * (sizeof(void*) = 8 ? 8192 : 256))
 
 #ifdef NO_PREAD
 #define pread git_pread
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Do not make trace.c/getnanotime an inlined function

2014-09-28 Thread Johannes Sixt
Am 28.09.2014 um 09:50 schrieb Ben Walton:
 Oracle Studio compilers don't allow for static variables in functions
 that are defined to be inline. GNU C does permit this. Let's reference
 the C99 standard though, which doesn't allow for inline functions to
 contain modifiable static variables.
 
 Signed-off-by: Ben Walton bdwal...@gmail.com
 ---
  trace.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/trace.c b/trace.c
 index b6f25a2..4778608 100644
 --- a/trace.c
 +++ b/trace.c
 @@ -385,7 +385,7 @@ static inline uint64_t gettimeofday_nanos(void)
   * Returns nanoseconds since the epoch (01/01/1970), for performance tracing
   * (i.e. favoring high precision over wall clock time accuracy).
   */
 -inline uint64_t getnanotime(void)
 +uint64_t getnanotime(void)
  {
   static uint64_t offset;
   if (offset  1) {
 

But then the function could stay static, no?

-- Hannes

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] MinGW(-W64) compilation

2014-09-28 Thread Johannes Schindelin
Hi Marat,

On Sun, 28 Sep 2014, Marat Radchenko wrote:

 This patch series fixes building on modern MinGW and MinGW-W64
 (including x86_64!).

Awesome work! I'll have a look at it as soon as I can!

Ciao,
Johannes
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Use SHELL_PATH as hash bang in test suite askpass helper script.

2014-09-28 Thread Ben Walton
The askpass script that is created for use by the test suite should
use SHELL_PATH for its hash bang instead of /bin/sh. Commit 5a4352024
introduced the use of idioms not supported in some legacy /bin/sh
implementations.

Signed-off-by: Ben Walton bdwal...@gmail.com
---
 t/lib-credential.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/lib-credential.sh b/t/lib-credential.sh
index 9e7d796..ca4a6de 100755
--- a/t/lib-credential.sh
+++ b/t/lib-credential.sh
@@ -278,8 +278,8 @@ helper_test_timeout() {
'
 }
 
-cat askpass \EOF
-#!/bin/sh
+echo #!$SHELL_PATH askpass
+cat askpass \EOF
 echo 2 askpass: $*
 what=$(echo $1 | cut -d  -f1 | tr A-Z a-z | tr -cd a-z)
 echo askpass-$what
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use SHELL_PATH as hash bang in test suite askpass helper script.

2014-09-28 Thread Jeff King
On Sun, Sep 28, 2014 at 11:21:07PM +0100, Ben Walton wrote:

 The askpass script that is created for use by the test suite should
 use SHELL_PATH for its hash bang instead of /bin/sh. Commit 5a4352024
 introduced the use of idioms not supported in some legacy /bin/sh
 implementations.

Sounds good.

 -cat askpass \EOF
 -#!/bin/sh
 +echo #!$SHELL_PATH askpass
 +cat askpass \EOF

This can just become:

  write_script askpass \EOF

which handles this for us (and you can get rid of the manual chmod then,
too).

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html