Git development
 help / color / mirror / Atom feed
* [PATCH] bash: support 'git notes' and its subcommands
From: SZEDER Gábor @ 2010-01-28  1:05 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git, Junio C Hamano, SZEDER Gábor

... and it will offer refs unless after -m or -F, because these two
options require a non-ref argument.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9651720..8b56c34 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1306,6 +1306,24 @@ _git_name_rev ()
 	__gitcomp "--tags --all --stdin"
 }
 
+_git_notes ()
+{
+	local subcommands="edit show"
+	if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
+		__gitcomp "$subcommands"
+		return
+	fi
+
+	case "${COMP_WORDS[COMP_CWORD-1]}" in
+	-m|-F)
+		COMPREPLY=()
+		;;
+	*)
+		__gitcomp "$(__git_refs)"
+		;;
+	esac
+}
+
 _git_pull ()
 {
 	__git_complete_strategy && return
@@ -2218,6 +2236,7 @@ _git ()
 	merge-base)  _git_merge_base ;;
 	mv)          _git_mv ;;
 	name-rev)    _git_name_rev ;;
+	notes)       _git_notes ;;
 	pull)        _git_pull ;;
 	push)        _git_push ;;
 	rebase)      _git_rebase ;;
-- 
1.7.0.rc0.28.g3ad3d5

^ permalink raw reply related

* Re: [PATCHv12 00/23] git notes
From: Johan Herland @ 2010-01-28  1:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vk4v3nlji.fsf@alter.siamese.dyndns.org>

On Thursday 28 January 2010, Junio C Hamano wrote:
> The earlier frustration of mine was about adding a note, not adding _to_
>  a note.  The semantic difference I described with add/edit was "adding
>  anew" vs "modify".
> 
> Once I realize that Dscho's original "edit" lacks an explicit "adding
> anew" and it simply means "replace if exists otherwise add", then I can
> agree the argument that "adding anew" mode is not necessary.
> 
> The semantic difference your add/edit try to capture works at a different
> level.  They are "append to it" vs "replace it".  Current "edit -m 'foo'"
> that replaces feels to me quite counterintuitive.
> 
> If two modes are useful, then I would suggest to deprecate the use of
> "edit" subcommand with -m/-F (because its name doesn't tell the user
>  which one between "append" and "replace" it happens to implement) and
>  instead introduce two more explicit subcommands, "append" and "replace".
>   For the same reason, "add" would cause confusion between "is this to
>  add a new note" vs "is this to add _to_ a new note", and I'd recommend
>  against it.
> 
> "edit" could still open an editor to "modify" existing one (and if there
> is no existing one, then the editor starts empty).
> 
> On the other hand, if "replace" is not very useful, then it might be
> enough to just introduce a new "append" subcommand.  Or course, we could
> redefine the useless "replace" semantics from "edit -m/-F" and change it
> to always append.

Ok, I see your point, and I largely agree with your analysis. I'll attempt 
to summarize what we want from "git notes" in this regard:

- git notes add: Add a new note. Open editor for giving the note contents.
  Barf if a note already exists for the given object.

	Options:
	-m <msg>, --message <msg>: Specify note contents on command-line instead
		of opening editor. (Multiple -m options are concatenated.)

	-F <file>, --file <file>: Get note contents from the given file instead
		of opening editor.

	-f, --force: Instead of barfing, replace/overwrite existing notes.

- git notes append: Append to an existing note; create new note if needed.
  Open editor for giving the (additional) note contents.

	Options:
	-m <msg>, --message <msg>: (Same as above)
	-F <file>, --file <file>: (Same as above)

- git notes edit: Edit an existing note. Create new note if needed (?)
  Open editor for editing the existing note contents.

	No options (deprecate existing -m and -F options)

Is this what you had in mind? AFAICS it should cover all interesting use 
cases.


...Johan

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

^ permalink raw reply

* Re: [PATCH] bash: support 'git notes' and its subcommands
From: Shawn O. Pearce @ 2010-01-28  1:21 UTC (permalink / raw)
  To: SZEDER G??bor; +Cc: git, Junio C Hamano
In-Reply-To: <1264640755-22447-1-git-send-email-szeder@ira.uka.de>

SZEDER G??bor <szeder@ira.uka.de> wrote:
> ... and it will offer refs unless after -m or -F, because these two
> options require a non-ref argument.
> 
> Signed-off-by: SZEDER G??bor <szeder@ira.uka.de>
> ---
>  contrib/completion/git-completion.bash |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)

Acked-by: Shawn O. Pearce <spearce@spearce.org>
 
-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] bash: support 'git notes' and its subcommands
From: Johan Herland @ 2010-01-28  1:23 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: git, Shawn O. Pearce, Junio C Hamano
In-Reply-To: <1264640755-22447-1-git-send-email-szeder@ira.uka.de>

On Thursday 28 January 2010, SZEDER Gábor wrote:
> ... and it will offer refs unless after -m or -F, because these two
> options require a non-ref argument.

Maybe-NAK.

The patch is probably good in itself, and the intent is certainly good, but 
we're currently discussing deprecating the -m/-F options to "git notes edit" 
(see http://article.gmane.org/gmane.comp.version-control.git/138215), and if 
that's where we go, there's no point "encouraging" their use by adding bash-
completions for them...


...Johan

> 
> Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
> ---
>  contrib/completion/git-completion.bash |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash
>  b/contrib/completion/git-completion.bash index 9651720..8b56c34 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1306,6 +1306,24 @@ _git_name_rev ()
>  	__gitcomp "--tags --all --stdin"
>  }
> 
> +_git_notes ()
> +{
> +	local subcommands="edit show"
> +	if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
> +		__gitcomp "$subcommands"
> +		return
> +	fi
> +
> +	case "${COMP_WORDS[COMP_CWORD-1]}" in
> +	-m|-F)
> +		COMPREPLY=()
> +		;;
> +	*)
> +		__gitcomp "$(__git_refs)"
> +		;;
> +	esac
> +}
> +
>  _git_pull ()
>  {
>  	__git_complete_strategy && return
> @@ -2218,6 +2236,7 @@ _git ()
>  	merge-base)  _git_merge_base ;;
>  	mv)          _git_mv ;;
>  	name-rev)    _git_name_rev ;;
> +	notes)       _git_notes ;;
>  	pull)        _git_pull ;;
>  	push)        _git_push ;;
>  	rebase)      _git_rebase ;;
> 


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

^ permalink raw reply

* Re: [PATCH] git-gui: use themed tk widgets with Tk 8.5
From: Johannes Schindelin @ 2010-01-28  1:45 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Pat Thoyts, git, msysgit
In-Reply-To: <20100128005142.GK5452@spearce.org>

Hi,

On Wed, 27 Jan 2010, Shawn O. Pearce wrote:

> Pat Thoyts <patthoyts@users.sourceforge.net> wrote:
> > 
> > This patch enables the use of themed Tk widgets with Tk 8.5 and above.
> > These make a significant difference on Windows in making the
> > application appear native. On Windows and MacOSX ttk defaults to the
> > native look as much as possible. On X11 the user may select a theme
> > using the TkTheme XRDB resource class by adding an line to the
> > .Xresources file. The set of installed theme names is available using
> > the Tk command 'ttk::themes'. The default on X11 is similar to the current
> > un-themed style - a kind of thin bordered motif look.
> > 
> > A new git config variable 'gui.usettk' may be set to disable this if
> > the user prefers the classic Tk look. Using Tk 8.4 will also avoid the
> > use of themed widgets as these are only available since 8.5.
> > 
> > Some support is included for Tk 8.6 features (themed spinbox and native
> > font chooser for MacOSX and Windows).
> 
> Thanks.  I've been running with this pretty much all day today;
> it seems sane.  I'll probably push it shortly.

Thanks.  Can you notify me when you do so?  I will merge into 4msysgit.git 
directly then.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] git-gui: use themed tk widgets with Tk 8.5
From: Shawn O. Pearce @ 2010-01-28  1:42 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Pat Thoyts, git, msysgit
In-Reply-To: <alpine.DEB.1.00.1001280244430.4985@pacific.mpi-cbg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Wed, 27 Jan 2010, Shawn O. Pearce wrote:
> > Pat Thoyts <patthoyts@users.sourceforge.net> wrote:
> > > 
> > > This patch enables the use of themed Tk widgets with Tk 8.5 and above.
...
> > Thanks.  I've been running with this pretty much all day today;
> > it seems sane.  I'll probably push it shortly.
> 
> Thanks.  Can you notify me when you do so?  I will merge into 4msysgit.git 
> directly then.

Its already there.

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] git-gui: use themed tk widgets with Tk 8.5
From: Junio C Hamano @ 2010-01-28  2:54 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Johannes Schindelin, Pat Thoyts, git, msysgit
In-Reply-To: <20100128014205.GA8166@spearce.org>

"Shawn O. Pearce" <spearce@spearce.org> writes:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>> On Wed, 27 Jan 2010, Shawn O. Pearce wrote:
>> > Pat Thoyts <patthoyts@users.sourceforge.net> wrote:
>> > > 
>> > > This patch enables the use of themed Tk widgets with Tk 8.5 and above.
> ...
>> > Thanks.  I've been running with this pretty much all day today;
>> > it seems sane.  I'll probably push it shortly.
>> 
>> Thanks.  Can you notify me when you do so?  I will merge into 4msysgit.git 
>> directly then.
>
> Its already there.

Is that an insn for me to pull?

^ permalink raw reply

* Re: make install error
From: Junio C Hamano @ 2010-01-28  2:53 UTC (permalink / raw)
  To: kap4lin; +Cc: git
In-Reply-To: <daef5be81001271658y4188445bofea2e3d576df91e5@mail.gmail.com>

kap4lin <kap4lin@gmail.com> writes:

> (cd blt && gtar cf - .) | \
>         (cd '/scratch/kap4lin/usr/share/git-core/templates' && umask
> 022 && gtar xof -)
> gtar: This does not look like a tar archive
> gtar: Skipping to next header
> gtar: Archive contains obsolescent base-64 headers
> gtar: Error exit delayed from previous errors
> make[1]: *** [install] Error 2
> make[1]: Leaving directory `/scratch/kap4lin/softwares/git-1.6.6.1/templates'
> make: *** [install] Error 2
>
> Any help?

Perhaps "unset CDPATH".

Also look for "export CDPATH" in your .bash_profile and remove it (and
either remove CDPATH=... from your .bashrc or make it conditional only to
interactive sessions).  Setting CDPATH for non-interactive sessions does
not make any sense and asking for troubles.

^ permalink raw reply

* Re: [PATCH] git-gui: use themed tk widgets with Tk 8.5
From: Shawn O. Pearce @ 2010-01-28  2:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, Pat Thoyts, git, msysgit
In-Reply-To: <7v4om7ndm4.fsf@alter.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> >> On Wed, 27 Jan 2010, Shawn O. Pearce wrote:
> >> > Pat Thoyts <patthoyts@users.sourceforge.net> wrote:
> >> > > 
> >> > > This patch enables the use of themed Tk widgets with Tk 8.5 and above.
> > ...
> >> > Thanks.  I've been running with this pretty much all day today;
> >> > it seems sane.  I'll probably push it shortly.
> >> 
> >> Thanks.  Can you notify me when you do so?  I will merge into 4msysgit.git 
> >> directly then.
> >
> > Its already there.
> 
> Is that an insn for me to pull?

You can pull my master branch if you like; though I wouldn't suggest
it for anything other than 'next' yet:


The following changes since commit 87cd09f43e56de5235d09aef3ff5d840419fef49:
  Giuseppe Bilotta (1):
        git-gui: work from the .git dir

are available in the git repository at:

  git://git.spearce.org/git-gui.git master

Christian Stimming (1):
      git-gui: Update German translation (12 new or changed strings).

Giuseppe Bilotta (4):
      git-gui: handle non-standard worktree locations
      git-gui: handle bare repos correctly
      git-gui: update shortcut tools to use _gitworktree
      git-gui: set GIT_DIR and GIT_WORK_TREE after setup

Jeff Epler (1):
      git-gui: Support applying a range of changes at once

Jens Lehmann (2):
      git-gui: Use git diff --submodule when available
      git-gui: Add a special diff popup menu for submodules

Pat Thoyts (1):
      git-gui: use themed tk widgets with Tk 8.5

Peter Oberndorfer (1):
      git-gui: use different icon for new and modified files in the index

Shawn O. Pearce (2):
      git-gui: Remove unused icon file_parttick
      git-gui: Update translation template

 git-gui.sh                   |  397 +++++++++++++++------
 lib/about.tcl                |   37 +--
 lib/blame.tcl                |   22 +-
 lib/branch_checkout.tcl      |   20 +-
 lib/branch_create.tcl        |   45 ++--
 lib/branch_delete.tcl        |   24 +-
 lib/branch_rename.tcl        |   32 +-
 lib/browser.tcl              |   41 ++-
 lib/choose_font.tcl          |   31 +-
 lib/choose_repository.tcl    |   94 +++---
 lib/choose_rev.tcl           |   51 ++--
 lib/class.tcl                |    7 +
 lib/console.tcl              |   17 +-
 lib/database.tcl             |   20 +-
 lib/diff.tcl                 |  259 ++++++++------
 lib/error.tcl                |   15 +-
 lib/index.tcl                |   13 +-
 lib/merge.tcl                |   14 +-
 lib/option.tcl               |   67 ++--
 lib/remote_add.tcl           |   37 +-
 lib/remote_branch_delete.tcl |   51 ++--
 lib/search.tcl               |   11 +-
 lib/shortcut.tcl             |    7 +-
 lib/sshkey.tcl               |   20 +-
 lib/status_bar.tcl           |   14 +-
 lib/themed.tcl               |  174 +++++++++
 lib/tools_dlg.tcl            |   87 ++---
 lib/transport.tcl            |   48 ++--
 po/de.po                     |  824 ++++++++++++++++++++++--------------------
 po/git-gui.pot               |  584 +++++++++++++++--------------
 30 files changed, 1772 insertions(+), 1291 deletions(-)
 create mode 100644 lib/themed.tcl

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] bash: support 'git notes' and its subcommands
From: SZEDER Gábor @ 2010-01-28  3:30 UTC (permalink / raw)
  To: Johan Herland; +Cc: git, Shawn O. Pearce, Junio C Hamano
In-Reply-To: <201001280223.35625.johan@herland.net>

Hi Johan,


On Thu, Jan 28, 2010 at 02:23:35AM +0100, Johan Herland wrote:
> On Thursday 28 January 2010, SZEDER Gábor wrote:
> > ... and it will offer refs unless after -m or -F, because these two
> > options require a non-ref argument.
> 
> Maybe-NAK.
> 
> The patch is probably good in itself, and the intent is certainly good, but 
> we're currently discussing deprecating the -m/-F options to "git notes edit" 
> (see http://article.gmane.org/gmane.comp.version-control.git/138215), and if 
> that's where we go, there's no point "encouraging" their use by adding bash-
> completions for them...

-m and -F are not encouraged, because they are not offered (short
options in general are never offered by the completion script).
However, their presence or absence is taken into account to offer
something sensible: refs after 'git notes edit <TAB>', files after
'git notes edit -F <TAB>'.  Note, that I chose 'edit' here, because
currently it's the only subcommand taking '-F', but it will actually
work the same way with the upcoming 'add' and 'append' subcommands.


Best,
Gábor


[btw, Shawn, could you have a look at
http://article.gmane.org/gmane.comp.version-control.git/137754 ?]

^ permalink raw reply

* "archive on tag" hook
From: The Anarcat @ 2010-01-28  5:39 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

Hi,

After looking in a few places for a tool to create an archive when
pushing tags to a central repository, I have given up and wrote my own.

It's grown into a fairly complete perl script that runs either as a
post-receive or update hook and creates a tarball (or zip file) using
git-archive in a specific directory. It can also optionnally generate an
MD5 sum of the tarball.

Part of this work was sponsored by Koumbit[1] and done for the Aegir
project[2].

The code itself is available on our git repository[3]. I will also write
a small subsection in the tools page of the wiki[4].

Comments and improvements welcome.

Enjoy!

A.

[1] http://www.koumbit.org/
[2] http://groups.drupal.org/aegir
[3] http://git.koumbit.net/?p=tools/git-hooks/.git;a=blob;f=archive-tag
[4] http://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools#Hooks

-- 
Antoine Beaupré
Réseau Koumbit Networks
+1.514.387.6262

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* [PATCH v2] Windows: improve performance by avoiding a static dependency on ws2_32.dll and advapi32.dll
From: Michael Lukashov @ 2010-01-28  8:15 UTC (permalink / raw)
  To: git; +Cc: Johannes Sixt, Michael Lukashov

ws2_32.dll is used by limited subset of git commands, such as pull,
push, fetch, send-email, ... By looking up functions that we need
at runtime, we can avoid the startup costs of this DLL.
As a result, we can remove static dependency on advapi32.dll too.

A call to "git status" loaded

before:  8 DLL
after:   4 DLL

Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
---
 Makefile       |    1 -
 compat/bswap.h |   30 +++++++++
 compat/mingw.c |  193 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 compat/mingw.h |   49 +++++++++++++-
 4 files changed, 265 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index af08c8f..4a79eaa 100644
--- a/Makefile
+++ b/Makefile
@@ -1041,7 +1041,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
 	COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
 		compat/win32/pthread.o
-	EXTLIBS += -lws2_32
 	PTHREAD_LIBS =
 	X = .exe
 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
diff --git a/compat/bswap.h b/compat/bswap.h
index f3b8c44..08aea39 100644
--- a/compat/bswap.h
+++ b/compat/bswap.h
@@ -1,3 +1,6 @@
+#ifndef BSWAP_H
+#define BSWAP_H
+
 /*
  * Let's make sure we always have a sane definition for ntohl()/htonl().
  * Some libraries define those as a function call, just to perform byte
@@ -17,6 +20,12 @@ static inline uint32_t default_swab32(uint32_t val)
 		((val & 0x000000ff) << 24));
 }
 
+static inline uint16_t default_swab16(uint16_t val)
+{
+	return (((val & 0xff00) >>  8) |
+		((val & 0x00ff) << 8));
+}
+
 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
 
 #define bswap32(x) ({ \
@@ -28,11 +37,21 @@ static inline uint32_t default_swab32(uint32_t val)
 	} \
 	__res; })
 
+#define bswap16(x) ({ \
+	uint16_t __res; \
+	if (__builtin_constant_p(x)) { \
+		__res = default_swab16(x); \
+	} else { \
+		__asm__("xchgb %b0, %h0" : "=q" (__res) : "0" ((uint16_t)(x))); \
+	} \
+	__res; })
+
 #elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
 
 #include <stdlib.h>
 
 #define bswap32(x) _byteswap_ulong(x)
+#define bswap16(x) _byteswap_ushort(x)
 
 #endif
 
@@ -44,3 +63,14 @@ static inline uint32_t default_swab32(uint32_t val)
 #define htonl(x) bswap32(x)
 
 #endif
+
+#ifdef bswap16
+
+#undef ntohs
+#undef htons
+#define ntohs(x) bswap16(x)
+#define htons(x) bswap16(x)
+
+#endif
+
+#endif
diff --git a/compat/mingw.c b/compat/mingw.c
index ab65f77..484cf7c 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -891,6 +891,172 @@ char **make_augmented_environ(const char *const *vars)
 	return env;
 }
 
+static HMODULE ws2_32_dll = NULL;
+static LPFN_INET_NTOA ws2_32_inet_ntoa;
+static LPFN_CONNECT ws2_32_connect;
+static LPFN_SELECT ws2_32_select;
+static LPFN_CLOSESOCKET ws2_32_closesocket;
+static LPFN_GETSERVBYPORT ws2_32_getservbyport;
+static LPFN_GETSERVBYNAME ws2_32_getservbyname;
+static LPFN_GETHOSTBYADDR ws2_32_gethostbyaddr;
+static LPFN_GETHOSTNAME ws2_32_gethostname;
+static LPFN_GETHOSTBYNAME ws2_32_gethostbyname;
+static LPFN_WSASTARTUP ws2_32_WSAStartup;
+static LPFN_WSACLEANUP ws2_32_WSACleanup;
+static LPFN_WSAGETLASTERROR ws2_32_WSAGetLastError;
+static LPFN_WSASOCKETA ws2_32_WSASocketA;
+
+static void ws2_32_cleanup(void)
+{
+	if (ws2_32_dll)
+		FreeLibrary(ws2_32_dll);
+	ws2_32_dll = NULL;
+	ws2_32_inet_ntoa = NULL;
+	ws2_32_connect = NULL;
+	ws2_32_select = NULL;
+	ws2_32_closesocket = NULL;
+	ws2_32_getservbyport = NULL;
+	ws2_32_getservbyname = NULL;
+	ws2_32_gethostbyaddr = NULL;
+	ws2_32_gethostname = NULL;
+	ws2_32_gethostbyname = NULL;
+	ws2_32_WSAStartup = NULL;
+	ws2_32_WSACleanup = NULL;
+	ws2_32_WSAGetLastError = NULL;
+	ws2_32_WSASocketA = NULL;
+}
+
+static void ensure_ws2_32_initialization(void)
+{
+	static int ws2_32_initialized = 0;
+
+	if (ws2_32_initialized)
+		return;
+
+	ws2_32_dll = LoadLibrary("ws2_32.dll");
+	if (!ws2_32_dll)
+		die("cannot load ws2_32.dll");
+
+	ws2_32_inet_ntoa = (LPFN_INET_NTOA)
+		GetProcAddress(ws2_32_dll, "inet_ntoa");
+	ws2_32_connect = (LPFN_CONNECT)
+		GetProcAddress(ws2_32_dll, "connect");
+	ws2_32_select = (LPFN_SELECT)
+		GetProcAddress(ws2_32_dll, "select");
+	ws2_32_closesocket = (LPFN_CLOSESOCKET)
+		GetProcAddress(ws2_32_dll, "closesocket");
+	ws2_32_getservbyport = (LPFN_GETSERVBYPORT)
+		GetProcAddress(ws2_32_dll, "getservbyport");
+	ws2_32_getservbyname = (LPFN_GETSERVBYNAME)
+		GetProcAddress(ws2_32_dll, "getservbyname");
+	ws2_32_gethostbyaddr = (LPFN_GETHOSTBYADDR)
+		GetProcAddress(ws2_32_dll, "gethostbyaddr");
+	ws2_32_gethostname = (LPFN_GETHOSTNAME)
+		GetProcAddress(ws2_32_dll, "gethostname");
+	ws2_32_gethostbyname = (LPFN_GETHOSTBYNAME)
+		GetProcAddress(ws2_32_dll, "gethostbyname");
+	ws2_32_WSAStartup = (LPFN_WSASTARTUP)
+		GetProcAddress(ws2_32_dll, "WSAStartup");
+	ws2_32_WSACleanup = (LPFN_WSACLEANUP)
+		GetProcAddress(ws2_32_dll, "WSACleanup");
+	ws2_32_WSAGetLastError = (LPFN_WSAGETLASTERROR)
+		GetProcAddress(ws2_32_dll, "WSAGetLastError");
+	ws2_32_WSASocketA = (LPFN_WSASOCKETA)
+		GetProcAddress(ws2_32_dll, "WSASocketA");
+
+	if (!ws2_32_inet_ntoa || !ws2_32_connect || !ws2_32_select ||
+		!ws2_32_closesocket || !ws2_32_getservbyport || !ws2_32_getservbyname ||
+		!ws2_32_gethostbyaddr || !ws2_32_gethostname || !ws2_32_gethostbyname ||
+		!ws2_32_WSAStartup || !ws2_32_WSACleanup ||
+		!ws2_32_WSAGetLastError || !ws2_32_WSASocketA) {
+		FreeLibrary(ws2_32_dll);
+		ws2_32_dll = NULL;
+		die("cannot initialize ws2_32.dll");
+	}
+	atexit(ws2_32_cleanup);
+	ws2_32_initialized = 1;
+}
+
+char *mingw_inet_ntoa(struct in_addr in)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_inet_ntoa(in);
+}
+
+int mingw_closesocket(SOCKET s)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_closesocket(s);
+}
+
+int mingw_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+			const struct timeval *timeout)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_select(nfds, readfds, writefds, exceptfds, timeout);
+}
+
+struct servent *mingw_getservbyport(int port, const char *proto)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_getservbyport(port, proto);
+}
+
+struct hostent *mingw_gethostbyaddr(const char *addr, int len, int type)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_gethostbyaddr(addr, len, type);
+}
+
+int mingw_gethostname(char *name, int namelen)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_gethostname(name, namelen);
+}
+
+struct servent *mingw_getservbyname(const char *name, const char *proto)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_getservbyname(name, proto);
+}
+
+int mingw_WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_WSAStartup(wVersionRequested, lpWSAData);
+}
+
+int mingw_WSACleanup(void)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_WSACleanup();
+}
+
+int mingw_WSAGetLastError(void)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_WSAGetLastError();
+}
+
+SOCKET mingw_WSASocketA(int af, int type, int protocol,
+			LPWSAPROTOCOL_INFOA lpProtocolInfo,
+			GROUP g, DWORD dwFlags)
+{
+	ensure_ws2_32_initialization();
+	return ws2_32_WSASocketA(af, type, protocol, lpProtocolInfo, g, dwFlags);
+}
+
+static HMODULE advapi32_dll = NULL;
+static BOOL (WINAPI *advapi32_get_user_name)(char *, DWORD *);
+
+static void advapi32_cleanup(void)
+{
+	if (advapi32_dll)
+		FreeLibrary(advapi32_dll);
+	advapi32_dll = NULL;
+	advapi32_get_user_name = NULL;
+}
+
 /*
  * Note, this isn't a complete replacement for getaddrinfo. It assumes
  * that service contains a numerical port, or that it it is null. It
@@ -1057,11 +1223,13 @@ static void ensure_socket_initialization(void)
 struct hostent *mingw_gethostbyname(const char *host)
 {
 	ensure_socket_initialization();
-	return gethostbyname(host);
+	ensure_ws2_32_initialization();
+	return ws2_32_gethostbyname(host);
 }
 
 void mingw_freeaddrinfo(struct addrinfo *res)
 {
+	ensure_socket_initialization();
 	ipv6_freeaddrinfo(res);
 }
 
@@ -1110,7 +1278,8 @@ int mingw_socket(int domain, int type, int protocol)
 int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz)
 {
 	SOCKET s = (SOCKET)_get_osfhandle(sockfd);
-	return connect(s, sa, sz);
+	ensure_ws2_32_initialization();
+	return ws2_32_connect(s, sa, sz);
 }
 
 #undef rename
@@ -1180,9 +1349,27 @@ struct passwd *getpwuid(int uid)
 {
 	static char user_name[100];
 	static struct passwd p;
+	static int advapi32_initialized = 0;
 
 	DWORD len = sizeof(user_name);
-	if (!GetUserName(user_name, &len))
+
+	if (!advapi32_initialized)
+	{
+		advapi32_dll = LoadLibrary("advapi32.dll");
+		if (!advapi32_dll)
+			die("cannot load advapi32.dll");
+		advapi32_get_user_name = (BOOL (WINAPI *)(char *, DWORD *))
+			GetProcAddress(advapi32_dll, "GetUserNameA");
+		if (!advapi32_get_user_name) {
+			FreeLibrary(advapi32_dll);
+			advapi32_dll = NULL;
+			die("cannot find GetUserNameA");
+		}
+		atexit(advapi32_cleanup);
+		advapi32_initialized = 1;
+	}
+
+	if (!advapi32_get_user_name(user_name, &len))
 		return NULL;
 	p.pw_name = user_name;
 	p.pw_gecos = "unknown";
diff --git a/compat/mingw.h b/compat/mingw.h
index e254fb4..466c473 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -1,5 +1,6 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
+#include "bswap.h"
 
 /*
  * things that are not available in header files
@@ -176,9 +177,53 @@ char *mingw_getcwd(char *pointer, int len);
 char *mingw_getenv(const char *name);
 #define getenv mingw_getenv
 
+/*
+ * wrappers for functions dynamically loaded from ws2_32.dll
+ */
+
+char *mingw_inet_ntoa(struct in_addr in);
+#define inet_ntoa mingw_inet_ntoa
+
+int mingw_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+			const struct timeval *timeout);
+#define select mingw_select
+
+int mingw_closesocket(SOCKET s);
+#define closesocket mingw_closesocket
+
+struct servent *mingw_getservbyport(int port, const char *proto);
+#define getservbyport mingw_getservbyport
+
+struct servent *mingw_getservbyname(const char *name, const char *proto);
+#define getservbyname mingw_getservbyname
+
+struct hostent *mingw_gethostbyaddr(const char *addr, int len, int type);
+#define gethostbyaddr mingw_gethostbyaddr
+
+int mingw_gethostname(char *name, int namelen);
+#define gethostname mingw_gethostname
+
 struct hostent *mingw_gethostbyname(const char *host);
 #define gethostbyname mingw_gethostbyname
 
+int mingw_WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData);
+#define WSAStartup mingw_WSAStartup
+
+int mingw_WSACleanup(void);
+#define WSACleanup mingw_WSACleanup
+
+int mingw_WSAGetLastError(void);
+#define WSAGetLastError mingw_WSAGetLastError
+
+SOCKET mingw_WSASocketA(int af, int type, int protocol,
+			LPWSAPROTOCOL_INFOA lpProtocolInfo,
+			GROUP g, DWORD dwFlags);
+#define WSASocketA mingw_WSASocketA
+
+/*
+ * support for IPv6 on MinGW
+ */
+
 void mingw_freeaddrinfo(struct addrinfo *res);
 #define freeaddrinfo mingw_freeaddrinfo
 
@@ -227,10 +272,6 @@ pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env,
 void mingw_execvp(const char *cmd, char *const *argv);
 #define execvp mingw_execvp
 
-static inline unsigned int git_ntohl(unsigned int x)
-{ return (unsigned int)ntohl(x); }
-#define ntohl git_ntohl
-
 sig_handler_t mingw_signal(int sig, sig_handler_t handler);
 #define signal mingw_signal
 
-- 
1.7.0.rc0.1466.g79f2.dirty

^ permalink raw reply related

* [PATCH] tests: update tests that used to fail
From: Junio C Hamano @ 2010-01-28  8:42 UTC (permalink / raw)
  To: git

"diff --cc" output t4038 tests was fixed by b810cbb (diff --cc: a lost
line at the beginning of the file is shown incorrectly, 2009-07-22), which
was actually the commit that introduced this test..

An error in "git merge -s resolve" t6035 tests was fixed by 730f728
(unpack-trees.c: look ahead in the index, 2009-09-20).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t4038-diff-combined.sh        |    2 +-
 t/t6035-merge-dir-to-symlink.sh |    2 +-
 t/t7507-commit-verbose.sh       |    5 -----
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh
index 2cf7e01..7584efa 100755
--- a/t/t4038-diff-combined.sh
+++ b/t/t4038-diff-combined.sh
@@ -76,7 +76,7 @@ test_expect_success 'check combined output (1)' '
 	verify_helper sidewithone
 '
 
-test_expect_failure 'check combined output (2)' '
+test_expect_success 'check combined output (2)' '
 	git show sidesansone -- >sidesansone &&
 	verify_helper sidesansone
 '
diff --git a/t/t6035-merge-dir-to-symlink.sh b/t/t6035-merge-dir-to-symlink.sh
index d1b2287..3202e1d 100755
--- a/t/t6035-merge-dir-to-symlink.sh
+++ b/t/t6035-merge-dir-to-symlink.sh
@@ -48,7 +48,7 @@ test_expect_success 'setup for merge test' '
 	git tag baseline
 '
 
-test_expect_failure 'do not lose a/b-2/c/d in merge (resolve)' '
+test_expect_success 'do not lose a/b-2/c/d in merge (resolve)' '
 	git reset --hard &&
 	git checkout baseline^0 &&
 	git merge -s resolve master &&

^ permalink raw reply related

* Re: git status showing phantom modifications
From: Michael Ludwig @ 2010-01-28  8:45 UTC (permalink / raw)
  To: git@vger.kernel.org
In-Reply-To: <4B5FE925.4000300@viscovery.net>

Am 27.01.2010 um 08:20 schrieb Johannes Sixt:

> One more thing to try is:
> 
>  core.ignorecygwinfstricks = false
> 
> This turns off some stat() optimizations on Cygwin.


The above setting causes the phantom modifications to disappear,
regardless of an *explicit* setting of core.filemode as reported
in one of my previous mails on this thread.

So thanks, it works okay for me. Still, it's not clear what's
happening.
-- 
Michael.Ludwig (#) XING.com

^ permalink raw reply

* Re: make install error
From: Alex Riesen @ 2010-01-28  8:48 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: kap4lin, git
In-Reply-To: <7v8wbjndn6.fsf@alter.siamese.dyndns.org>

On Thu, Jan 28, 2010 at 03:53, Junio C Hamano <gitster@pobox.com> wrote:
> kap4lin <kap4lin@gmail.com> writes:
>
>> (cd blt && gtar cf - .) | \
>>         (cd '/scratch/kap4lin/usr/share/git-core/templates' && umask
>> 022 && gtar xof -)
>> gtar: This does not look like a tar archive
>
> Perhaps "unset CDPATH".
>

BTW, will "cd ./blt &>/dev/null" also help and prevent this problem from
happening ever again?

^ permalink raw reply

* Re: [PATCH 1/2] t1506: more test for @{upstream} syntax
From: Jeff King @ 2010-01-28  8:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin
In-Reply-To: <7viqanqt5s.fsf@alter.siamese.dyndns.org>

On Wed, Jan 27, 2010 at 10:50:07AM -0800, Junio C Hamano wrote:

> > A minor nit, but wouldn't:
> >
> >   int approxidate_careful(const char *str, unsigned long *out);
> >
> > returning an error code be the more usual pattern for a function with
> > error-plus-output (your approxidate wrapper would have to be a function then,
> > not a macro)?
> 
> I don't have strong preference either way; the one in the patch was
> modelled after setup_git_directory_gently(&nongit_ok), and slightly easier
> to work with for existing callers that don't care enough.

Looks like you have already pushed out the original patch, so let's not
worry about it.

> >> +test_expect_success '@{30.years.ago} shows old' '
> >> +	check_at @{30.years.ago} one
> >
> > Side note: I chose this because we needed to go back from the current
> > time beyond where test_tick would place the commit. Which means this
> > test has a 2035 bug. :)
> 
> Can't we use an absolute date, given that test_tick gives fixed timestamp
> sequence to pretend as if we were still in 2005 when we are running these
> tests?
> [...]
> --- a/t/t0101-at-syntax.sh
> +++ b/t/t0101-at-syntax.sh
> @@ -26,8 +26,8 @@ test_expect_success '@{now} shows current' '
>  	check_at @{now} two
>  '
>  
> -test_expect_success '@{30.years.ago} shows old' '
> -	check_at @{30.years.ago} one
> +test_expect_success '@{2001-09-17} (before the first commit) shows old' '
> +	check_at @{2001-09-17} one
>  '
>  
>  test_expect_success 'silly approxidates work' '

Yes, I don't know why I was so concerned with using a relative
approxidate when an absolute one would suffice. However, we should make
a matching change in the silly approxidate entry, too. Like this:

-- >8 --
Subject: [PATCH] t0101: use absolute date

The original version used relative approxidates, which don't
reproduce as reliably as absolute ones. Commit 6c647a fixed
this for one case, but missed the "silly" case.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t0101-at-syntax.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t0101-at-syntax.sh b/t/t0101-at-syntax.sh
index 5e298c5..a1998b5 100755
--- a/t/t0101-at-syntax.sh
+++ b/t/t0101-at-syntax.sh
@@ -31,7 +31,7 @@ test_expect_success '@{2001-09-17} (before the first commit) shows old' '
 '
 
 test_expect_success 'silly approxidates work' '
-	check_at @{3.hot.dogs.and.30.years.ago} one
+	check_at @{3.hot.dogs.on.2001-09-17} one
 '
 
 test_expect_success 'notice misspelled upstream' '

^ permalink raw reply related

* Re: make install error
From: Junio C Hamano @ 2010-01-28  8:56 UTC (permalink / raw)
  To: Alex Riesen; +Cc: kap4lin, git
In-Reply-To: <81b0412b1001280048y6f91ad25t5c636f959630825@mail.gmail.com>

Alex Riesen <raa.lkml@gmail.com> writes:

> On Thu, Jan 28, 2010 at 03:53, Junio C Hamano <gitster@pobox.com> wrote:
>> kap4lin <kap4lin@gmail.com> writes:
>>
>>> (cd blt && gtar cf - .) | \
>>>         (cd '/scratch/kap4lin/usr/share/git-core/templates' && umask
>>> 022 && gtar xof -)
>>> gtar: This does not look like a tar archive
>>
>> Perhaps "unset CDPATH".
>>
>
> BTW, will "cd ./blt &>/dev/null" also help and prevent this problem from
> happening ever again?

Except that (1) it would be ">/dev/null", and (2) why contaminate Makefile
command lines with such unreadability to work around stupid misdesign of
CDPATH?

I _could_ live with something like this that won't affect the main part of
the Makefile, though.

 Makefile |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index af08c8f..20b0b34 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,10 @@
 # The default target of this Makefile is...
 all::
 
+# Work around CDPATH exported to the environment that would
+# break "(cd there && tar cf - ) | tar xf -" and the like.
+CDPATH :=
+
 # Define V=1 to have a more verbose compile.
 #
 # Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.

^ permalink raw reply related

* Re: [PATCHv3] filter-branch: Add tests for submodules
From: Michal Sojka @ 2010-01-28  9:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, j.sixt, Johannes.Schindelin
In-Reply-To: <7vfx5rnl0w.fsf@alter.siamese.dyndns.org>

On Thursday 28 of January 2010 01:14:07 Junio C Hamano wrote:
> Michal Sojka <sojkam1@fel.cvut.cz> writes:
> > There are three important tests:
> 
> It is unnecessary and counterproductive to self-proclaim the importance of
> a patch or new tests.  If anything, what are important are not tests
> themselves but the conditions that they check, so "Add tests to check
> three important cases:" is slightly more palatable.
> 
> I'd suggest to just start with "Add three tests to make sure:".

OK

> > 1) 'rewrite submodule with another content' passes only with the
> >    previous patch applied.
> 
> Sorry, but I think I am missing some context here to understand this
> sentence.  Which previous patch?

I should have sent both patches. Sorry for that. I'll send them now.
 
> > 2) 'checkout submodule during rewrite' demonstrates that it is not
> >    possible to replace a submodule revision in tree-filter by checking
> >    the submodule out and reseting the submodule's HEAD. Fails both
> >    with and without the previous patch. This is because filter-branch
> >    sets GIT_WORKING_TREE to "." which causes clone (called from
> >    git-submodule) to fail.
> 
> I thought you agreed with Hannes that this is not something we would even
> want to support?

Yes. I'm removing this test.

Cheers,
Michal

^ permalink raw reply

* [PATCHv4 1/2] filter-branch: Fix to allow replacing submodules with another content
From: Michal Sojka @ 2010-01-28  9:08 UTC (permalink / raw)
  To: git; +Cc: j.sixt, Johannes.Schindelin, gitster, Michal Sojka
In-Reply-To: <201001281002.03232.sojkam1@fel.cvut.cz>

When git filter-branch is used to replace a submodule with another
content, it always fails on the first commit. Consider a repository with
submod directory containing a submodule. If I want to remove the
submodule and replace it with a file, the following command fails.

git filter-branch --tree-filter 'rm -rf submod &&
				 git rm -q submod &&
				 mkdir submod &&
				 touch submod/file'

The error message is:
error: submod: is a directory - add files inside instead

The reason is that git diff-index, which generates the first part of the
list of files updated by the tree filter, emits also the removed
submodule even if it was replaced by a real directory.

Adding --ignored-submodules solves the problem for me and
tests in t7003-filter-branch.sh pass correctly.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 git-filter-branch.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 195b5ef..7c4ad7d 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -331,7 +331,7 @@ while read commit parents; do
 			die "tree filter failed: $filter_tree"
 
 		(
-			git diff-index -r --name-only $commit &&
+			git diff-index -r --name-only --ignore-submodules $commit &&
 			git ls-files --others
 		) > "$tempdir"/tree-state || exit
 		git update-index --add --replace --remove --stdin \
-- 
1.6.6

^ permalink raw reply related

* [PATCHv4 2/2] filter-branch: Add tests for submodules in tree-filter
From: Michal Sojka @ 2010-01-28  9:08 UTC (permalink / raw)
  To: git; +Cc: j.sixt, Johannes.Schindelin, gitster, Michal Sojka
In-Reply-To: <201001281002.03232.sojkam1@fel.cvut.cz>

Add tests to make sure:
1) a submodule can be removed and its content replaced with regular
   files ('rewrite submodule with another content'). This test passes
   only with the previous patch applied.

2) it is possible to replace submodule revision by direct index
   manipulation ('replace submodule revision'). Although it would be
   better to run such a filter in --index-filter, this test shows that
   this functionality is not broken by the previous patch. This
   succeeds both with and without the previous patch.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 t/t7003-filter-branch.sh |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 9503875..4ee8237 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -306,4 +306,43 @@ test_expect_success '--remap-to-ancestor with filename filters' '
 	test $orig_invariant = $(git rev-parse invariant)
 '
 
+test_expect_success 'setup submodule' '
+	rm -rf * .*
+	git init &&
+	test_commit file &&
+	mkdir submod &&
+	submodurl="$PWD/submod"
+	( cd submod &&
+	  git init &&
+	  test_commit file-in-submod ) &&
+	git submodule add "$submodurl"
+	git commit -m "added submodule" &&
+	test_commit add-file &&
+	( cd submod && test_commit add-in-submodule ) &&
+	git add submod &&
+	git commit -m "changed submodule" &&
+	git branch original HEAD
+'
+
+orig_head=`git show-ref --hash --head HEAD`
+
+test_expect_success 'rewrite submodule with another content' '
+	git filter-branch --tree-filter "test -d submod && {
+					 rm -rf submod &&
+					 git rm -rf --quiet submod &&
+					 mkdir submod &&
+					 : > submod/file
+					 } || :" HEAD &&
+	test $orig_head != `git show-ref --hash --head HEAD`
+'
+
+test_expect_success 'replace submodule revision' '
+	git reset --hard original &&
+	git filter-branch -f --tree-filter \
+	    "if git ls-files --error-unmatch -- submod > /dev/null 2>&1
+	     then git update-index --cacheinfo 160000 0123456789012345678901234567890123456789 submod
+	     fi" HEAD &&
+	test $orig_head != `git show-ref --hash --head HEAD`
+'
+
 test_done
-- 
1.6.6

^ permalink raw reply related

* Re: [PATCH v2] Windows: improve performance by avoiding a static dependency on ws2_32.dll and advapi32.dll
From: Johannes Sixt @ 2010-01-28  9:09 UTC (permalink / raw)
  To: Michael Lukashov; +Cc: git
In-Reply-To: <1264666525-4956-1-git-send-email-michael.lukashov@gmail.com>

Michael Lukashov schrieb:
> ws2_32.dll is used by limited subset of git commands, such as pull,
> push, fetch, send-email, ... By looking up functions that we need
> at runtime, we can avoid the startup costs of this DLL.
> As a result, we can remove static dependency on advapi32.dll too.
> 
> A call to "git status" loaded
> 
> before:  8 DLL
> after:   4 DLL

Thanks. Due to the size of the change, I would acknowledge it only if you
have a proof that the reduced startup costs are noticable, for example, by
running the test suite.

What's the deal with bswap? Isn't it an unrelated change? It needs some
better justification. It is unobvious because it is not straight-forward
"use pointer to function that was looked up instead of function".

Will the result not break the MSVC build?

-- Hannes

^ permalink raw reply

* shared permissions on COMMIT_EDITMSG
From: William Pursell @ 2010-01-28  9:19 UTC (permalink / raw)
  To: git

With git-init --shared=0660 and a umask of 022,
the first commit to the repository creates
the file COMMIT_EDITMSG with mode 0644
instead of 0660.  I believe this is incorrect
behavior.  Simple fix:

diff --git a/builtin-commit.c b/builtin-commit.c
index 55676fd..06ce94d 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -687,6 +687,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 	}

 	fclose(fp);
+	adjust_shared_perm(git_path(commit_editmsg));

 	if (!commitable && !in_merge && !allow_empty &&
 	    !(amend && is_a_merge(head_sha1))) {


-- 
William Pursell

^ permalink raw reply related

* Re: [PATCH 1/2] t1506: more test for @{upstream} syntax
From: Jeff King @ 2010-01-28  9:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin
In-Reply-To: <7veilbqs82.fsf@alter.siamese.dyndns.org>

On Wed, Jan 27, 2010 at 11:10:21AM -0800, Junio C Hamano wrote:

> I wanted to do something like what your patch does by iterating over the
> input inside get_sha1_basic() while we still see @{...}, parsing pieces
> from the beginning, not from the end like the original "do we have the
> reflog indicator at the end?  If so strip it and deal with what we have at
> the front".  Your patch to i-b-n does that by recursing inside, which is a
> nice solution.

Yeah, I wanted to do that too, but it just ended up very messy. I
suppose the i-b-n solution is reasonably elegant, and it should
correctly handle non-get-sha1 instances like:

  git checkout @{-1}@{u}

> Care to roll a patch with additional tests, to build on top of 105e473
> (Fix log -g this@{upstream}, 2010-01-26)?

Yep, series to follow:

  [1/3]: test combinations of @{} syntax
  [2/3]: fix parsing of @{-1}@{u} combination
  [3/3]: reject @{-1} not at beginning of object name

-Peff

^ permalink raw reply

* [PATCH 1/3] test combinations of @{} syntax
From: Jeff King @ 2010-01-28  9:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin
In-Reply-To: <20100128094446.GA14244@coredump.intra.peff.net>

Now that we have several different types of @{} syntax, it
is a good idea to test them together, which reveals some
failures.

Signed-off-by: Jeff King <peff@peff.net>
---
While this is conceptually similar to the tests in t0101, it feels
better to me to test features in combination only after they have been
tested by themselves. Thus a new script > 1507.

 t/t1508-at-combinations.sh |   51 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100755 t/t1508-at-combinations.sh

diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
new file mode 100755
index 0000000..59f0463
--- /dev/null
+++ b/t/t1508-at-combinations.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+test_description='test various @{X} syntax combinations together'
+. ./test-lib.sh
+
+check() {
+test_expect_${3:-success} "$1 = $2" "
+	echo '$2' >expect &&
+	git log -1 --format=%s '$1' >actual &&
+	test_cmp expect actual
+"
+}
+nonsense() {
+test_expect_${2:-success} "$1 is nonsensical" "
+	test_must_fail git log -1 '$1'
+"
+}
+fail() {
+	"$@" failure
+}
+
+test_expect_success 'setup' '
+	test_commit master-one &&
+	test_commit master-two &&
+	git checkout -b upstream-branch &&
+	test_commit upstream-one &&
+	test_commit upstream-two &&
+	git checkout -b old-branch &&
+	test_commit old-one &&
+	test_commit old-two &&
+	git checkout -b new-branch &&
+	test_commit new-one &&
+	test_commit new-two &&
+	git config branch.old-branch.remote . &&
+	git config branch.old-branch.merge refs/heads/master &&
+	git config branch.new-branch.remote . &&
+	git config branch.new-branch.merge refs/heads/upstream-branch
+'
+
+check HEAD new-two
+check "@{1}" new-one
+check "@{-1}" old-two
+check "@{-1}@{1}" old-one
+check "@{u}" upstream-two
+check "@{u}@{1}" upstream-one
+fail check "@{-1}@{u}" master-two
+fail check "@{-1}@{u}@{1}" master-one
+fail nonsense "@{u}@{-1}"
+nonsense "@{1}@{u}"
+
+test_done
-- 
1.7.0.rc0.41.g538720

^ permalink raw reply related

* [PATCH 2/3] fix parsing of @{-1}@{u} combination
From: Jeff King @ 2010-01-28  9:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin
In-Reply-To: <20100128094446.GA14244@coredump.intra.peff.net>

Previously interpret_branch_name would see @{-1} and stop
parsing, leaving the @{u} as cruft that provoked an error.
Instead, we should recurse if there is more to parse.

Signed-off-by: Jeff King <peff@peff.net>
---
A straight repost of the previous "how about this" patch, but marking
successful tests.

 sha1_name.c                |   24 ++++++++++++++++++++++--
 t/t1508-at-combinations.sh |    4 ++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/sha1_name.c b/sha1_name.c
index c7f1510..00fc415 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -881,8 +881,28 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
 
 	if (!len)
 		return len; /* syntax Ok, not enough switches */
-	if (0 < len)
-		return len; /* consumed from the front */
+	if (0 < len && len == namelen)
+		return len; /* consumed all */
+	else if (0 < len) {
+		/* we have extra data, which might need further processing */
+		struct strbuf tmp = STRBUF_INIT;
+		int used = buf->len;
+		int ret;
+
+		strbuf_add(buf, name + len, namelen - len);
+		ret = interpret_branch_name(buf->buf, &tmp);
+		/* that data was not interpreted, remove our cruft */
+		if (ret < 0) {
+			strbuf_setlen(buf, used);
+			return len;
+		}
+		strbuf_reset(buf);
+		strbuf_addbuf(buf, &tmp);
+		strbuf_release(&tmp);
+		/* tweak for size of {-N} versus expanded ref name */
+		return ret - used + len;
+	}
+
 	cp = strchr(name, '@');
 	if (!cp)
 		return -1;
diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
index 59f0463..2a46af2 100755
--- a/t/t1508-at-combinations.sh
+++ b/t/t1508-at-combinations.sh
@@ -43,8 +43,8 @@ check "@{-1}" old-two
 check "@{-1}@{1}" old-one
 check "@{u}" upstream-two
 check "@{u}@{1}" upstream-one
-fail check "@{-1}@{u}" master-two
-fail check "@{-1}@{u}@{1}" master-one
+check "@{-1}@{u}" master-two
+check "@{-1}@{u}@{1}" master-one
 fail nonsense "@{u}@{-1}"
 nonsense "@{1}@{u}"
 
-- 
1.7.0.rc0.41.g538720

^ permalink raw reply related


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