Git development
 help / color / mirror / Atom feed
* [PATCH 10/14] Add empty header files for MSVC port
From: Marius Storm-Olsen @ 2009-08-21 13:30 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: msysgit, git, lznuaa, Marius Storm-Olsen
In-Reply-To: <cover.1250860247.git.mstormo@gmail.com>

MSVC lacks many of the header files included by git-compat-util.h,
so add blank header files for these instead of going ifdef crazy.

Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
---
 compat/vcbuild/include/arpa/inet.h   |    1 +
 compat/vcbuild/include/grp.h         |    1 +
 compat/vcbuild/include/inttypes.h    |    1 +
 compat/vcbuild/include/netdb.h       |    1 +
 compat/vcbuild/include/netinet/in.h  |    1 +
 compat/vcbuild/include/netinet/tcp.h |    1 +
 compat/vcbuild/include/pwd.h         |    1 +
 compat/vcbuild/include/sys/ioctl.h   |    1 +
 compat/vcbuild/include/sys/param.h   |    1 +
 compat/vcbuild/include/sys/poll.h    |    1 +
 compat/vcbuild/include/sys/select.h  |    1 +
 compat/vcbuild/include/sys/socket.h  |    1 +
 compat/vcbuild/include/sys/time.h    |    1 +
 compat/vcbuild/include/sys/wait.h    |    1 +
 14 files changed, 14 insertions(+), 0 deletions(-)
 create mode 100644 compat/vcbuild/include/arpa/inet.h
 create mode 100644 compat/vcbuild/include/grp.h
 create mode 100644 compat/vcbuild/include/inttypes.h
 create mode 100644 compat/vcbuild/include/netdb.h
 create mode 100644 compat/vcbuild/include/netinet/in.h
 create mode 100644 compat/vcbuild/include/netinet/tcp.h
 create mode 100644 compat/vcbuild/include/pwd.h
 create mode 100644 compat/vcbuild/include/sys/ioctl.h
 create mode 100644 compat/vcbuild/include/sys/param.h
 create mode 100644 compat/vcbuild/include/sys/poll.h
 create mode 100644 compat/vcbuild/include/sys/select.h
 create mode 100644 compat/vcbuild/include/sys/socket.h
 create mode 100644 compat/vcbuild/include/sys/time.h
 create mode 100644 compat/vcbuild/include/sys/wait.h

diff --git a/compat/vcbuild/include/arpa/inet.h b/compat/vcbuild/include/arpa/inet.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/arpa/inet.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/grp.h b/compat/vcbuild/include/grp.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/grp.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/inttypes.h b/compat/vcbuild/include/inttypes.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/inttypes.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/netdb.h b/compat/vcbuild/include/netdb.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/netdb.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/netinet/in.h b/compat/vcbuild/include/netinet/in.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/netinet/in.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/netinet/tcp.h b/compat/vcbuild/include/netinet/tcp.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/netinet/tcp.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/pwd.h b/compat/vcbuild/include/pwd.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/pwd.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/sys/ioctl.h b/compat/vcbuild/include/sys/ioctl.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/sys/ioctl.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/sys/param.h b/compat/vcbuild/include/sys/param.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/sys/param.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/sys/poll.h b/compat/vcbuild/include/sys/poll.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/sys/poll.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/sys/select.h b/compat/vcbuild/include/sys/select.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/sys/select.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/sys/socket.h b/compat/vcbuild/include/sys/socket.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/sys/socket.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/sys/time.h b/compat/vcbuild/include/sys/time.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/sys/time.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/sys/wait.h b/compat/vcbuild/include/sys/wait.h
new file mode 100644
index 0000000..0d8552a
--- /dev/null
+++ b/compat/vcbuild/include/sys/wait.h
@@ -0,0 +1 @@
+/* Intentionally empty file to support building git with MSVC */
-- 
1.6.3.msysgit.0.18.gef407

^ permalink raw reply related

* [PATCH 14/14] Add README and gitignore file for MSVC build
From: Marius Storm-Olsen @ 2009-08-21 13:30 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: msysgit, git, lznuaa
In-Reply-To: <cover.1250860247.git.mstormo@gmail.com>

From: Frank Li <lznuaa@gmail.com>

Add a README file to tell users how to build git with MSVC.

Also add a gitignore file to make git ignore files generated
by a MSVC build.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/vcbuild/.gitignore |    3 +++
 compat/vcbuild/README     |   13 +++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 compat/vcbuild/.gitignore
 create mode 100644 compat/vcbuild/README

diff --git a/compat/vcbuild/.gitignore b/compat/vcbuild/.gitignore
new file mode 100644
index 0000000..297ee5b
--- /dev/null
+++ b/compat/vcbuild/.gitignore
@@ -0,0 +1,3 @@
+Debug
+Release
+*.user
diff --git a/compat/vcbuild/README b/compat/vcbuild/README
new file mode 100644
index 0000000..3667ca3
--- /dev/null
+++ b/compat/vcbuild/README
@@ -0,0 +1,13 @@
+The Steps of Build Git with VS2008
+
+1. Create VC Build Environment.
+
+   git clone git://repo.or.cz/gitbuild.git
+
+   gitbuild include VS solution file and library such as zlib.
+
+2. Get Submodule
+
+   git submodule update --init
+
+3. Open gitbuild\gitbuild.sln with VS2008. Then press F7.
-- 
1.6.3.msysgit.0.18.gef407

^ permalink raw reply related

* [PATCH 09/14] Avoid including windows.h in winansi.c for MSVC build
From: Marius Storm-Olsen @ 2009-08-21 13:30 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: msysgit, git, lznuaa, Marius Storm-Olsen
In-Reply-To: <cover.1250860247.git.mstormo@gmail.com>

From: Frank Li <lznuaa@gmail.com>

compat/msvc.h includes winsock2.h which conflicts with windows.h.
msvc.h also defines the oldest Windows API version required.

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
---
 compat/winansi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/compat/winansi.c b/compat/winansi.c
index 9217c24..0d79845 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -2,7 +2,9 @@
  * Copyright 2008 Peter Harris <git@peter.is-a-geek.org>
  */
 
+#ifndef _MSC_VER
 #include <windows.h>
+#endif
 #include "../git-compat-util.h"
 
 /*
-- 
1.6.3.msysgit.0.18.gef407

^ permalink raw reply related

* [RFC/PATCH 00/14] Build git with MSVC
From: Marius Storm-Olsen @ 2009-08-21 13:30 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: msysgit, git, lznuaa, Marius Storm-Olsen

So, Frank Li started this series, and I took it upon my self to help
out a bit; cleaning, reorganizing, rebasing the series. Hopefully
we're now a bit closer to including the series into mainline..

Here's a summary of what has happend:
1) This series is rebased ontop of git.git 'next', which needed an
   extra patch to avoid a non-constant array creation, which
   mscv doesn't like.
2) I've polished (tied to anyways) the commit messages a bit.
3) I've applied much of the feedback provided to the first round of
   the patches.
4) I've split, merged and reordered some of the patches, so things
   that belong together are in the same commits, and in a order of
   'importance'
5) I've removed the
       #define func _func
   stuff, as it's not needed and Microsoft cannot really kill the
   compatibility functions anyways. So, adding the define
       _CRT_NONSTDC_NO_DEPRECATE
   will kill the warnings seen without the defines above.
6) ..probably much more as well, but I forget..

Note: I did not sign off on the last two commits, which involve the
adding of the vcproj files, since I don't agree on adding them as is.
We need a Makefile way of compiling primarily, and second, a script
to generate the vcproj, as already discussed. But the commits are
included for completeness, at to let others compile and play with it.

I've kept the original author as is, and just signed the patches..
Thanks for watching, now bring on the comments!

Frank Li (11):
  Avoid declaration after statement
  Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++
  Change regerror() declaration from K&R style to ANSI C (C89)
  mingw.c: Use the O_BINARY flag to open files
  Fix __stdcall/WINAPI placement and function prototype
  Test for WIN32 instead of __MINGW32_
  Avoid including windows.h in winansi.c for MSVC build
  Add MinGW header files to build git with MSVC
  Add platform files for MSVC porting
  Add MSVC project files
  Add README and gitignore file for MSVC build

Marius Storm-Olsen (3):
  Fix non-constant array creation
  Add define guards to compat/win32.h
  Add empty header files for MSVC port

 builtin-apply.c                      |    3 +-
 compat/mingw.c                       |   20 +-
 compat/msvc.c                        |   35 +
 compat/msvc.h                        |  102 +++
 compat/regex/regex.c                 |    7 +-
 compat/snprintf.c                    |    2 +-
 compat/vcbuild/.gitignore            |    3 +
 compat/vcbuild/README                |   13 +
 compat/vcbuild/git/git.vcproj        |  197 +++++
 compat/vcbuild/include/arpa/inet.h   |    1 +
 compat/vcbuild/include/dirent.h      |  128 ++++
 compat/vcbuild/include/grp.h         |    1 +
 compat/vcbuild/include/inttypes.h    |    1 +
 compat/vcbuild/include/netdb.h       |    1 +
 compat/vcbuild/include/netinet/in.h  |    1 +
 compat/vcbuild/include/netinet/tcp.h |    1 +
 compat/vcbuild/include/pwd.h         |    1 +
 compat/vcbuild/include/sys/ioctl.h   |    1 +
 compat/vcbuild/include/sys/param.h   |    1 +
 compat/vcbuild/include/sys/poll.h    |    1 +
 compat/vcbuild/include/sys/select.h  |    1 +
 compat/vcbuild/include/sys/socket.h  |    1 +
 compat/vcbuild/include/sys/time.h    |    1 +
 compat/vcbuild/include/sys/utime.h   |   34 +
 compat/vcbuild/include/sys/wait.h    |    1 +
 compat/vcbuild/include/unistd.h      |   92 +++
 compat/vcbuild/include/utime.h       |    1 +
 compat/vcbuild/libgit/libgit.vcproj  | 1359 ++++++++++++++++++++++++++++++++++
 compat/win32.h                       |    5 +
 compat/winansi.c                     |    2 +
 git-compat-util.h                    |    3 +
 help.c                               |    5 +-
 pager.c                              |    4 +-
 run-command.c                        |   12 +-
 run-command.h                        |    2 +-
 setup.c                              |    2 +-
 36 files changed, 2020 insertions(+), 25 deletions(-)
 create mode 100644 compat/msvc.c
 create mode 100644 compat/msvc.h
 create mode 100644 compat/vcbuild/.gitignore
 create mode 100644 compat/vcbuild/README
 create mode 100644 compat/vcbuild/git/git.vcproj
 create mode 100644 compat/vcbuild/include/arpa/inet.h
 create mode 100644 compat/vcbuild/include/dirent.h
 create mode 100644 compat/vcbuild/include/grp.h
 create mode 100644 compat/vcbuild/include/inttypes.h
 create mode 100644 compat/vcbuild/include/netdb.h
 create mode 100644 compat/vcbuild/include/netinet/in.h
 create mode 100644 compat/vcbuild/include/netinet/tcp.h
 create mode 100644 compat/vcbuild/include/pwd.h
 create mode 100644 compat/vcbuild/include/sys/ioctl.h
 create mode 100644 compat/vcbuild/include/sys/param.h
 create mode 100644 compat/vcbuild/include/sys/poll.h
 create mode 100644 compat/vcbuild/include/sys/select.h
 create mode 100644 compat/vcbuild/include/sys/socket.h
 create mode 100644 compat/vcbuild/include/sys/time.h
 create mode 100644 compat/vcbuild/include/sys/utime.h
 create mode 100644 compat/vcbuild/include/sys/wait.h
 create mode 100644 compat/vcbuild/include/unistd.h
 create mode 100644 compat/vcbuild/include/utime.h
 create mode 100644 compat/vcbuild/libgit/libgit.vcproj

^ permalink raw reply

* [PATCH 07/14] Fix __stdcall/WINAPI placement and function prototype
From: Marius Storm-Olsen @ 2009-08-21 13:30 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: msysgit, git, lznuaa, Marius Storm-Olsen
In-Reply-To: <cover.1250860247.git.mstormo@gmail.com>

From: Frank Li <lznuaa@gmail.com>

WINAPI is a macro which translates into the proper calling convention, so
replace __stdcall with that.

MSVC requires WINAPI to be between the functions return value and the
function name, and that the function pointer type is in the form of
    return_type (WINAPI *function_name)(arguments...)

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
---
 compat/mingw.c |    4 ++--
 run-command.c  |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 836426c..9716528 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1017,7 +1017,7 @@ static sig_handler_t timer_fn = SIG_DFL;
  * length to call the signal handler.
  */
 
-static __stdcall unsigned ticktack(void *dummy)
+static unsigned WINAPI ticktack(void *dummy)
 {
 	while (WaitForSingleObject(timer_event, timer_interval) == WAIT_TIMEOUT) {
 		if (timer_fn == SIG_DFL)
@@ -1144,7 +1144,7 @@ void mingw_open_html(const char *unixpath)
 
 int link(const char *oldpath, const char *newpath)
 {
-	typedef BOOL WINAPI (*T)(const char*, const char*, LPSECURITY_ATTRIBUTES);
+	typedef BOOL (WINAPI *T)(const char*, const char*, LPSECURITY_ATTRIBUTES);
 	static T create_hard_link = NULL;
 	if (!create_hard_link) {
 		create_hard_link = (T) GetProcAddress(
diff --git a/run-command.c b/run-command.c
index efac7ad..98232e9 100644
--- a/run-command.c
+++ b/run-command.c
@@ -319,7 +319,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const
 }
 
 #ifdef __MINGW32__
-static __stdcall unsigned run_thread(void *data)
+static unsigned WINAPI run_thread(void *data)
 {
 	struct async *async = data;
 	return async->proc(async->fd_for_proc, async->data);
-- 
1.6.3.msysgit.0.18.gef407

^ permalink raw reply related

* [PATCH 02/14] Avoid declaration after statement
From: Marius Storm-Olsen @ 2009-08-21 13:30 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: msysgit, git, lznuaa, Marius Storm-Olsen
In-Reply-To: <cover.1250860247.git.mstormo@gmail.com>

From: Frank Li <lznuaa@gmail.com>

Microsoft Visual C++ does not understand this C99 style

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
---
 compat/mingw.c |   14 ++++++++++----
 help.c         |    3 ++-
 run-command.c  |    2 ++
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index bed4178..e4e0e60 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -123,13 +123,17 @@ int mingw_open (const char *filename, int oflags, ...)
 {
 	va_list args;
 	unsigned mode;
+	int fd;
+
 	va_start(args, oflags);
 	mode = va_arg(args, int);
 	va_end(args);
 
 	if (!strcmp(filename, "/dev/null"))
 		filename = "nul";
-	int fd = open(filename, oflags, mode);
+
+	fd = open(filename, oflags, mode);
+
 	if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
 		DWORD attrs = GetFileAttributes(filename);
 		if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))
@@ -580,10 +584,11 @@ static char **get_path_split(void)
 
 static void free_path_split(char **path)
 {
+	char **p = path;
+
 	if (!path)
 		return;
 
-	char **p = path;
 	while (*p)
 		free(*p++);
 	free(path);
@@ -1108,9 +1113,9 @@ int sigaction(int sig, struct sigaction *in, struct sigaction *out)
 #undef signal
 sig_handler_t mingw_signal(int sig, sig_handler_t handler)
 {
+	sig_handler_t old = timer_fn;
 	if (sig != SIGALRM)
 		return signal(sig, handler);
-	sig_handler_t old = timer_fn;
 	timer_fn = handler;
 	return old;
 }
@@ -1197,8 +1202,9 @@ struct dirent *mingw_readdir(DIR *dir)
 
 	if (dir->dd_handle == (long)INVALID_HANDLE_VALUE && dir->dd_stat == 0)
 	{
+		DWORD lasterr;
 		handle = FindFirstFileA(dir->dd_name, &buf);
-		DWORD lasterr = GetLastError();
+		lasterr = GetLastError();
 		dir->dd_handle = (long)handle;
 		if (handle == INVALID_HANDLE_VALUE && (lasterr != ERROR_NO_MORE_FILES)) {
 			errno = err_win_to_posix(lasterr);
diff --git a/help.c b/help.c
index 294337e..fd51b8e 100644
--- a/help.c
+++ b/help.c
@@ -127,7 +127,7 @@ static int is_executable(const char *name)
 		return 0;
 
 #ifdef __MINGW32__
-	/* cannot trust the executable bit, peek into the file instead */
+{	/* cannot trust the executable bit, peek into the file instead */
 	char buf[3] = { 0 };
 	int n;
 	int fd = open(name, O_RDONLY);
@@ -140,6 +140,7 @@ static int is_executable(const char *name)
 				st.st_mode |= S_IXUSR;
 		close(fd);
 	}
+}
 #endif
 	return st.st_mode & S_IXUSR;
 }
diff --git a/run-command.c b/run-command.c
index f3e7abb..efac7ad 100644
--- a/run-command.c
+++ b/run-command.c
@@ -134,6 +134,7 @@ fail_pipe:
 		error("cannot fork() for %s: %s", cmd->argv[0],
 			strerror(failed_errno = errno));
 #else
+{
 	int s0 = -1, s1 = -1, s2 = -1;	/* backups of stdin, stdout, stderr */
 	const char **sargv = cmd->argv;
 	char **env = environ;
@@ -200,6 +201,7 @@ fail_pipe:
 		dup2(s1, 1), close(s1);
 	if (s2 >= 0)
 		dup2(s2, 2), close(s2);
+}
 #endif
 
 	if (cmd->pid < 0) {
-- 
1.6.3.msysgit.0.18.gef407

^ permalink raw reply related

* [PATCH 04/14] Add define guards to compat/win32.h
From: Marius Storm-Olsen @ 2009-08-21 13:30 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: msysgit, git, lznuaa, Marius Storm-Olsen
In-Reply-To: <cover.1250860247.git.mstormo@gmail.com>

Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
---
 compat/win32.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/compat/win32.h b/compat/win32.h
index c26384e..e8c178d 100644
--- a/compat/win32.h
+++ b/compat/win32.h
@@ -1,3 +1,6 @@
+#ifndef WIN32_H
+#define WIN32_H
+
 /* common Win32 functions for MinGW and Cygwin */
 #include <windows.h>
 
@@ -32,3 +35,5 @@ static inline int get_file_attr(const char *fname, WIN32_FILE_ATTRIBUTE_DATA *fd
 		return ENOENT;
 	}
 }
+
+#endif
-- 
1.6.3.msysgit.0.18.gef407

^ permalink raw reply related

* [PATCH 01/14] Fix non-constant array creation
From: Marius Storm-Olsen @ 2009-08-21 13:30 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: msysgit, git, lznuaa, Marius Storm-Olsen
In-Reply-To: <cover.1250860247.git.mstormo@gmail.com>

MSVC doesn't munge the non-constant expression, so use xmalloc instead.

Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
---
 builtin-apply.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index ae11b41..0f19965 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1875,7 +1875,7 @@ static int match_fragment(struct image *img,
 		size_t imgoff = 0;
 		size_t preoff = 0;
 		size_t postlen = postimage->len;
-		size_t imglen[preimage->nr];
+		size_t *imglen = xmalloc(sizeof(size_t) * preimage->nr);
 		for (i = 0; i < preimage->nr; i++) {
 			size_t prelen = preimage->line[i].len;
 
@@ -1901,6 +1901,7 @@ static int match_fragment(struct image *img,
 		memcpy(fixed_buf, img->buf + try, imgoff);
 		for (i = 0; i < preimage->nr; i++)
 			preimage->line[i].len = imglen[i];
+		free(imglen);
 
 		/*
 		 * Update the preimage buffer and the postimage context lines.
-- 
1.6.3.msysgit.0.18.gef407

^ permalink raw reply related

* [PATCH v2] test suite: add a check that all test numbers are unique
From: Johannes Sixt @ 2009-08-21 13:13 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, Git Mailing List
In-Reply-To: <20090821125324.GA6280@coredump.intra.peff.net>

Jeff King schrieb:
> Why not the much shorter:
> 
> tests() {
>   ls | sed -n 's/^\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$/\1/p'
> }
> dups=`tests | uniq -d`
> 
> instead of the long shell loop?

Because it's faster on Windows ;-) No, seriously, I didn't know about
uniq -d.

Here is a replacement patch.

--- 8< ---
From: Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] t/Makefile: add a check that all test numbers are unique

The test runs only if 'make all' is used. Its purpose is to alert our
valued integrator if different branches are merged that happen to
introduce the same test number.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 t/Makefile |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/t/Makefile b/t/Makefile
index bd09390..ed8281a 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -17,6 +17,10 @@ T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
 TSVN = $(wildcard t91[0-9][0-9]-*.sh)

 all: pre-clean
+	@dups=`ls | sed -n 's/^\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$$/\1/p' | \
+			uniq -d` && \
+		test -z "$$dups" || { \
+		echo "duplicate test numbers:" $$dups; exit 1; }
 	$(MAKE) aggregate-results-and-cleanup

 $(T):
-- 
1.6.4.204.g6aad7

^ permalink raw reply related

* Re: [PATCH] test suite: add a check that all test numbers are unique
From: Jeff King @ 2009-08-21 12:53 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, Git Mailing List
In-Reply-To: <4A8E68AF.8040001@viscovery.net>

On Fri, Aug 21, 2009 at 11:28:15AM +0200, Johannes Sixt wrote:

> The test runs only if 'make all' is used. Its purpose is to alert our
> valued integrator if different branches are merged that happen to
> introduce the same test number.

I think this is probably useful. In addition to the t7406 you posted a
patch for, it looks like t4037 has a duplicate in next.

As for the implementation:

> +++ b/t/check_unique_numbers.sh
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +
> +# checks whether test case numbers are unique;
> +# returns non-zero if any duplicates were found
> +
> +check_numbers () {
> +	last= dup=
> +	while read name
> +	do
> +		case $name in
> +		t[0-9][0-9][0-9][0-9]-*.sh)
> +			number=${name%%-*}
> +			if test "$number" = "$last"; then
> +				dup="$dup $number"
> +			fi
> +			last=$number
> +			;;
> +		esac
> +	done
> +	test -z "$dup" || {
> +		echo >&2 "error: duplicate test numbers:" $dup
> +		return 1
> +	}
> +}
> +
> +ls -1 |	# no wildcard to avoid overflow of command line
> +check_numbers

Why not the much shorter:

tests() {
  ls | sed -n 's/^\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$/\1/p'
}
dups=`tests | uniq -d`

instead of the long shell loop?

-Peff

^ permalink raw reply

* Re: What's cooking in git.git (Aug 2009, #03; Thu, 20)
From: Mark A Rada @ 2009-08-21 12:40 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <7veir5naq3.fsf@alter.siamese.dyndns.org>


On 20-Aug-09, at 10:48 PM, Junio C Hamano wrote:

> Should graduate to 'master' soon.
>
> * mr/gitweb-xz (2009-08-06) 3 commits
>  (merged to 'next' on 2009-08-14 at b63b8e6)
> + gitweb: add support for XZ compressed snapshots
> + gitweb: update INSTALL regarding specific snapshot settings
> + gitweb: support to globally disable a snapshot format
>


I never submitted any tests for the patch that adds global snapshot  
disabling
functionality to gitweb.

Jakub, I changed the gitweb_run routine to capture STDOUT as well, is  
that ok?

Unless I missed a case, the tests show that the extra condition check  
that was
added in the &git_snapshot routine is never actually executed, because a
disabled snapshot format is not added to @snapshot_fmts, which is  
checked
first.

snippet:
5178     } elsif (!grep($_ eq $format, @snapshot_fmts)) {
5179         die_error(403, "Unsupported snapshot format");
5180     } elsif ($known_snapshot_formats{$format}{'disabled'}) {
5181         die_error(403, "Snapshot format not allowed");
5182     }
5183


--
Mark A Rada (ferrous26)
marada@uwaterloo.ca


---
  t/t9500-gitweb-standalone-no-errors.sh |   67 +++++++++++++++++++++++ 
++++++++-
  1 files changed, 66 insertions(+), 1 deletions(-)

diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb- 
standalone-no-errors.sh
index 6275181..9ce9667 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -57,10 +57,11 @@ gitweb_run () {
  	# we are interested only in properly formatted errors/warnings
  	rm -f gitweb.log &&
  	perl -- "$SCRIPT_NAME" \
-		>/dev/null 2>gitweb.log &&
+		>gitweb.output 2>gitweb.log &&
  	if grep "^[[]" gitweb.log >/dev/null 2>&1; then false; else true; fi

  	# gitweb.log is left for debugging
+	# gitweb.output is used to parse output
  }

  . ./test-lib.sh
@@ -704,4 +705,68 @@ test_expect_success \
  	 gitweb_run "p=.git;a=summary"'
  test_debug 'cat gitweb.log'

+
+#  
----------------------------------------------------------------------
+# snapshot settings
+
+cat >>gitweb_config.perl <<EOF
+
+\$feature{'snapshot'}{'override'} = 0;
+EOF
+
+test_expect_success \
+	'snapshots: tgz only default format enabled' \
+	'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
+	grep "Status: 200 OK" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&
+	grep "403 - Unsupported snapshot format" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&
+	grep "403 - Unsupported snapshot format" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
+	grep "403 - Unsupported snapshot format" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+cat >>gitweb_config.perl <<EOF
+
+\$feature{'snapshot'}{'default'} = ['tgz','tbz2','txz','zip'];
+EOF
+
+test_expect_success \
+	'snapshots: all enabled in default, use default disabled value' \
+	'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
+	grep "Status: 200 OK" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&
+	grep "Status: 200 OK" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&
+	grep "403 - Unsupported snapshot format" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
+	grep "Status: 200 OK" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+cat >>gitweb_config.perl <<EOF
+
+\$known_snapshot_formats{'zip'}{'disabled'} = 1;
+EOF
+
+test_expect_success \
+	'snapshots: zip explicitly disabled' \
+	'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
+	grep "403 - Unsupported snapshot format" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+cat >>gitweb_config.perl <<EOF
+
+\$known_snapshot_formats{'tgz'}{'disabled'} = 0;
+EOF
+
+test_expect_success \
+	'snapshots: tgz explicitly enabled' \
+	'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
+	grep "Status: 200 OK" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
  test_done
-- 
1.6.4

^ permalink raw reply related

* Display bug in gitk -S
From: Martin Stjernholm @ 2009-08-21 11:46 UTC (permalink / raw)
  To: git

The following applies to git 1.6.4.

I did a "git log -S" with some search term, and it filtered out seven
disconnected commits from a fairly large repository.

Then I tried "gitk -S" with the same term. In the upper pane I briefly
see the seven commits, each with a dot in a different column and a
down-pointing arrow. After a while (presumably when it has searched
through the whole repo and has discovered that the commits are
disconnected), the display is updated to include the preceding commits
as white dots. However, the total number of shown commits is still
restricted to seven, which means that I now only see the first four of
the commits I should see.

^ permalink raw reply

* Re: Continue git clone after interruption
From: Matthieu Moy @ 2009-08-21 10:26 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Nicolas Pitre, Tomasz Kontusz, git, Johannes Schindelin,
	Scott Chacon
In-Reply-To: <200908211207.38555.jnareb@gmail.com>

Jakub Narebski <jnareb@gmail.com> writes:

> On the other hand Linux is fairly large project in terms of LoC, but
> it had its history cut when moving to Git, so the ratio of git-archive
> of HEAD to the size of packfile is overemphasized here.

Emacs can be a good example if you want a project with a loooong
history.

emacs.git$ git ll | wc -l  
100651
emacs.git$ du -sh emacs.tar.gz .git/objects/pack/pack-144583582d53e273028966c6de2b3fb2fe3504bc.pack 
29M	emacs.tar.gz
138M	.git/objects/pack/pack-144583582d53e273028966c6de2b3fb2fe3504bc.pack

(from git://git.savannah.gnu.org/emacs.git )

-- 
Matthieu

^ permalink raw reply

* Re: Continue git clone after interruption
From: Jakub Narebski @ 2009-08-21 10:07 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Tomasz Kontusz, git, Johannes Schindelin, Scott Chacon
In-Reply-To: <alpine.LFD.2.00.0908201358010.6044@xanadu.home>

On Thu, 20 Aug 2009, Nicolas Pitre wrote:
> On Thu, 20 Aug 2009, Jakub Narebski wrote:
>> On Wed, 19 Aug 2009, Nicolas Pitre wrote:

>>> You'll get the very latest revision for HEAD, and only that.  The size 
>>> of the transfer will be roughly the size of a daily snapshot, except it 
>>> is fully up to date.  It is however non resumable in the event of a 
>>> network outage.  My proposal is to replace this with a "git archive" 
>>> call.  It won't get all branches, but for the purpose of initialising 
>>> one's repository that should be good enough.  And the "git archive" can 
>>> be fully resumable as I explained.
>> 
>> It is however only 2.5 MB out of 37 MB that are resumable, which is 7%
>> (well, that of course depends on repository).  Not that much that is
>> resumable.
> 
> Take the Linux kernel then.  It is more like 75 MB.

Ah... good example.

On the other hand Linux is fairly large project in terms of LoC, but
it had its history cut when moving to Git, so the ratio of git-archive
of HEAD to the size of packfile is overemphasized here.

>>> Now to deepen that history.  Let's say you want 10 more revisions going 
>>> back then you simply perform the fetch again with a --depth=10.  Right 
>>> now it doesn't seem to work optimally, but the pack that is then being 
>>> sent could be made of deltas against objects found in the commits we 
>>> already have.  Currently it seems that a pack that also includes those 
>>> objects we already have in addition to those we want is created, which 
>>> is IMHO a flaw in the shallow support that shouldn't be too hard to fix.  
>>> Each level of deepening should then be as small as standard fetches 
>>> going forward when updating the repository with new revisions.
>> 
>> You would have the same (or at least quite similar) problems with 
>> deepening part (the 'incrementals' transfer part) as you found with my
>> first proposal of server bisection / division of rev-list, and serving
>> 1/Nth of revisions (where N is selected so packfile is reasonable) to
>> client as incrementals.  Yours is top-down, mine was bottom-up approach
>> to sending series of smaller packs.  The problem is how to select size
>> of incrementals, and that incrementals are all-or-nothing (but see also
>> comment below).
> 
> Yes and no.  Combined with a slight reordering of commit objects, it 
> could be possible to receive a partial pack and still be able to extract 
> a bunch of full revisions.  The biggest issue is to be able to transfer 
> revision x (75 MB for Linux), but revision x-1 usually requires only a 
> few kilobytes, revision x-2 a few other kilobytes, etc.  Remember that 
> you are likely to have only a few deltas from one revision to another, 
> which is not the case for the very first revision you get.

Let's reiterate again, to be sure that I understand this correctly:


You make use here of a few facts:

1. Objects in packfile are _usually_ sorted in recency order, with most
   recent commits, and most recent versions of trees and tags being in
   the front of pack file, and being base objects for a large set of 
   objects.  Note the "usually" part; it is not set in stone as for RCS
   (and CVS) reverse delta based repository format.

2. There is support in git pack format to do 'deepening' of shallow
   clone, which means that git can generate incrementals in top-down
   order, _similar to how objects are ordered in packfile_.

3. git-archive output is stable.  _git-archive can be made resumable_
   (with range/partial requests), and can be made so it can create
   single-head depth 0 shallow clone.

Also, with top-down deepening order even if you don't use 
'git clone --continue' but 'git clone --skip' (or something), you
would have got usable shallow clone.  In the most extreme case when
you are able to get only the fully resumable part, i.e. git-archive
part (with top commit), you would have single-branch depth 0
shallow clone (not very usable, but still better than nothing).

> A special 
> mode to pack-object could place commit objects only after all the 
> objects needed to create that revision.  So once you get a commit object 
> on the receiving end, you could assume that all objects reachable from 
> that commit are already received, or you had them locally already.

Yes, with such mode (which I think wouldn't reduce / interfere with
ability for upload-pack to pack more tightly by reordering objects
and choosing different deltas) it would be easy to do a salvage of
a partially completed / transferred packfile.  Even if there is no
extension to tell git server which objects we have ("have" is only
about commits), if there is at least one commit object in received
part of packfile, we can try to continue from later (from more);
there is less left to download.

> 
>> In proposal using git-archive and shallow clone deepening as incrementals
>> you have this small seed (how small it depends on repository: 50% - 5%)
>> which is resumable.  And presumably with deepening you can somehow make
>> some use from incomplete packfile, only part of which was transferred 
>> before network error / disconnect.  And even tell server about objects
>> which you managed to extract from *.pack.part.
> 
> yes.  And at that point resuming the transfer is just another case of 
> shallow repository deepening.

Also for deepening top-down incrementals like in your proposal you can
have 'salvage' operation which tries to use something out of partially
transferred packfile (partially downloaded incremental).  It is not, 
I think, the case with my earlier 'server bisect' bottom-up incrementals
idea.

> 
>> *NEW IDEA*
>> 
>> Another solution would be to try to come up with some sort of stable
>> sorting of objects so that packfile generated for the same parameters
>> (endpoints) would be always byte-for-byte the same.  But that might be
>> difficult, or even impossible.
> 
> And I don't want to commit to that either.  Having some flexibility in 
> object ordering makes it possible to improve on the packing heuristics.  
> We certainly should avoid imposing strong restrictions like that for 
> little gain.  Even the deltas are likely to be different from one 
> request to another when using threads as one thread might be getting 
> more CPU time than another slightly modifying the outcome.

Right.

>> Well, we could send the list of objects in pack in order used later by
>> pack creation to client (non-resumable but small part), and if packfile
>> transport was interrupted in the middle client would compare list of 
>> complete objects in part of packfile against this manifest, and sent
>> request to server with *sorted* list of object it doesn't have yet.
> 
> Well... actually that's one of the item for pack V4.  Lots of SHA1s are 
> duplicated in tree and commit objects, in addition to the pack index 
> file.  With pack v4 all those SHA1s would be stored only once in a table 
> and objects would index that table instead.
> 
> Still, that is not _that_ small though.  Just look at the size of the 
> pack index file for the Linux repository to give you an idea.

Well, as such plan (map) of a packfile wouldn't be much smaller than
pack index, if pack index file is large enough (or connection crappy
enough) that it couldn't be transferred without interruption.

Nevertheless 34 MB index for largest 310 MB packfile in Linux kernel
http://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/objects/pack/
isn't something very large.  And objects-list / plan of packfile would
be of comparable size.
 

I was envisioning packfile plan (packfile map) as something like that

  sha1 TERMINATOR

for objects that are not deltified in the packfile, and

  sha1 SEPARATOR base-sha1 TERMINATOR

for objects that are deltified (or something like that; we could use
pkt-line format instead).

>> Server would probably have to check validity of objects list first (the
>> object list might be needed to be more than just object list; it might
>> need to specify topology of deltas, i.e. which objects are base for which
>> ones).  Then it would generate rest of packfile.
> 
> I'm afraid that has the looks of something adding lots of complexity to 
> a piece of git that is already quite complex already, namely 
> pack-objects.  And there is already only a few individuals with their 
> brain around it.

Well, with complexity or server CPU/IO because one should not trust 
client (unfortunately), with 'packfile plan' transfer being non-resumable,
and also with requiring packv4 or a temporary file or memory to send 
packfile plan (packfile map)... I think we can scrape that half-baked
idea.

>>>> [...] I don't know enough
>>>> about 'shallow' capability (and what it enables) to know whether
>>>> it can be used for that.  Can you elaborate?
>>> 
>>> See above, or Documentation/technical/shallow.txt.
>>  
>> Documentation/technical/shallow.txt doesn't cover "shallow", "unshallow"
>> and "deepen" commands from 'shallow' capability extension to git pack
>> protocol (http://git-scm.com/gitserver.txt).
> 
> 404 Not Found
> 
> Maybe that should be committed to git in Documentation/technical/  as 
> well?

This was plain text RFC for the Git Packfile Protocol, generated from
rfc2629 XML sources at http://github.com/schacon/gitserver-rfc


Scott, what happened to http://git-scm.com/gitserver.txt? 

And could you create 'rfc' or 'text' branch in gitserver-rfc
repository, with processed plain/text output, similar to 'man' and
'html' branches in git.git repository? TIA.


_Some_ description of pack protocol can be found in git mailing list
archives
  http://thread.gmane.org/gmane.comp.version-control.git/118956
in "The Git Community Book"
  http://book.git-scm.com/7_transfer_protocols.html
  http://github.com/schacon/gitbook/blob/master/text/54_Transfer_Protocols/0_Transfer_Protocols.markdown
and in "Pro Git"
  http://progit.org/book/ch9-6.html
  http://github.com/progit/progit/blob/master/en/09-git-internals/01-chapter9.markdown

The description in Documentation/technical/pack-protocol.txt is very
brief, and Documentation/technical/shallow.txt doesn't cover 'shallow'
capability of git pack protocol.
 
>>>> Then you have to finish clone / fetch.  All solutions so far include
>>>> some kind of incremental improvements.  My first proposal of bisect
>>>> fetching 1/nth or predefined size pack is buttom-up solution, where
>>>> we build full clone from root commits up.  You propose, from what
>>>> I understand build full clone from top commit down, using deepening
>>>> from shallow clone.  In this step you either get full incremental
>>>> or not; downloading incremental (from what I understand) is not
>>>> resumable / they do not support partial fetch.
>>> 
>>> Right.  However, like I said, the incremental part should be much 
>>> smaller and therefore less susceptible to network troubles.
>> 
>> If you have 7% total pack size of git-archive resumable part, how small
>> do you plan to have those incremental deepening?  Besides in my 1/Nth
>> proposal those bottom-up packs werealso meant to be sufficiently small
>> to avoid network troubles.
> 
> Two issues here: 1) people with slow links might not be interested in a 
> deep history as it costs them time.  2) Extra revisions should typically 
> require only a few KB each, therefore we might manage to ask for the 
> full history after the initial revision is downloaded and salvage as 
> much as we can if a network outage is encountered.  There is no need for 
> arbitrary size, unless the user decides arbitrarily to get only 10 more 
> revisions, or 100 more, etc.

Those two features of your proposal: 
1.) It is possible salvage of partially transferred packfiles (so there
    is no requirement to guess accurately what size should they be),
2.) After completing initial git-archive transfer, you can convert 
    incomplete clone into functioning repository.  It would be shallow
    clone, and can be missing some branches and tags, but you can work
    with it if network connection fails completely.
make it very compelling.

>> P.S. As you can see implementing resumable clone isn't easy...
> 
> I've been saying that all along for quite a while now.   ;-)

Well, on the other hand side we have example of how long it took to
come to current implementation of git submodules.  But if finally
got done.


The git-archive + deepening approach you proposed can be split into
smaller individual improvements.  You don't need to implement it all
at once.

1. Improve deepening of shallow clone.  This means sending only required
   objects, and being able to use as a base objects that other side has
   and send thin pack.

2. Add support for resuming (range request) of git-archive.  It is up
   to client to translate size of partial transfer of compressed file
   into range request of original (uncompressed) archive.

3. Create new git-archive pseudoformat, used to transfer single commit
   (with commit object and original branch name in some extended header,
   similar to how commit ID is stored in extended pax header or ZIP
   comment).  It would imply not using export-* gitattributes.

4. Implement alternate ordering of objects in packfile, so commit object
   is put immediately after all its prerequisites.

5. Implement 'salvage' operation, which given partially transferred 
   packfile would deepen shallow clone, or advance tracking branches,
   ensuring that repository would pass fsck after this operation.

   Probably requires 4; might be not possible or much harder to salvage
   anything with current ordering of objects in packfile.

6. Implement resumable clone ("git clone --keep <URL> [<directory>]",
   "git clone --resume" / "git clone --continue", "git clone --abort",
   "git clone --make-shallow" / "git clone --salvage").

   Requires 1-5.

-- 
Jakub Narebski
Poland

^ permalink raw reply

* Rebase with filters
From: Nigel Magnay @ 2009-08-21  9:41 UTC (permalink / raw)
  To: Git ML

Hello. I seem to be doing something wrong - that has previously caused
me to loose data (well, not really, the commit was still there, but it
took me a while to notice - gotta love the non-destructive nature of
git)

I have a project that contains a file that, irritatingly, an IDE will
always re-format on save, even if there are no changes. So, I use a
clean and smudge filter to re-order it into a sane format that's
easier to detect if there have actually been changes.

So far, so good. But, not everyone always uses this filter, and I get
some unexpected behavior when doing a 'git rebase'. For example - the
repository starts with a commit that has been sanely-ordered. I make a
change of several files, and commit locally - but when I come to push,
I find that origin/master has moved.

No worries, I do
git fetch
git rebase origin/master

Now I see the usual text going past, and including:

....
error: realtime/modules/realtime-flex-components/.flexLibProperties:
does not match index
Using index info to reconstruct a base tree...
<stdin>:59: trailing whitespace.

<stdin>:81: trailing whitespace.
			
<stdin>:83: trailing whitespace.
				parameters:[					
<stdin>:98: space before tab in indent.
   				if (item.value == null )
<stdin>:99: space before tab in indent.
   				{
warning: squelched 214 whitespace errors
warning: 219 lines add whitespace errors.
Falling back to patching base and 3-way merge...
error: Entry 'realtime/modules/realtime-flex-components/.flexLibProperties'
not uptodate. Cannot merge.
fatal: merging of trees 85b26f7c165c2a9d362340187b79527428b650e8 and
3ab3078b55e17dcb1f3f4c8e6a65eff517eedb92 failed
Failed to merge in the changes.
Patch failed at 0001 More KPI/Report work

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".


OK - looking a bit closer, someone committed .flexLibProperties
without the filter. I guess that's the "does not match index". Let's
merge..

 (|REBASE) $ git mergetool
No files need merging


Interesting - I guess there were no conflicts when the filtering was
all done. Let's just look at the status..

 (|REBASE) $ git status
# Not currently on any branch.
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   realtime/modules/realtime-flex-components/.flexLibProperties


Eek... Where's the rest of my files?!

My guess is that the "error" reported further up ought to terminate
the rebase without giving me the "When you have resolved this problem
run "git rebase --continue" because otherwise I end up loosing the
majority of the changes in my rebased commit.. ?

^ permalink raw reply

* [PATCH] test suite: add a check that all test numbers are unique
From: Johannes Sixt @ 2009-08-21  9:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

From: Johannes Sixt <j6t@kdbg.org>

The test runs only if 'make all' is used. Its purpose is to alert our
valued integrator if different branches are merged that happen to
introduce the same test number.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 t/Makefile                |    1 +
 t/check_unique_numbers.sh |   27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100755 t/check_unique_numbers.sh

diff --git a/t/Makefile b/t/Makefile
index bd09390..2a451b7 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -17,6 +17,7 @@ T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
 TSVN = $(wildcard t91[0-9][0-9]-*.sh)

 all: pre-clean
+	'$(SHELL_PATH_SQ)' ./check_unique_numbers.sh
 	$(MAKE) aggregate-results-and-cleanup

 $(T):
diff --git a/t/check_unique_numbers.sh b/t/check_unique_numbers.sh
new file mode 100755
index 0000000..e767275
--- /dev/null
+++ b/t/check_unique_numbers.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# checks whether test case numbers are unique;
+# returns non-zero if any duplicates were found
+
+check_numbers () {
+	last= dup=
+	while read name
+	do
+		case $name in
+		t[0-9][0-9][0-9][0-9]-*.sh)
+			number=${name%%-*}
+			if test "$number" = "$last"; then
+				dup="$dup $number"
+			fi
+			last=$number
+			;;
+		esac
+	done
+	test -z "$dup" || {
+		echo >&2 "error: duplicate test numbers:" $dup
+		return 1
+	}
+}
+
+ls -1 |	# no wildcard to avoid overflow of command line
+check_numbers
-- 
1.6.4.204.g6aad7

^ permalink raw reply related

* Re: [RFC PATCH v4 04/19] Teach Git to respect skip-worktree bit  (reading part)
From: Nguyen Thai Ngoc Duy @ 2009-08-21  9:19 UTC (permalink / raw)
  To: git
In-Reply-To: <1250776033-12395-5-git-send-email-pclouds@gmail.com>

2009/8/20 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:
> grep: turn on --cached for files that is marked skip-worktree
> ls-files: do not check for deleted file that is marked skip-worktree
> update-index: ignore update request if it's skip-worktree, while still allows removing
> diff*: skip worktree version

I kept reminding myself and still managed to miss it. skip-worktree
bit is not completely independent from assume-unchanged. It shares
CE_MATCH_IGNORE_VALID flag in ie_match_stat(). Should have mentioned
that in commit log.
-- 
Duy

^ permalink raw reply

* Re: [RFC PATCH v4 00/19] Sparse checkout
From: Nguyen Thai Ngoc Duy @ 2009-08-21  9:15 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vprapip1v.fsf@alter.siamese.dyndns.org>

2009/8/21 Junio C Hamano <gitster@pobox.com>:
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> The recent assume-unchanged "breakage" that lets Git overwrite
>> assume-unchanged files worried me. I sat back, checked and wrote tests
>
> Yeah, it worries me, too.  Does the fix to make sure the sparse stuff
> won't be broken apply equally to assume-unchanged?  Does the series have
> such fixes to assume-unchanged bit as well?

This series does not fix assume-unchanged bit. I'd like to focus on
skip-worktree bit now. I still need to write a few more tests for
git-apply, git-checkout... but I think they are safe. It's up to you
to see if changes apply to assume-unchanged bit, in patches 4/19 and
5/19. I don't know if I understand assume-unchanged semantics
correctly anymore :-)

Anyway I think we could put a big fat warning above ce_uptodate()
macro definition, saying that this bit/macro could be faked by
assume-unchanged or skip-worktree bit, so don't rely on that macro
when it comes to writing (at least for skip-worktree part).

Hmm.. _or_ we could make it clear whether it is truly uptodate, or
faked uptodate. Some code path will be updated to only trust "truly
uptodate" bit, which is clearer and easier to grasp than messy logics
like "if (ce_uptodate(ce) && !ce_skip_worktree(ce))". Something like
this as a starting point (for demonstration only, I don't think it
compiles)

diff --git a/cache.h b/cache.h
index a401daf..05fb746 100644
--- a/cache.h
+++ b/cache.h
@@ -179,6 +179,7 @@ struct cache_entry {

 /* Only remove in work directory, not index */
 #define CE_WT_REMOVE (0x400000)
+#define CE_ASSUME_UPTODATE  (0x800000)

 /*
  * Extended on-disk flags
@@ -236,9 +237,11 @@ static inline size_t ce_namelen(const struct
cache_entry *ce)
 			    ondisk_cache_entry_extended_size(ce_namelen(ce)) : \
 			    ondisk_cache_entry_size(ce_namelen(ce)))
 #define ce_stage(ce) ((CE_STAGEMASK & (ce)->ce_flags) >> CE_STAGESHIFT)
-#define ce_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE)
+#define ce_truely_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE)
+#define ce_uptodate(ce) ((ce)->ce_flags & (CE_UPTODATE | CE_ASSUME_UPTODATE))
 #define ce_skip_worktree(ce) ((ce)->ce_flags & CE_SKIP_WORKTREE)
 #define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE)
+#define ce_mark_assume_uptodate(ce) ((ce)->ce_flags |= CE_ASSUME_UPTODATE)

 #define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
 static inline unsigned int create_ce_mode(unsigned int mode)
diff --git a/read-cache.c b/read-cache.c
index 5ee7d9d..c022955 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1005,7 +1005,7 @@ static struct cache_entry
*refresh_cache_ent(struct index_state *istate,
 		return ce;

 	if (!ignore_valid && ((ce->ce_flags & CE_VALID) || ce_skip_worktree(ce))) {
-		ce_mark_uptodate(ce);
+		ce_mark_assume_uptodate(ce);
 		return ce;
 	}

Still thinking of it. Seems like a good change...

> By the way, I think the first patch in the earlier series, 540e694
> (Prevent diff machinery from examining assume-unchanged entries on
> worktree, 2009-08-11), is a good change regardless of the sparse
> implementation, and I'm inclined to say that we should merge that part
> (and I suspect there will be similar fixes to really ignore differences to
> CE_VALID entries) first and then queue this new series on top.

I have no problem with that.
-- 
Duy

^ permalink raw reply related

* Re: What's cooking in git.git (Aug 2009, #03; Thu, 20)
From: Paolo Bonzini @ 2009-08-21  9:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7veir5naq3.fsf@alter.siamese.dyndns.org>

On 08/21/2009 04:48 AM, Junio C Hamano wrote:
> Has been ejected from 'pu' for some time, expecting a reroll.

I've been trying for a while to have push refspecs and tracking working 
together, but haven't come with anything that I like.

I'll let it sleep for a while so that I can look at the problem again 
with a fresh mind when I come back to it.

Paolo

^ permalink raw reply

* [PATCH 1/2] Rename REFRESH_SAY_CHANGED to REFRESH_IN_PORCELAIN.
From: Matthieu Moy @ 2009-08-21  8:57 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy
In-Reply-To: <vpqljlipcs6.fsf@bauges.imag.fr>

The change in the output is going to become more general than just saying
"changed", so let's make the variable name more general too.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 builtin-add.c   |    2 +-
 builtin-reset.c |    4 ++--
 cache.h         |    2 +-
 read-cache.c    |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin-add.c b/builtin-add.c
index 581a2a1..a325bc9 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -105,7 +105,7 @@ static void refresh(int verbose, const char **pathspec)
 	for (specs = 0; pathspec[specs];  specs++)
 		/* nothing */;
 	seen = xcalloc(specs, 1);
-	refresh_index(&the_index, verbose ? REFRESH_SAY_CHANGED : REFRESH_QUIET,
+	refresh_index(&the_index, verbose ? REFRESH_IN_PORCELAIN : REFRESH_QUIET,
 		      pathspec, seen);
 	for (i = 0; i < specs; i++) {
 		if (!seen[i])
diff --git a/builtin-reset.c b/builtin-reset.c
index 5fa1789..ddf68d5 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -261,7 +261,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 			die("Cannot do %s reset with paths.",
 					reset_type_names[reset_type]);
 		return read_from_tree(prefix, argv + i, sha1,
-				quiet ? REFRESH_QUIET : REFRESH_SAY_CHANGED);
+				quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN);
 	}
 	if (reset_type == NONE)
 		reset_type = MIXED; /* by default */
@@ -302,7 +302,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 		break;
 	case MIXED: /* Report what has not been updated. */
 		update_index_refresh(0, NULL,
-				quiet ? REFRESH_QUIET : REFRESH_SAY_CHANGED);
+				quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN);
 		break;
 	}
 
diff --git a/cache.h b/cache.h
index 9222774..ae0e83e 100644
--- a/cache.h
+++ b/cache.h
@@ -476,7 +476,7 @@ extern int check_path(const char *path, int len, struct stat *st);
 #define REFRESH_QUIET		0x0004	/* be quiet about it */
 #define REFRESH_IGNORE_MISSING	0x0008	/* ignore non-existent */
 #define REFRESH_IGNORE_SUBMODULES	0x0010	/* ignore submodules */
-#define REFRESH_SAY_CHANGED	0x0020	/* say "changed" not "needs update" */
+#define REFRESH_IN_PORCELAIN	0x0020	/* user friendly output, not "needs update" */
 extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen);
 
 struct lock_file {
diff --git a/read-cache.c b/read-cache.c
index 4e3e272..f1aff81 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1077,7 +1077,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
 	unsigned int options = really ? CE_MATCH_IGNORE_VALID : 0;
 	const char *needs_update_message;
 
-	needs_update_message = ((flags & REFRESH_SAY_CHANGED)
+	needs_update_message = ((flags & REFRESH_IN_PORCELAIN)
 				? "locally modified" : "needs update");
 	for (i = 0; i < istate->cache_nr; i++) {
 		struct cache_entry *ce, *new;
-- 
1.6.4.187.gd399.dirty

^ permalink raw reply related

* [PATCH 2/2 (v3)] reset: make the output more user-friendly.
From: Matthieu Moy @ 2009-08-21  8:57 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy
In-Reply-To: <1250845079-30614-1-git-send-email-Matthieu.Moy@imag.fr>

git reset without argument displays a summary of the remaining
unstaged changes. The problem with these is that they look like an
error message, and the format is inconsistant with the format used in
other places like "git diff --name-status".

This patch mimics the output of "git diff --name-status", and adds a
header to make it clear the output is informative, and not an error.

It also changes the output of "git add --refresh --verbose" in the same
way.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---

In previous version, I hadn't noticed that the same message was
displayed for 'git reset' and for 'git add --refresh --verbose'. This
new version takes both cases into account, and avoids saying "after
reset" when the user called "add".

 builtin-add.c    |    2 +-
 builtin-reset.c  |    3 ++-
 cache.h          |    4 ++--
 read-cache.c     |   26 ++++++++++++++++++++------
 t/t7102-reset.sh |    3 ++-
 5 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/builtin-add.c b/builtin-add.c
index a325bc9..006fd08 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -106,7 +106,7 @@ static void refresh(int verbose, const char **pathspec)
 		/* nothing */;
 	seen = xcalloc(specs, 1);
 	refresh_index(&the_index, verbose ? REFRESH_IN_PORCELAIN : REFRESH_QUIET,
-		      pathspec, seen);
+		      pathspec, seen, "Unstaged changes after refreshing the index:");
 	for (i = 0; i < specs; i++) {
 		if (!seen[i])
 			die("pathspec '%s' did not match any files", pathspec[i]);
diff --git a/builtin-reset.c b/builtin-reset.c
index ddf68d5..0fc0b07 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -108,7 +108,8 @@ static int update_index_refresh(int fd, struct lock_file *index_lock, int flags)
 	if (read_cache() < 0)
 		return error("Could not read index");
 
-	result = refresh_cache(flags) ? 1 : 0;
+	result = refresh_index(&the_index, (flags), NULL, NULL,
+			       "Unstaged changes after reset:") ? 1 : 0;
 	if (write_cache(fd, active_cache, active_nr) ||
 			commit_locked_index(index_lock))
 		return error ("Could not refresh index");
diff --git a/cache.h b/cache.h
index ae0e83e..fda9816 100644
--- a/cache.h
+++ b/cache.h
@@ -330,7 +330,7 @@ static inline void remove_name_hash(struct cache_entry *ce)
 #define remove_file_from_cache(path) remove_file_from_index(&the_index, (path))
 #define add_to_cache(path, st, flags) add_to_index(&the_index, (path), (st), (flags))
 #define add_file_to_cache(path, flags) add_file_to_index(&the_index, (path), (flags))
-#define refresh_cache(flags) refresh_index(&the_index, (flags), NULL, NULL)
+#define refresh_cache(flags) refresh_index(&the_index, (flags), NULL, NULL, NULL)
 #define ce_match_stat(ce, st, options) ie_match_stat(&the_index, (ce), (st), (options))
 #define ce_modified(ce, st, options) ie_modified(&the_index, (ce), (st), (options))
 #define cache_name_exists(name, namelen, igncase) index_name_exists(&the_index, (name), (namelen), (igncase))
@@ -477,7 +477,7 @@ extern int check_path(const char *path, int len, struct stat *st);
 #define REFRESH_IGNORE_MISSING	0x0008	/* ignore non-existent */
 #define REFRESH_IGNORE_SUBMODULES	0x0010	/* ignore submodules */
 #define REFRESH_IN_PORCELAIN	0x0020	/* user friendly output, not "needs update" */
-extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen);
+extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen, char *header_msg);
 
 struct lock_file {
 	struct lock_file *next;
diff --git a/read-cache.c b/read-cache.c
index f1aff81..1bbaf1c 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1065,7 +1065,18 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
 	return updated;
 }
 
-int refresh_index(struct index_state *istate, unsigned int flags, const char **pathspec, char *seen)
+static void show_file(const char * fmt, const char * name, int in_porcelain,
+		      int * first, char *header_msg)
+{
+	if (in_porcelain && *first && header_msg) {
+		printf("%s\n", header_msg);
+		*first=0;
+	}
+	printf(fmt, name);
+}
+
+int refresh_index(struct index_state *istate, unsigned int flags, const char **pathspec,
+		  char *seen, char *header_msg)
 {
 	int i;
 	int has_errors = 0;
@@ -1074,11 +1085,14 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
 	int quiet = (flags & REFRESH_QUIET) != 0;
 	int not_new = (flags & REFRESH_IGNORE_MISSING) != 0;
 	int ignore_submodules = (flags & REFRESH_IGNORE_SUBMODULES) != 0;
+	int first = 1;
+	int in_porcelain = (flags & REFRESH_IN_PORCELAIN);
 	unsigned int options = really ? CE_MATCH_IGNORE_VALID : 0;
-	const char *needs_update_message;
+	const char *needs_update_fmt;
+	const char *needs_merge_fmt;
 
-	needs_update_message = ((flags & REFRESH_IN_PORCELAIN)
-				? "locally modified" : "needs update");
+	needs_update_fmt = (in_porcelain ? "M\t%s\n" : "%s: needs update\n");
+	needs_merge_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n");
 	for (i = 0; i < istate->cache_nr; i++) {
 		struct cache_entry *ce, *new;
 		int cache_errno = 0;
@@ -1094,7 +1108,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
 			i--;
 			if (allow_unmerged)
 				continue;
-			printf("%s: needs merge\n", ce->name);
+			show_file(needs_merge_fmt, ce->name, in_porcelain, &first, header_msg);
 			has_errors = 1;
 			continue;
 		}
@@ -1117,7 +1131,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
 			}
 			if (quiet)
 				continue;
-			printf("%s: %s\n", ce->name, needs_update_message);
+			show_file(needs_update_fmt, ce->name, in_porcelain, &first, header_msg);
 			has_errors = 1;
 			continue;
 		}
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index e637c7d..e85ff02 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -419,7 +419,8 @@ test_expect_success 'resetting an unmodified path is a no-op' '
 '
 
 cat > expect << EOF
-file2: locally modified
+Unstaged changes after reset:
+M	file2
 EOF
 
 test_expect_success '--mixed refreshes the index' '
-- 
1.6.4.187.gd399.dirty

^ permalink raw reply related

* Re: [PATCH] Make test number t7406- unique
From: Johan Herland @ 2009-08-21  8:50 UTC (permalink / raw)
  To: git; +Cc: Johannes Sixt, Junio C Hamano
In-Reply-To: <4A8E5B99.3080705@viscovery.net>

On Friday 21 August 2009, Johannes Sixt wrote:
> We skip t7407 because a patch series is cooking that uses is.

Alternatively, you could reuse t7404 which is not used (in my checkout at 
least). E.g.:

mv t7405-submodule-merge.sh t7404-submodule-merge.sh
mv t7406-submodule-reference.sh t7405-submodule-reference.sh 


Have fun! :)

...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net

^ permalink raw reply

* [PATCH] Make test number t7406- unique
From: Johannes Sixt @ 2009-08-21  8:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

From: Johannes Sixt <j6t@kdbg.org>

We skip t7407 because a patch series is cooking that uses is.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 ...e-reference.sh => t7408-submodule-reference.sh} |    0
 1 files changed, 0 insertions(+), 0 deletions(-)
 rename t/{t7406-submodule-reference.sh => t7408-submodule-reference.sh} (100%)

diff --git a/t/t7406-submodule-reference.sh b/t/t7408-submodule-reference.sh
similarity index 100%
rename from t/t7406-submodule-reference.sh
rename to t/t7408-submodule-reference.sh
-- 
1.6.4.204.g6aad7

^ permalink raw reply

* Re: [PATCH v2 5/9] revert: libify pick
From: Junio C Hamano @ 2009-08-21  7:50 UTC (permalink / raw)
  To: Christian Couder
  Cc: Junio C Hamano, git, Johannes Schindelin, Stephan Beyer,
	Daniel Barkalow, Jakub Narebski
In-Reply-To: <20090821055001.3726.15854.chriscool@tuxfamily.org>

Christian Couder <chriscool@tuxfamily.org> writes:

> From: Stephan Beyer <s-beyer@gmx.net>
>
> This commit is made of code from the sequencer GSoC project:
>
> git://repo.or.cz/git/sbeyer.git
>
> (commit 5a78908b70ceb5a4ea9fd4b82f07ceba1f019079)
>
> The goal of this commit is to abstract out pick functionnality
> into a new pick() function made of code from "builtin-revert.c".
>
> The new pick() function is in a new "pick.c" file with an
> associated "pick.h".

Is it pick() or pick_commit()?

By the way, this comment applies to other messages in the series, but do
these original commits by Stephan lack any meaningful messages?  I would
actually have expected to see a commit log message that looks more like:

	From: Stephan Beyer <...>

        Meaningful log message Stephan describes what this commit does in
        sufficient detail, perhaps with clarification and rewording by
        Christian.

	Second and subsequent paragraph to explain it as necessary.

	[cc: this is based on 5a78908b70ceb5a4ea9fd4b82f07ceba1f019079
        from Stephan's git://repo.or.cz/git/sbeyer.git]

        Signed-off-by: ...

The point is that the "origin info" would be a side-note, not the first
and the most important thing in the message.

^ permalink raw reply

* Re: [RFC PATCH v4 00/19] Sparse checkout
From: Junio C Hamano @ 2009-08-21  7:50 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1250776033-12395-1-git-send-email-pclouds@gmail.com>

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> The recent assume-unchanged "breakage" that lets Git overwrite
> assume-unchanged files worried me. I sat back, checked and wrote tests

Yeah, it worries me, too.  Does the fix to make sure the sparse stuff
won't be broken apply equally to assume-unchanged?  Does the series have
such fixes to assume-unchanged bit as well?

By the way, I think the first patch in the earlier series, 540e694
(Prevent diff machinery from examining assume-unchanged entries on
worktree, 2009-08-11), is a good change regardless of the sparse
implementation, and I'm inclined to say that we should merge that part
(and I suspect there will be similar fixes to really ignore differences to
CE_VALID entries) first and then queue this new series on top.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox