Git development
 help / color / mirror / Atom feed
* Re: [PATCH v2 2/2] daemon: report permission denied error to clients
From: Junio C Hamano @ 2011-10-21 19:25 UTC (permalink / raw)
  To: Clemens Buchacher; +Cc: git, Jeff King
In-Reply-To: <20111017195850.GC29479@ecki>

Clemens Buchacher <drizzd@aon.at> writes:

> diff --git a/daemon.c b/daemon.c
> index 72fb53a..2f7f84e 100644
> --- a/daemon.c
> +++ b/daemon.c
> @@ -120,12 +120,14 @@ static char *path_ok(char *directory)
>  
>  	if (daemon_avoid_alias(dir)) {
>  		logerror("'%s': aliased", dir);
> +		errno = 0;
>  		return NULL;
>  	}
>  
>  	if (*dir == '~') {
>  		if (!user_path) {
>  			logerror("'%s': User-path not allowed", dir);
> +			errno = EACCES;
>  			return NULL;
>  		}

Isn't the first one inconsistent from all the others?

A request cames "../some/path" and it is not allowed by a daemon policy
and it gets errno==0 which is turned into "no such repo" later, while
another request to "~drizzed/another/path" is also rejected by a daemon
policy and gets errno==EACCESS which is turned into "permission denied".

Indeed everything else says EACCESS in this patch, except for the check
done by enter_repo() which can additionally say ENAMETOOLONG (which would
not be very useful in practice) or whatever error coming from failure to
go there with chdir(), which is not likely to be EACCESS because it has
already been checked with a separate access() that is done before the
actual chdir() call.

> +	if (!(path = path_ok(dir))) {
> +		if (errno == EACCES)
> +			return daemon_error(dir, "permission denied");
> +		else
> +			return daemon_error(dir, "no such repository");
> +	}

If errno is set to EACCESS in cases (1) we are not even going to tell you
if a repository exists there or not--you are not authorized to know and
(2) there is a repository but you do not have authorization to access it,
then this "leaking a bit more information" part is acceptable for site
with "--informative-errors", I would think. A repository that is invalid
from the daemon's point of view (e.g. validate_headref("HEAD") fails
because it points at an object that does not exist) but that the owner
intended to make it valid by correcting such mistakes would be reported as
"no such repository" with such a logic, so I am not sure if the distinction
between these two cases really matters in practice, though.

^ permalink raw reply

* [PATCH 1/3] MSVC: Compile fix by not including sys/resources.h
From: Vincent van Ravesteijn @ 2011-10-21 19:36 UTC (permalink / raw)
  To: git

Fix compilation when compiling with MSVC because sys/resource.h
is not available. This patch causes a number of other headerfiles
that are not available to be excluded as well.

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
---
  git-compat-util.h |   13 ++++++-------
  1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 5ef8ff7..53186da 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -116,7 +116,12 @@
  #else
  #include <poll.h>
  #endif
-#ifndef __MINGW32__
+#if defined(__MINGW32__)
+/* pull in Windows compatibility stuff */
+#include "compat/mingw.h"
+#elif defined(_MSC_VER)
+#include "compat/msvc.h"
+#else
  #include <sys/wait.h>
  #include <sys/resource.h>
  #include <sys/socket.h>
@@ -145,12 +150,6 @@
  #include <grp.h>
  #define _ALL_SOURCE 1
  #endif
-#else  /* __MINGW32__ */
-/* pull in Windows compatibility stuff */
-#include "compat/mingw.h"
-#endif /* __MINGW32__ */
-#ifdef _MSC_VER
-#include "compat/msvc.h"
  #endif

  #ifndef NO_LIBGEN_H
--
1.7.6.msysgit.0

^ permalink raw reply related

* [PATCH 2/3] MSVC: Compile fix by including io.h
From: Vincent van Ravesteijn @ 2011-10-21 19:39 UTC (permalink / raw)
  To: git
In-Reply-To: <4EA1C9C9.9010904@lyx.org>

Include io.h when compiling with MSVC

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
---
  compat/msvc.h |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/compat/msvc.h b/compat/msvc.h
index a33b01c..aa4b563 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -4,6 +4,7 @@
  #include <direct.h>
  #include <process.h>
  #include <malloc.h>
+#include <io.h>

  /* porting function */
  #define inline __inline
--
1.7.6.msysgit.0

^ permalink raw reply related

* [PATCH 3/3] MSVC: Remove unneeded header stubs
From: Vincent van Ravesteijn @ 2011-10-21 19:42 UTC (permalink / raw)
  To: git
In-Reply-To: <4EA1C9C9.9010904@lyx.org>

These headers are not necessary anymore as they are no longer included
in git-compat-util.h.

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
---
  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/select.h  |    1 -
  compat/vcbuild/include/sys/socket.h  |    1 -
  compat/vcbuild/include/sys/wait.h    |    1 -
  compat/vcbuild/include/termios.h     |    1 -
  12 files changed, 0 insertions(+), 12 deletions(-)
  delete mode 100644 compat/vcbuild/include/arpa/inet.h
  delete mode 100644 compat/vcbuild/include/grp.h
  delete mode 100644 compat/vcbuild/include/inttypes.h
  delete mode 100644 compat/vcbuild/include/netdb.h
  delete mode 100644 compat/vcbuild/include/netinet/in.h
  delete mode 100644 compat/vcbuild/include/netinet/tcp.h
  delete mode 100644 compat/vcbuild/include/pwd.h
  delete mode 100644 compat/vcbuild/include/sys/ioctl.h
  delete mode 100644 compat/vcbuild/include/sys/select.h
  delete mode 100644 compat/vcbuild/include/sys/socket.h
  delete mode 100644 compat/vcbuild/include/sys/wait.h
  delete mode 100644 compat/vcbuild/include/termios.h

diff --git a/compat/vcbuild/include/arpa/inet.h 
b/compat/vcbuild/include/arpa/inet.h
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/arpa/inet.h
+++ /dev/null
@@ -1 +0,0 @@
-/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/grp.h b/compat/vcbuild/include/grp.h
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/grp.h
+++ /dev/null
@@ -1 +0,0 @@
-/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/inttypes.h 
b/compat/vcbuild/include/inttypes.h
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/inttypes.h
+++ /dev/null
@@ -1 +0,0 @@
-/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/netdb.h b/compat/vcbuild/include/netdb.h
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/netdb.h
+++ /dev/null
@@ -1 +0,0 @@
-/* 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
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/netinet/in.h
+++ /dev/null
@@ -1 +0,0 @@
-/* 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
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/netinet/tcp.h
+++ /dev/null
@@ -1 +0,0 @@
-/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/pwd.h b/compat/vcbuild/include/pwd.h
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/pwd.h
+++ /dev/null
@@ -1 +0,0 @@
-/* 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
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/sys/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-/* 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
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/sys/select.h
+++ /dev/null
@@ -1 +0,0 @@
-/* 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
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/sys/socket.h
+++ /dev/null
@@ -1 +0,0 @@
-/* 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
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/sys/wait.h
+++ /dev/null
@@ -1 +0,0 @@
-/* Intentionally empty file to support building git with MSVC */
diff --git a/compat/vcbuild/include/termios.h 
b/compat/vcbuild/include/termios.h
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/termios.h
+++ /dev/null
@@ -1 +0,0 @@
-/* Intentionally empty file to support building git with MSVC */
-- 
1.7.6.msysgit.0

^ permalink raw reply related

* [PATCH] git-svn: add hook to allow modifying the subversion commit message
From: Michael Lutz @ 2011-10-21 20:25 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Michael Lutz

Sometimes modifying the commit message git-svn creates for a subversion
commit can be useful, for example if the original message contains meta
information not needed in the git clone or information from svn properties
should be stored visibly in the commit message.

This change adds a hook 'git-svn-msg' analogue to the 'commit-msg' hook.
Additionally to the commit message, the hook is passed the git-svn meta
data by an environment variable.

Signed-off-by: Michael Lutz <michi@icosahedron.de>
---
 Documentation/githooks.txt          |   19 +++++++++++++++++++
 git-svn.perl                        |   25 +++++++++++++++++++++++++
 templates/hooks--git-svn-msg.sample |   18 ++++++++++++++++++
 3 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100755 templates/hooks--git-svn-msg.sample

diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 28edefa..dd90c1a 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -45,6 +45,25 @@ the commit after inspecting the message file.
 The default 'applypatch-msg' hook, when enabled, runs the
 'commit-msg' hook, if the latter is enabled.
 
+git-svn-msg
+~~~~~~~~~~~
+
+This hook is invoked by 'git svn' when creating a git commit
+from a subversion commit.  It takes a single parameter, the name
+of the file that holds the original subversion commit message.
+Exiting with non-zero status causes 'git svn' to abbort before
+creating the git commit. Additional, the environment variable
+`GIT_SVN_METADATA=:` is set to the string that would appear
+after the 'git-svn-id:' line.
+
+The hook is allowed to edit the message file in place, and can
+be used to normalize the message into some project standard
+format (if the project has one). It can also be used to refuse
+the commit after inspecting the message file.
+
+The default 'git-svn-msg' hook, when enabled, runs the
+'commit-msg' hook, if the latter is enabled.
+
 pre-applypatch
 ~~~~~~~~~~~~~~
 
diff --git a/git-svn.perl b/git-svn.perl
index b67fef0..030516c 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3007,6 +3007,31 @@ sub do_git_commit {
 		require Encode;
 		Encode::from_to($log_entry->{log}, 'UTF-8', $enc);
 	}
+
+	# execute commit message hook if present
+	if (-x "$ENV{GIT_DIR}/hooks/git-svn-msg") {
+		print "Calling commit mesasage hook\n";
+
+		# write commit message to file
+		my $msg_file = "$ENV{GIT_DIR}/SVN_COMMIT_EDITMSG";
+		mkfile($msg_file);
+		open my $fh, '>', $msg_file or croak $!;
+		binmode $fh;
+		print $fh $log_entry->{log} or croak $!;
+		close $fh or croak $!;
+
+		$ENV{GIT_SVN_METADATA} = $log_entry->{metadata};
+		system("$ENV{GIT_DIR}/hooks/git-svn-msg", $msg_file);
+		die "git-svn-msg hook failed: $!\n" if $?;
+
+		# read commit message back
+		open $fh, '<', $msg_file or croak $!;
+		binmode $fh;
+		$log_entry->{log} = do { local $/; <$fh> };
+		close $fh or croak $!;
+		unlink $msg_file;
+	}
+
 	print $msg_fh $log_entry->{log} or croak $!;
 	restore_commit_header_env($old_env);
 	unless ($self->no_metadata) {
diff --git a/templates/hooks--git-svn-msg.sample b/templates/hooks--git-svn-msg.sample
new file mode 100755
index 0000000..6584fd8
--- /dev/null
+++ b/templates/hooks--git-svn-msg.sample
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message taken by
+# git svn from a subversion commit.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.  The hook is
+# allowed to edit the commit message file.
+#
+# GIT_SVN_METADATA will contain the same info as printed after
+# the git-svn-id line.
+#
+# To enable this hook, rename this file to "git-svn-msg".
+
+. git-sh-setup
+test -x "$GIT_DIR/hooks/commit-msg" &&
+	exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
+:
-- 
1.7.5.1

^ permalink raw reply related

* Re: [PATCH] gitweb: fix regression when filtering out forks
From: Jakub Narebski @ 2011-10-21 20:51 UTC (permalink / raw)
  To: Julien Muchembled; +Cc: git
In-Reply-To: <1319223861-10803-1-git-send-email-jm@jmuchemb.eu>

On Fri, 21 Oct 2011, Julien Muchembled wrote:

> This fixes a condition in filter_forks_from_projects_list that failed if
> process directory was different from project root: in such case, the subroutine
> was a no-op and forks were not detected.
> 
> Signed-off-by: Julien Muchembled <jm@jmuchemb.eu>

Thanks.

I am embarrassed that I missed this; in the test I have added $projectroot
_is_ current directory for script.  Anyway I have tested this in running
local installation on testsuite, and it now works (i.e. hide forks under
"+" character, where it would not before - gitweb shown every project).

Tested-by: Jakub Narebski <jnareb@gmail.com>

> ---
>  gitweb/gitweb.perl |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 70a576a..206e2a6 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -2875,7 +2875,7 @@ sub filter_forks_from_projects_list {
>  		$path =~ s/\.git$//;      # forks of 'repo.git' are in 'repo/' directory
>  		next if ($path =~ m!/$!); # skip non-bare repositories, e.g. 'repo/.git'
>  		next unless ($path);      # skip '.git' repository: tests, git-instaweb
> -		next unless (-d $path);   # containing directory exists
> +		next unless (-d "$projectroot/$path"); # containing directory exists
>  		$pr->{'forks'} = [];      # there can be 0 or more forks of project
>  
>  		# add to trie
> -- 

-- 
Jakub Narebski
Poland

^ permalink raw reply

* Re: [PATCH] git-gui: use a tristate to control the case mode in the searchbar
From: Pat Thoyts @ 2011-10-21 21:41 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Andrew Ardill, git
In-Reply-To: <9193677f1fef348d5b081653840e8a829ddd3e50.1319138692.git.bert.wesarg@googlemail.com>

Bert Wesarg <bert.wesarg@googlemail.com> writes:

>The config is now called gui.search.case and can have the three values:
>no/yes/smart. yes is the default.
>
>It also resets the case detection in smart mode, when the entry field was
>cleared by the use.
>
>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>---
> lib/search.tcl |   24 +++++++++++++++++-------
> 1 files changed, 17 insertions(+), 7 deletions(-)
>
>diff --git a/lib/search.tcl b/lib/search.tcl
>index 04a316b..ef1e555 100644
>--- a/lib/search.tcl
>+++ b/lib/search.tcl
>@@ -26,11 +26,20 @@ constructor new {i_w i_text args} {
> 	set ctext  $i_text
> 
> 	set default_regexpsearch [is_config_true gui.search.regexp]
>-	set smartcase [is_config_true gui.search.smartcase]
>-	if {$smartcase} {
>+	switch -- [get_config gui.search.case] {
>+	no {
> 		set default_casesensitive 0
>-	} else {
>+		set smartcase 0
>+	}
>+	smart {
>+		set default_casesensitive 0
>+		set smartcase 1
>+	}
>+	yes -
>+	default {
> 		set default_casesensitive 1
>+		set smartcase 0
>+	}
> 	}
> 
> 	set history [list]
>@@ -157,12 +166,10 @@ method _incrsearch {} {
> 	if {[catch {$ctext index anchor}]} {
> 		$ctext mark set anchor [_get_new_anchor $this]
> 	}
>-	if {$smartcase} {
>-		if {[regexp {[[:upper:]]} $searchstring]} {
>+	if {$searchstring ne {}} {
>+		if {$smartcase && [regexp {[[:upper:]]} $searchstring]} {
> 			set casesensitive 1
> 		}
>-	}
>-	if {$searchstring ne {}} {
> 		set here [_do_search $this anchor mlen]
> 		if {$here ne {}} {
> 			$ctext see $here
>@@ -175,6 +182,9 @@ method _incrsearch {} {
> 			#$w.ent configure -background lightpink
> 			$w.ent state pressed
> 		}
>+	} elseif {$smartcase} {
>+		# clearing the field resets the smart case detection
>+		set casesensitive 0
> 	}
> }

Look good to me. Applied.
-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply

* Re: [PATCH] git-gui: span widgets over the full file output area in the blame view
From: Pat Thoyts @ 2011-10-21 21:41 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: git
In-Reply-To: <16d7f36e4d24d8816035f934836395e5f854f1d3.1319138993.git.bert.wesarg@googlemail.com>

Bert Wesarg <bert.wesarg@googlemail.com> writes:

>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>---
> lib/blame.tcl |    9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
>diff --git a/lib/blame.tcl b/lib/blame.tcl
>index 49eae19..b031e66 100644
>--- a/lib/blame.tcl
>+++ b/lib/blame.tcl
>@@ -219,7 +219,8 @@ constructor new {i_commit i_path i_jump} {
> 	eval grid $w_columns $w.file_pane.out.sby -sticky nsew
> 	grid conf \
> 		$w.file_pane.out.sbx \
>-		-column [expr {[llength $w_columns] - 1}] \
>+		-column 0 \
>+		-columnspan [expr {[llength $w_columns] + 1}] \
> 		-sticky we
> 	grid columnconfigure \
> 		$w.file_pane.out \
>@@ -229,12 +230,14 @@ constructor new {i_commit i_path i_jump} {
> 
> 	set finder [::searchbar::new \
> 		$w.file_pane.out.ff $w_file \
>-		-column [expr {[llength $w_columns] - 1}] \
>+		-column 0 \
>+		-columnspan [expr {[llength $w_columns] + 1}] \
> 		]
> 
> 	set gotoline [::linebar::new \
> 		$w.file_pane.out.lf $w_file \
>-		-column [expr {[llength $w_columns] - 1}] \
>+		-column 0 \
>+		-columnspan [expr {[llength $w_columns] + 1}] \
> 		]
> 
> 	set w_cviewer $w.file_pane.cm.t

Looks good. Applied.
-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply

* Re: [PATCH] git-gui: guitools: add the path in the confirmation dialog for tools which needs one
From: Pat Thoyts @ 2011-10-21 22:19 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: git
In-Reply-To: <2fef219736a0787ed864b5c18adf31f7a4e8acda.1319139139.git.bert.wesarg@googlemail.com>

Bert Wesarg <bert.wesarg@googlemail.com> writes:

>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>---
> lib/tools.tcl |   10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
>diff --git a/lib/tools.tcl b/lib/tools.tcl
>index 95e6e55..39e08f0 100644
>--- a/lib/tools.tcl
>+++ b/lib/tools.tcl
>@@ -87,8 +87,14 @@ proc tools_exec {fullname} {
> 			return
> 		}
> 	} elseif {[is_config_true "guitool.$fullname.confirm"]} {
>-		if {[ask_popup [mc "Are you sure you want to run %s?" $fullname]] ne {yes}} {
>-			return
>+		if {[is_config_true "guitool.$fullname.needsfile"]} {
>+			if {[ask_popup [mc "Are you sure you want to run %s on file \"%s\"?" $fullname $current_diff_path]] ne {yes}} {
>+				return
>+			}
>+		} else {
>+			if {[ask_popup [mc "Are you sure you want to run %s?" $fullname]] ne {yes}} {
>+				return
>+			}
> 		}
> 	}

This looks good. I modified the string there to use positional
parameters as sometimes translations need to re-order things and the
msgcat format can support this using [mc {%2$s and %1$d} $first $second]
-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply

* Re: [PATCH] git-gui: delegate selection from gutter columns to text output
From: Pat Thoyts @ 2011-10-21 22:24 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: git
In-Reply-To: <5fc6f5d088e37508f1911f89b4d82932071045e0.1319139888.git.bert.wesarg@googlemail.com>

Bert Wesarg <bert.wesarg@googlemail.com> writes:

>Selecting in the gutter columns of the blame view should make no sense,
>so delegate any selection action in these columns to the text output
>by selecting whole lines there.
>
>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>---
> git-gui.sh    |   20 ++++++++++++++++++++
> lib/blame.tcl |    4 +++-
> 2 files changed, 23 insertions(+), 1 deletions(-)
>
>diff --git a/git-gui.sh b/git-gui.sh
>index 21033cb..cf5ed79 100755
>--- a/git-gui.sh
>+++ b/git-gui.sh
>@@ -2077,6 +2077,26 @@ proc many2scrollbar {list mode sb top bottom} {
> 	foreach w $list {$w $mode moveto $top}
> }
> 
>+proc delegate_sel_to {w from} {
>+	set bind_list [list \
>+		<Button-1> \
>+		<B1-Motion> \
>+		<Double-Button-1> \
>+		<Triple-Button-1> \
>+		<Shift-Button-1> \
>+		<Double-Shift-Button-1> \
>+		<Triple-Shift-Button-1> \
>+	]
>+
>+	foreach seq $bind_list {
>+		set script [bind Text $seq]
>+		set new_script [string map [list %W $w %x 0 word line] $script]
>+		foreach f $from {
>+			bind $f $seq "$new_script; break"
>+		}
>+	}
>+}
>+
> proc incr_font_size {font {amt 1}} {
> 	set sz [font configure $font -size]
> 	incr sz $amt
>diff --git a/lib/blame.tcl b/lib/blame.tcl
>index 49eae19..9ab0da5 100644
>--- a/lib/blame.tcl
>+++ b/lib/blame.tcl
>@@ -210,6 +210,8 @@ constructor new {i_commit i_path i_jump} {
> 
> 	set w_columns [list $w_amov $w_asim $w_line $w_file]
> 
>+	delegate_sel_to $w_file [list $w_amov $w_asim $w_line]
>+
> 	${NS}::scrollbar $w.file_pane.out.sbx \
> 		-orient h \
> 		-command [list $w_file xview]
>@@ -315,7 +317,7 @@ constructor new {i_commit i_path i_jump} {
> 		$i conf -yscrollcommand \
> 			"[list ::searchbar::scrolled $finder]
> 			 [list many2scrollbar $w_columns yview $w.file_pane.out.sby]"
>-		bind $i <Button-1> "
>+		bind $i <Button-1> "+
> 			[cb _hide_tooltip]
> 			[cb _click $i @%x,%y]
> 			focus $i

The patch seems to be fine but I don't think I agree with the intention
here. Currently clicking anywhere that is not marked as a link (blue
underlined text) selects a commit and shows information in the lower
pane. With this change, the left hand columns become inactive in regards
to selecting a commit. I don't see why that is desirable.

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply

* Re: [PATCH] git-gui: guitools: add the path in the confirmation dialog for tools which needs one
From: Junio C Hamano @ 2011-10-21 22:43 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: Bert Wesarg, git
In-Reply-To: <87ipni3s3n.fsf@fox.patthoyts.tk>

Pat Thoyts <patthoyts@users.sourceforge.net> writes:

> .... I modified the string there to use positional
> parameters as sometimes translations need to re-order things and the
> msgcat format can support this using [mc {%2$s and %1$d} $first $second]

Good catch.

^ permalink raw reply

* What's cooking in git.git (Oct 2011, #08; Fri, 21)
From: Junio C Hamano @ 2011-10-21 22:51 UTC (permalink / raw)
  To: git

Here are the topics that have been cooking.  Commits prefixed with '-' are
only in 'pu' (proposed updates) while commits prefixed with '+' are in 'next'.

It probably is a good point to stop taking new topics and start
switching our focus to fixing bugs in the topics already in 'master'.

Here are the repositories that have my integration branches:

With maint, master, next, pu, todo, html and man:

        git://git.kernel.org/pub/scm/git/git.git
        git://repo.or.cz/alt-git.git
        https://code.google.com/p/git-core/
        https://github.com/git/git

With only maint, master, html and man:

        git://git.sourceforge.jp/gitroot/git-core/git.git
        git://git-core.git.sourceforge.net/gitroot/git-core/git-core

With all the topics and integration branches but not todo, html or man:

        https://github.com/gitster/git

By the way, I am planning to stop pushing the generated documentation
branches to the above repositories in the near term, as they are not
sources. The only reason the source repository at k.org has hosted these
branches was because it was the only repository over there that was
writable by me; it was an ugly historical and administrative workaround
and not a demonstration of the best practice.

They are pushed to their own separate repositories instead:

        git://git.kernel.org/pub/scm/git/git-{htmldocs,manpages}.git/
        git://repo.or.cz/git-{htmldocs,manpages}.git/
        https://code.google.com/p/git-{htmldocs,manpages}.git/
        https://github.com/gitster/git-{htmldocs,manpages}.git/

--------------------------------------------------
[New Topics]

* fg/submodule-git-file-git-dir (2011-10-21) 2 commits
 - submodule::module_clone(): silence die() message from module_name()
 - submodule: whitespace fix

* jc/broken-ref-dwim-fix (2011-10-19) 3 commits
  (merged to 'next' on 2011-10-19 at 40cad95)
 + resolve_ref(): report breakage to the caller without warning
 + resolve_ref(): expose REF_ISBROKEN flag
 + refs.c: move dwim_ref()/dwim_log() from sha1_name.c
 (this branch is tangled with jc/check-ref-format-fixup.)

This only takes good bits from the failed jc/check-ref-format-fixup topic
and implements saner workaround for the recent breakage on the 'master'.
Will merge to 'master' shortly.

* jm/maint-gitweb-filter-forks-fix (2011-10-21) 1 commit
  (merged to 'next' on 2011-10-21 at debedcd)
 + gitweb: fix regression when filtering out forks

Will merge to 'master' shortly.

* lh/gitweb-site-html-head (2011-10-21) 1 commit
 - gitweb: provide a way to customize html headers

Looked Ok.
Will merge to 'next'.

* mh/ref-api-3 (2011-10-19) 11 commits
 - is_refname_available(): reimplement using do_for_each_ref_in_array()
 - names_conflict(): simplify implementation
 - names_conflict(): new function, extracted from is_refname_available()
 - repack_without_ref(): reimplement using do_for_each_ref_in_array()
 - do_for_each_ref_in_array(): new function
 - do_for_each_ref(): correctly terminate while processesing extra_refs
 - add_ref(): take a (struct ref_entry *) parameter
 - create_ref_entry(): extract function from add_ref()
 - parse_ref_line(): add a check that the refname is properly formatted
 - repack_without_ref(): remove temporary
 - Rename another local variable name -> refname
 (this branch uses mh/ref-api and mh/ref-api-2.)

Looked reasonable.
Will merge to 'next'.

* mm/mediawiki-author-fix (2011-10-20) 1 commit
 - git-remote-mediawiki: don't include HTTP login/password in author

Will merge to 'next'.

--------------------------------------------------
[Stalled]

* hv/submodule-merge-search (2011-10-13) 4 commits
 - submodule.c: make two functions static
 - allow multiple calls to submodule merge search for the same path
 - push: Don't push a repository with unpushed submodules
 - push: teach --recurse-submodules the on-demand option

What the topic aims to achieve may make sense, but the implementation
looked somewhat suboptimal.

The fix-up at the tip queued on fg/submodule-auto-push topic has been
moved to this topic.

* sr/transport-helper-fix-rfc (2011-07-19) 2 commits
 - t5800: point out that deleting branches does not work
 - t5800: document inability to push new branch with old content

Perhaps 281eee4 (revision: keep track of the end-user input from the
command line, 2011-08-25) would help.

* jc/lookup-object-hash (2011-08-11) 6 commits
 - object hash: replace linear probing with 4-way cuckoo hashing
 - object hash: we know the table size is a power of two
 - object hash: next_size() helper for readability
 - pack-objects --count-only
 - object.c: remove duplicated code for object hashing
 - object.c: code movement for readability

I do not think there is anything fundamentally wrong with this series, but
the risk of breakage far outweighs observed performance gain in one
particular workload.

--------------------------------------------------
[Cooking]

* rr/revert-cherry-pick (2011-10-19) 6 commits
 - revert: simplify communicating command-line arguments
 - revert: allow mixed pick and revert instructions
 - revert: make commit subjects in insn sheet optional
 - revert: fix buffer overflow in insn sheet parser
 - revert: simplify getting commit subject in format_todo()
 - revert: free msg in format_todo()

Perhaps 3rd and 4th should be squashed together?

* jc/match-refs-clarify (2011-09-12) 2 commits
  (merged to 'next' on 2011-10-19 at b295e1e)
 + rename "match_refs()" to "match_push_refs()"
 + send-pack: typofix error message

Will merge to 'master' shortly.

* jn/libperl-git-config (2011-10-21) 2 commits
  (merged to 'next' on 2011-10-21 at 76e2d4b)
 + Add simple test for Git::config_path() in t/t9700-perl-git.sh
 + libperl-git: refactor Git::config_*

Will merge to 'master' shortly.

* ss/inet-ntop (2011-10-18) 1 commit
  (merged to 'next' on 2011-10-19 at 85469f6)
 + inet_ntop.c: Work around GCC 4.6's detection of uninitialized variables

Will merge to 'master' shortly.

* jc/check-ref-format-fixup (2011-10-19) 3 commits
  (merged to 'next' on 2011-10-19 at 98981be)
 + Revert "Restrict ref-like names immediately below $GIT_DIR"
  (merged to 'next' on 2011-10-15 at 8e89bc5)
 + Restrict ref-like names immediately below $GIT_DIR
 + refs.c: move dwim_ref()/dwim_log() from sha1_name.c
 (this branch is tangled with jc/broken-ref-dwim-fix.)

This became a no-op except for the bottom one which is part of the other
topic now.
Will discard once the other topic graduates to 'master'.

* pw/p4-update (2011-10-17) 6 commits
  (merged to 'next' on 2011-10-17 at f69f6cc)
 + git-p4: handle files with shell metacharacters
 + git-p4: keyword flattening fixes
 + git-p4: stop ignoring apple filetype
 + git-p4: recognize all p4 filetypes
 + git-p4: handle utf16 filetype properly
 + git-p4 tests: refactor and cleanup

Will merge to 'master' in the fifth wave.

* cn/doc-config-bare-subsection (2011-10-16) 1 commit
  (merged to 'next' on 2011-10-17 at a6412d4)
 + Documentation: update [section.subsection] to reflect what git does

Will merge to 'master' in the fifth wave.

* cb/daemon-permission-errors (2011-10-17) 2 commits
 - daemon: report permission denied error to clients
 - daemon: add tests
 (this branch uses jk/daemon-msgs.)

The tip commit might be loosening things a bit too much.
Will keep in 'pu' until hearing a convincing argument for the patch.

* jc/verbose-checkout (2011-10-16) 2 commits
 - checkout -v: give full status output after switching branches
 - checkout: move the local changes report to the end

This is just to leave a record that the reason why we do not do this not
because we are incapable of coding this, but because it is not a good idea
to do this. I suspect people who are new to git that might think they need
it would soon realize the don't.

Will keep in 'pu' as a showcase for a while and then will drop.

* kk/gitweb-side-by-side-diff (2011-10-17) 2 commits
 - gitweb: add a feature to show side-by-side diff
 - gitweb: change format_diff_line() to remove leading SP from $diff_class

Fun.
Will keep in 'pu' until the planned re-roll comes.

* mh/ref-api-2 (2011-10-17) 14 commits
  (merged to 'next' on 2011-10-19 at cc89f0e)
 + resolve_gitlink_ref_recursive(): change to work with struct ref_cache
 + Pass a (ref_cache *) to the resolve_gitlink_*() helper functions
 + resolve_gitlink_ref(): improve docstring
 + get_ref_dir(): change signature
 + refs: change signatures of get_packed_refs() and get_loose_refs()
 + is_dup_ref(): extract function from sort_ref_array()
 + add_ref(): add docstring
 + parse_ref_line(): add docstring
 + is_refname_available(): remove the "quiet" argument
 + clear_ref_array(): rename from free_ref_array()
 + refs: rename parameters result -> sha1
 + refs: rename "refname" variables
 + struct ref_entry: document name member
 + cache.h: add comments for git_path() and git_path_submodule()
 (this branch is used by mh/ref-api-3; uses mh/ref-api.)

It is either merge this quickly to 'master' and hope there won't be any
more unexpected breakage that forces us to delay the release, or hold it
on 'next' until the next cycle. I am inclined to the former, but not quite
ready to commit to it yet.

* po/insn-editor (2011-10-17) 1 commit
  (merged to 'next' on 2011-10-19 at cbf5e0b)
 + "rebase -i": support special-purpose editor to edit insn sheet

Will merge to 'master' shortly.

* dm/pack-objects-update (2011-10-20) 4 commits
 - pack-objects: don't traverse objects unnecessarily
 - pack-objects: rewrite add_descendants_to_write_order() iteratively
 - pack-objects: use unsigned int for counter and offset values
 - pack-objects: mark add_to_write_order() as inline

Need to re-read this before deciding what to do; it came a bit too late in
the cycle for a series that touches a seriously important part of the
system.

* jk/git-tricks (2011-10-21) 3 commits
 - completion: match ctags symbol names in grep patterns
 - contrib: add git-jump script
 - contrib: add diff highlight script

Will merge to 'next'.

* jc/make-tags (2011-10-18) 1 commit
  (merged to 'next' on 2011-10-19 at b0b91bf)
 + Makefile: ask "ls-files" to list source files if available

Will merge to 'master' shortly.

* jc/signed-commit (2011-10-20) 6 commits
 - parse_signed_commit: really use the entire commit log message
 - test "commit -S" and "log --show-signature"
 - t7004: extract generic "GPG testing" bits
 - log: --show-signature
 - commit: teach --gpg-sign option
 - Split GPG interface into its own helper library

This is to replace the earlier "signed push" experiments. Probably ready
for 'next'.

* mh/ref-api (2011-10-16) 7 commits
  (merged to 'next' on 2011-10-17 at 219000f)
 + clear_ref_cache(): inline function
 + write_ref_sha1(): only invalidate the loose ref cache
 + clear_ref_cache(): extract two new functions
 + clear_ref_cache(): rename parameter
 + invalidate_ref_cache(): expose this function in the refs API
 + invalidate_ref_cache(): take the submodule as parameter
 + invalidate_ref_cache(): rename function from invalidate_cached_refs()
 (this branch is used by mh/ref-api-2 and mh/ref-api-3.)

It is either merge this quickly to 'master' and hope there won't be any
more unexpected breakage that forces us to delay the release, or hold it
on 'next' until the next cycle. I am inclined to the former, but not quite
ready to commit to it yet.

* sg/complete-refs (2011-10-21) 9 commits
 - completion: remove broken dead code from __git_heads() and __git_tags()
 - completion: fast initial completion for config 'remote.*.fetch' value
 - completion: improve ls-remote output filtering in __git_refs_remotes()
 - completion: query only refs/heads/ in __git_refs_remotes()
 - completion: support full refs from remote repositories
 - completion: improve ls-remote output filtering in __git_refs()
 - completion: make refs completion consistent for local and remote repos
 - completion: optimize refs completion
 - completion: document __gitcomp()

Rerolled.

Will keep in 'pu' until an Ack or two from people who have worked on the
completion in the past comes.

* jc/unseekable-bundle (2011-10-13) 2 commits
  (merged to 'next' on 2011-10-19 at 2978ee0)
 + bundle: add parse_bundle_header() helper function
 + bundle: allowing to read from an unseekable fd

Will merge to 'master' shortly.

* jk/daemon-msgs (2011-10-15) 1 commit
  (merged to 'next' on 2011-10-15 at 415cf53)
 + daemon: give friendlier error messages to clients
 (this branch is used by cb/daemon-permission-errors.)

Will merge to 'master' in the fifth wave.

* jk/maint-pack-objects-compete-with-delete (2011-10-14) 2 commits
  (merged to 'next' on 2011-10-15 at 49479e4)
 + downgrade "packfile cannot be accessed" errors to warnings
 + pack-objects: protect against disappearing packs

Will merge to 'master' in the fifth wave.

* cn/fetch-prune (2011-10-15) 5 commits
  (merged to 'next' on 2011-10-16 at 02a449e)
 + fetch: treat --tags like refs/tags/*:refs/tags/* when pruning
 + fetch: honor the user-provided refspecs when pruning refs
 + remote: separate out the remote_find_tracking logic into query_refspecs
 + t5510: add tests for fetch --prune
 + fetch: free all the additional refspecs

Will merge to 'master' in the sixth wave.

* sc/difftool-skip (2011-10-14) 2 commits
  (merged to 'next' on 2011-10-14 at b91c581)
 + t7800: avoid arithmetic expansion notation
  (merged to 'next' on 2011-10-11 at 38d7e84)
 + git-difftool: allow skipping file by typing 'n' at prompt

Will merge to 'master' in the fifth wave.

* jc/maint-remove-renamed-ref (2011-10-12) 1 commit
  (merged to 'next' on 2011-10-12 at 819c3e4)
 + branch -m/-M: remove undocumented RENAMED-REF

Will merge to 'master' in the sixth wave.

* ph/transport-with-gitfile (2011-10-11) 5 commits
  (merged to 'next' on 2011-10-12 at 6d58417)
 + Fix is_gitfile() for files too small or larger than PATH_MAX to be a gitfile
  (merged to 'next' on 2011-10-06 at 891b8b6)
 + Add test showing git-fetch groks gitfiles
 + Teach transport about the gitfile mechanism
 + Learn to handle gitfiles in enter_repo
 + enter_repo: do not modify input

Will merge to 'master' in the fifth wave.

* jc/request-pull-show-head-4 (2011-10-15) 11 commits
  (merged to 'next' on 2011-10-15 at 7e340ff)
 + fmt-merge-msg.c: Fix an "dubious one-bit signed bitfield" sparse error
  (merged to 'next' on 2011-10-10 at 092175e)
 + environment.c: Fix an sparse "symbol not declared" warning
 + builtin/log.c: Fix an "Using plain integer as NULL pointer" warning
  (merged to 'next' on 2011-10-07 at fcaeca0)
 + fmt-merge-msg: use branch.$name.description
  (merged to 'next' on 2011-10-06 at fa5e0fe)
 + request-pull: use the branch description
 + request-pull: state what commit to expect
 + request-pull: modernize style
 + branch: teach --edit-description option
 + format-patch: use branch description in cover letter
 + branch: add read_branch_desc() helper function
 + Merge branch 'bk/ancestry-path' into jc/branch-desc

Will merge to 'master' in the sixth wave.

^ permalink raw reply

* Re: What's cooking in git.git (Oct 2011, #08; Fri, 21)
From: Jakub Narebski @ 2011-10-21 23:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Kato Kazuyoshi
In-Reply-To: <7vzkgu6jrf.fsf@alter.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> writes:


> * lh/gitweb-site-html-head (2011-10-21) 1 commit
>  - gitweb: provide a way to customize html headers
> 
> Looked Ok.
> Will merge to 'next'.

Nice.
 
> * kk/gitweb-side-by-side-diff (2011-10-17) 2 commits
>  - gitweb: add a feature to show side-by-side diff
>  - gitweb: change format_diff_line() to remove leading SP from $diff_class
> 
> Fun.
> Will keep in 'pu' until the planned re-roll comes.

I think this needs some more work, not only re-roll...


BTW. the bottom commit could be I think replaced by mine

   - gitweb: Refactor diff body line classification

Anyway, thanks for putting it in 'pu', it saves me trouble of fixing
whitespace issues in patch :-P

-- 
Jakub Narębski

^ permalink raw reply

* a bug when execute "git status" in git version 1.7.7.431.g89633
From: John Hsing @ 2011-10-22  0:20 UTC (permalink / raw)
  To: git

the error:
git: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr)
(((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct
malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >=
(unsigned long)((((__builtin_offsetof (struct malloc_chunk,
fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) -
1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask)
== 0)' failed.

^ permalink raw reply

* Re: [PATCH 1/3] MSVC: Compile fix by not including sys/resources.h
From: Junio C Hamano @ 2011-10-22  0:56 UTC (permalink / raw)
  To: Vincent van Ravesteijn; +Cc: git
In-Reply-To: <4EA1C9C9.9010904@lyx.org>

>> ...
>> Subject: [PATCH 1/3] MSVC: Compile fix by not including sys/resources.h
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
........................................................^^^^^^

Could you refrain from doing that?  It breaks the patch text.

Vincent van Ravesteijn <vfr@lyx.org> writes:

> Fix compilation when compiling with MSVC because sys/resource.h
> is not available. This patch causes a number of other headerfiles
> that are not available to be excluded as well.
>
> Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>

Instead of current

	#ifndef mingw32 is the only one that is strange
        ... everything for systems that is not strainge ...
        #else
        ... include mingw specific tweaks ...
        #endif
        #ifdef msvc is also strange
        ... include msvc specific tweaks ...
        #endif

it turns things around and says what it wants to achieve in a more direct
way, i.e.

	#if mingw32
        #include "compat/mingw.h"
	#elif msvc
        #include "compat/msvc.h"
	#else
        ... all the others ...
	#endif

which makes it look simpler.

^ permalink raw reply

* [PATCH 7/5] pretty: %G[?GS] placeholders
From: Junio C Hamano @ 2011-10-22  5:01 UTC (permalink / raw)
  To: git
In-Reply-To: <1319071023-31919-1-git-send-email-gitster@pobox.com>

Add new placeholders related to the GPG signature on signed commits.

 - %GG to show the raw verification message from GPG;
 - %G? to show either "G" for Good, "B" for Bad;
 - %GS to show the name of the signer.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * The 6th is the one that works with a bogus commit with NUL in it I sent
   out previously.

   This concludes the series; I'll leave the design and implementation of
   other useful placeholders to the list for now.

 pretty.c |   86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/pretty.c b/pretty.c
index f45eb54..392d656 100644
--- a/pretty.c
+++ b/pretty.c
@@ -9,6 +9,7 @@
 #include "notes.h"
 #include "color.h"
 #include "reflog-walk.h"
+#include "gpg-interface.h"
 
 static char *user_format;
 static struct cmt_fmt_map {
@@ -640,6 +641,12 @@ struct format_commit_context {
 	const struct pretty_print_context *pretty_ctx;
 	unsigned commit_header_parsed:1;
 	unsigned commit_message_parsed:1;
+	unsigned commit_signature_parsed:1;
+	struct {
+		char *gpg_output;
+		char good_bad;
+		char *signer;
+	} signature;
 	char *message;
 	size_t width, indent1, indent2;
 
@@ -822,6 +829,59 @@ static void rewrap_message_tail(struct strbuf *sb,
 	c->indent2 = new_indent2;
 }
 
+static struct {
+	char result;
+	const char *check;
+} signature_check[] = {
+	{ 'G', ": Good signature from " },
+	{ 'B', ": BAD signature from " },
+};
+
+static void parse_signature_lines(struct format_commit_context *ctx)
+{
+	const char *buf = ctx->signature.gpg_output;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(signature_check); i++) {
+		const char *found = strstr(buf, signature_check[i].check);
+		const char *next;
+		if (!found)
+			continue;
+		ctx->signature.good_bad = signature_check[i].result;
+		found += strlen(signature_check[i].check);
+		next = strchrnul(found, '\n');
+		ctx->signature.signer = xmemdupz(found, next - found);
+		break;
+	}
+}
+
+static void parse_commit_signature(struct format_commit_context *ctx)
+{
+	struct strbuf payload = STRBUF_INIT;
+	struct strbuf signature = STRBUF_INIT;
+	struct strbuf gpg_output = STRBUF_INIT;
+	int status;
+
+	ctx->commit_signature_parsed = 1;
+
+	if (parse_signed_commit(ctx->commit->object.sha1,
+				&payload, &signature) <= 0)
+		goto out;
+	status = verify_signed_buffer(payload.buf, payload.len,
+				      signature.buf, signature.len,
+				      &gpg_output);
+	if (status && !gpg_output.len)
+		goto out;
+	ctx->signature.gpg_output = strbuf_detach(&gpg_output, NULL);
+	parse_signature_lines(ctx);
+
+ out:
+	strbuf_release(&gpg_output);
+	strbuf_release(&payload);
+	strbuf_release(&signature);
+}
+
+
 static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
 				void *context)
 {
@@ -974,6 +1034,30 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
 		return 0;
 	}
 
+	if (placeholder[0] == 'G') {
+		if (!c->commit_signature_parsed)
+			parse_commit_signature(c);
+		switch (placeholder[1]) {
+		case 'G':
+			if (c->signature.gpg_output)
+				strbuf_addstr(sb, c->signature.gpg_output);
+			break;
+		case '?':
+			switch (c->signature.good_bad) {
+			case 'G':
+			case 'B':
+				strbuf_addch(sb, c->signature.good_bad);
+			}
+			break;
+		case 'S':
+			if (c->signature.signer)
+				strbuf_addstr(sb, c->signature.signer);
+			break;
+		}
+		return 2;
+	}
+
+
 	/* For the rest we have to parse the commit header. */
 	if (!c->commit_header_parsed)
 		parse_commit_header(c);
@@ -1114,6 +1198,8 @@ void format_commit_message(const struct commit *commit,
 
 	if (context.message != commit->buffer)
 		free(context.message);
+	free(context.signature.gpg_output);
+	free(context.signature.signer);
 }
 
 static void pp_header(const struct pretty_print_context *pp,
-- 
1.7.7.555.g02edb3

^ permalink raw reply related

* Re: Breakage in master since 6d4bb3833c
From: Michael Haggerty @ 2011-10-22  5:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: SZEDER Gábor, git discussion list
In-Reply-To: <7vehy68ejp.fsf@alter.siamese.dyndns.org>

On 10/21/2011 07:01 PM, Junio C Hamano wrote:
> Michael Haggerty <mhagger@alum.mit.edu> writes:
> 
>> Yes, you are right.  Setting GIT=$(pwd)/bin-wrappers/git fixes the problem.
> 
> So in short, this was a false alarm crying wolf, and there was no problem?

Correct, it was my fault for not running the locally-compiled version of
git the correct way to get consistent invocation of subprocesses.  So
there was no problem.

...but there arguably *is* a metaproblem, namely that the obvious naive
way to invoke a locally-compiled test version of git without installing
it neither works correctly nor fails loudly.  It sometimes works (if the
main process doesn't need to call any subprocesses), sometimes works
accidentally (if the subprocess that is used happens to have the
behavior expected by the test version) and sometimes fails bizarrely (as
in my case and other cases recently mentioned on the mailing list).

I can think of a few ugly hacks that could improve the situation:

1. Don't compile executables into the project root directory, but rather
into a subdirectory named something awful like
"do-not-run-commands-from-this-directory" with a big README.txt in the
directory explaining how the commands *should* be run.  Even knowing
that one has to RTFM would be a help.

2. Include a special file like "GIT-DEV-SETUP" in the directory to which
the executables are compiled, but don't copy this file to $BINDIR when
git is installed.  Teach git commands to check for the presence of
$(dirname $0)/GIT-DEV-SETUP, and if found, do the equivalent of "exec
GIT-DEV-SETUP "$@"" or maybe just read and use some values out of
GIT-DEV-SETUP to set up the correct environment.  There could be some
environment variable like GIT_SETUP_DONE to prevent recursion and/or
allow this step to be bypassed.

3. Have git commands tell git subcommands what version they are
expecting (either via an environment variable or via a hidden
command-line parameter), and have the subcommand barf if the version
does not match its own internal version.  This approach is more
intrusive but would also help defend against inconsistently-installed
versions (like having one version installed in /usr/bin and fragments of
another version installed in $HOME/bin).

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

^ permalink raw reply

* Re: [PATCH 7/5] pretty: %G[?GS] placeholders
From: Elia Pinto @ 2011-10-22 10:47 UTC (permalink / raw)
  To: Junio C Hamano, git
In-Reply-To: <7v7h3x7h6j.fsf_-_@alter.siamese.dyndns.org>

Can you suggest what do you think can be useful placeholders ? Thanks.

2011/10/22, Junio C Hamano <gitster@pobox.com>:
> Add new placeholders related to the GPG signature on signed commits.
>
>  - %GG to show the raw verification message from GPG;
>  - %G? to show either "G" for Good, "B" for Bad;
>  - %GS to show the name of the signer.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  * The 6th is the one that works with a bogus commit with NUL in it I sent
>    out previously.
>
>    This concludes the series; I'll leave the design and implementation of
>    other useful placeholders to the list for now.
>
>  pretty.c |   86
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 86 insertions(+), 0 deletions(-)
>
> diff --git a/pretty.c b/pretty.c
> index f45eb54..392d656 100644
> --- a/pretty.c
> +++ b/pretty.c
> @@ -9,6 +9,7 @@
>  #include "notes.h"
>  #include "color.h"
>  #include "reflog-walk.h"
> +#include "gpg-interface.h"
>
>  static char *user_format;
>  static struct cmt_fmt_map {
> @@ -640,6 +641,12 @@ struct format_commit_context {
>  	const struct pretty_print_context *pretty_ctx;
>  	unsigned commit_header_parsed:1;
>  	unsigned commit_message_parsed:1;
> +	unsigned commit_signature_parsed:1;
> +	struct {
> +		char *gpg_output;
> +		char good_bad;
> +		char *signer;
> +	} signature;
>  	char *message;
>  	size_t width, indent1, indent2;
>
> @@ -822,6 +829,59 @@ static void rewrap_message_tail(struct strbuf *sb,
>  	c->indent2 = new_indent2;
>  }
>
> +static struct {
> +	char result;
> +	const char *check;
> +} signature_check[] = {
> +	{ 'G', ": Good signature from " },
> +	{ 'B', ": BAD signature from " },
> +};
> +
> +static void parse_signature_lines(struct format_commit_context *ctx)
> +{
> +	const char *buf = ctx->signature.gpg_output;
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(signature_check); i++) {
> +		const char *found = strstr(buf, signature_check[i].check);
> +		const char *next;
> +		if (!found)
> +			continue;
> +		ctx->signature.good_bad = signature_check[i].result;
> +		found += strlen(signature_check[i].check);
> +		next = strchrnul(found, '\n');
> +		ctx->signature.signer = xmemdupz(found, next - found);
> +		break;
> +	}
> +}
> +
> +static void parse_commit_signature(struct format_commit_context *ctx)
> +{
> +	struct strbuf payload = STRBUF_INIT;
> +	struct strbuf signature = STRBUF_INIT;
> +	struct strbuf gpg_output = STRBUF_INIT;
> +	int status;
> +
> +	ctx->commit_signature_parsed = 1;
> +
> +	if (parse_signed_commit(ctx->commit->object.sha1,
> +				&payload, &signature) <= 0)
> +		goto out;
> +	status = verify_signed_buffer(payload.buf, payload.len,
> +				      signature.buf, signature.len,
> +				      &gpg_output);
> +	if (status && !gpg_output.len)
> +		goto out;
> +	ctx->signature.gpg_output = strbuf_detach(&gpg_output, NULL);
> +	parse_signature_lines(ctx);
> +
> + out:
> +	strbuf_release(&gpg_output);
> +	strbuf_release(&payload);
> +	strbuf_release(&signature);
> +}
> +
> +
>  static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
>  				void *context)
>  {
> @@ -974,6 +1034,30 @@ static size_t format_commit_one(struct strbuf *sb,
> const char *placeholder,
>  		return 0;
>  	}
>
> +	if (placeholder[0] == 'G') {
> +		if (!c->commit_signature_parsed)
> +			parse_commit_signature(c);
> +		switch (placeholder[1]) {
> +		case 'G':
> +			if (c->signature.gpg_output)
> +				strbuf_addstr(sb, c->signature.gpg_output);
> +			break;
> +		case '?':
> +			switch (c->signature.good_bad) {
> +			case 'G':
> +			case 'B':
> +				strbuf_addch(sb, c->signature.good_bad);
> +			}
> +			break;
> +		case 'S':
> +			if (c->signature.signer)
> +				strbuf_addstr(sb, c->signature.signer);
> +			break;
> +		}
> +		return 2;
> +	}
> +
> +
>  	/* For the rest we have to parse the commit header. */
>  	if (!c->commit_header_parsed)
>  		parse_commit_header(c);
> @@ -1114,6 +1198,8 @@ void format_commit_message(const struct commit
> *commit,
>
>  	if (context.message != commit->buffer)
>  		free(context.message);
> +	free(context.signature.gpg_output);
> +	free(context.signature.signer);
>  }
>
>  static void pp_header(const struct pretty_print_context *pp,
> --
> 1.7.7.555.g02edb3
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-- 
Inviato dal mio dispositivo mobile

^ permalink raw reply

* Re: [PATCH] Makefile: do not set setgid bit on directories on GNU/kFreeBSD
From: Jonathan Nieder @ 2011-10-22 11:11 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Alex Riesen, Christopher M. Fuhrman, Greg Troxel,
	Stefan Sperling
In-Reply-To: <20111003064120.GA24396@elie>

(people cc-ed: your input would be welcome on [*] below.  See commit
81a24b52, "Do not use GUID on dir in git init --shared=all on FreeBSD"
for context)

Hi Junio,

>From Documentation/RelNotes/1.7.7.1.txt:

 * On some BSD systems, adding +s bit on directories is detrimental
   (it is not necessary on BSD to begin with). The installation
   procedure has been updated to take this into account.

I assume this is referring to 0b20dd8f (Makefile: do not set setgid
bit on directories on GNU/kFreeBSD, 2011-10-03), which admittedly
does have a subject line that suggests it would be about that (sorry
about that).  The change was actually about "git init -s" which sets
the setgid bit on SysV-style systems to allow shared access to a
repository (and can provoke errors on BSD-style systems, depending on
how permissive the filesystem in use wants to be).

More to the point, the patch was just taking a fix that arrived for
FreeBSD in v1.5.5 days and making it also apply to machines using an
(obscure) GNU userland/FreeBSD kernel mixture.

By the way, maybe other BSD-style ports (NetBSD, OpenBSD) should be
setting DIR_HAS_BSD_GROUP_SEMANTICS to get this fix, too[*]?  Then the
release notes could look something like this:

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Documentation/RelNotes/1.7.7.1.txt |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git i/Documentation/RelNotes/1.7.7.1.txt w/Documentation/RelNotes/1.7.7.1.txt
index fecfac8a..e3c29ff0 100644
--- i/Documentation/RelNotes/1.7.7.1.txt
+++ w/Documentation/RelNotes/1.7.7.1.txt
@@ -5,8 +5,9 @@ Fixes since v1.7.7
 ------------------
 
  * On some BSD systems, adding +s bit on directories is detrimental
-   (it is not necessary on BSD to begin with). The installation
-   procedure has been updated to take this into account.
+   (it is not necessary on BSD to begin with). "git init --shared"
+   has been updated to take this into account without extra makefile
+   settings on platforms the Makefile knows about.
 
  * After incorrectly written third-party tools store a tag object in
    HEAD, git diagnosed it as a repository corruption and refused to
-- 

^ permalink raw reply related

* Re: What's cooking in git.git (Oct 2011, #08; Fri, 21)
From: Jakub Narebski @ 2011-10-22 13:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Kato Kazuyoshi
In-Reply-To: <m3r5256h76.fsf@localhost.localdomain>

Jakub Narebski <jnareb@gmail.com> writes:
> Junio C Hamano <gitster@pobox.com> writes:

> > * kk/gitweb-side-by-side-diff (2011-10-17) 2 commits
> >  - gitweb: add a feature to show side-by-side diff
> >  - gitweb: change format_diff_line() to remove leading SP from $diff_class
> > 
> > Fun.
> > Will keep in 'pu' until the planned re-roll comes.
> 
> I think this needs some more work, not only re-roll...
> 
> 
> BTW. the bottom commit could be I think replaced by mine
> 
>    - gitweb: Refactor diff body line classification

Nb. that needs a easy but non-trivial merge conflict resolution,
see e.g.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The following changes since commit 8963314c77af9a4eda5dcbdbab3d4001af83ad81:

  Sync with maint (2011-10-21 11:24:34 -0700)

are available in the git repository at:

  git://repo.or.cz/git/jnareb-git.git gitweb/side-by-side-diff

Jakub Narebski (1):
      gitweb: Refactor diff body line classification

Kato Kazuyoshi (1):
      gitweb: add a feature to show side-by-side diff

 gitweb/gitweb.perl       |  144 ++++++++++++++++++++++++++++++++++------------
 gitweb/static/gitweb.css |   15 +++++
 2 files changed, 123 insertions(+), 36 deletions(-)

-- 
Jakub Narebski

^ permalink raw reply

* Re: [PATCH] git-gui: delegate selection from gutter columns to text output
From: Bert Wesarg @ 2011-10-22 15:41 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: git
In-Reply-To: <87ehy63rvx.fsf@fox.patthoyts.tk>

On Sat, Oct 22, 2011 at 00:24, Pat Thoyts
<patthoyts@users.sourceforge.net> wrote:
> Bert Wesarg <bert.wesarg@googlemail.com> writes:
>
>>Selecting in the gutter columns of the blame view should make no sense,
>>so delegate any selection action in these columns to the text output
>>by selecting whole lines there.
>>
>>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>>---
>> git-gui.sh    |   20 ++++++++++++++++++++
>> lib/blame.tcl |    4 +++-
>> 2 files changed, 23 insertions(+), 1 deletions(-)
>>
>>diff --git a/git-gui.sh b/git-gui.sh
>>index 21033cb..cf5ed79 100755
>>--- a/git-gui.sh
>>+++ b/git-gui.sh
>>@@ -2077,6 +2077,26 @@ proc many2scrollbar {list mode sb top bottom} {
>>       foreach w $list {$w $mode moveto $top}
>> }
>>
>>+proc delegate_sel_to {w from} {
>>+      set bind_list [list \
>>+              <Button-1> \
>>+              <B1-Motion> \
>>+              <Double-Button-1> \
>>+              <Triple-Button-1> \
>>+              <Shift-Button-1> \
>>+              <Double-Shift-Button-1> \
>>+              <Triple-Shift-Button-1> \
>>+      ]
>>+
>>+      foreach seq $bind_list {
>>+              set script [bind Text $seq]
>>+              set new_script [string map [list %W $w %x 0 word line] $script]
>>+              foreach f $from {
>>+                      bind $f $seq "$new_script; break"
>>+              }
>>+      }
>>+}
>>+
>> proc incr_font_size {font {amt 1}} {
>>       set sz [font configure $font -size]
>>       incr sz $amt
>>diff --git a/lib/blame.tcl b/lib/blame.tcl
>>index 49eae19..9ab0da5 100644
>>--- a/lib/blame.tcl
>>+++ b/lib/blame.tcl
>>@@ -210,6 +210,8 @@ constructor new {i_commit i_path i_jump} {
>>
>>       set w_columns [list $w_amov $w_asim $w_line $w_file]
>>
>>+      delegate_sel_to $w_file [list $w_amov $w_asim $w_line]
>>+
>>       ${NS}::scrollbar $w.file_pane.out.sbx \
>>               -orient h \
>>               -command [list $w_file xview]
>>@@ -315,7 +317,7 @@ constructor new {i_commit i_path i_jump} {
>>               $i conf -yscrollcommand \
>>                       "[list ::searchbar::scrolled $finder]
>>                        [list many2scrollbar $w_columns yview $w.file_pane.out.sby]"
>>-              bind $i <Button-1> "
>>+              bind $i <Button-1> "+
>>                       [cb _hide_tooltip]
>>                       [cb _click $i @%x,%y]
>>                       focus $i
>
> The patch seems to be fine but I don't think I agree with the intention
> here. Currently clicking anywhere that is not marked as a link (blue
> underlined text) selects a commit and shows information in the lower
> pane. With this change, the left hand columns become inactive in regards
> to selecting a commit. I don't see why that is desirable.

Sorry, this was not intended. And I thought I took care for it with
the last hunk. I have a look at it again.

Bert

>
> --
> Pat Thoyts                            http://www.patthoyts.tk/
> PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD
>

^ permalink raw reply

* [PATCH] make the sample pre-commit hook script reject names with newlines, too
From: Jim Meyering @ 2011-10-22 17:19 UTC (permalink / raw)
  To: git list


The sample pre-commit hook script would fail to reject a file name
like "a\nb" because of the way newlines are handled in "$(...)".
Adjust the test to count filtered bytes and require there be 0.
Also print all diagnostics to standard error, not stdout, so they
will actually be seen.

Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 templates/hooks--pre-commit.sample |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/templates/hooks--pre-commit.sample b/templates/hooks--pre-commit.sample
index b187c4b..1addec5 100755
--- a/templates/hooks--pre-commit.sample
+++ b/templates/hooks--pre-commit.sample
@@ -18,6 +18,9 @@ fi
 # If you want to allow non-ascii filenames set this variable to true.
 allownonascii=$(git config hooks.allownonascii)

+# Redirect output to stderr.
+exec 1>&2
+
 # Cross platform projects tend to avoid non-ascii filenames; prevent
 # them from being added to the repository. We exploit the fact that the
 # printable range starts at the space character and ends with tilde.
@@ -26,7 +29,7 @@ if [ "$allownonascii" != "true" ] &&
 	# even required, for portability to Solaris 10's /usr/bin/tr), since
 	# the square bracket bytes happen to fall in the designated range.
 	test "$(git diff --cached --name-only --diff-filter=A -z $against |
-	  LC_ALL=C tr -d '[ -~]\0')"
+	  LC_ALL=C tr -d '[ -~]\0' | wc -c)" != 0
 then
 	echo "Error: Attempt to add a non-ascii file name."
 	echo
@@ -43,4 +46,5 @@ then
 	exit 1
 fi

+# If there are whitespace errors, print the offending file names and fail.
 exec git diff-index --check --cached $against --
--
1.7.7.419.g87009

^ permalink raw reply related

* [PATCH 0/2] git-credential-cache--daemon on Cygwin
From: Ramsay Jones @ 2011-10-22 17:23 UTC (permalink / raw)
  To: Jeff King; +Cc: GIT Mailing-list

Hi Jeff,

When the 'jk/http-auth-keyring' branch was in next (and later back
in pu), I noticed that the t0300-credentials.sh test failing on cygwin.

I had a quick look, and found that unix_stream_listen() was failing to
bind() to a stale unix socket. The code looked OK to me, and should have
handled this just fine, but didn't ...

On a hunch, I found that the following "belt-n-braces" approach fixed the
the test for me:

-- >8 --
diff --git a/unix-socket.c b/unix-socket.c
index cf9890f..d974e01 100644
--- a/unix-socket.c
+++ b/unix-socket.c
@@ -42,7 +42,9 @@ int unix_stream_listen(const char *path)
 	fd = unix_stream_socket();
 
 	if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
+		close(fd);
 		unlink(path);
+		fd = unix_stream_socket();
 		if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
 			close(fd);
 			return -1;
-- 8< --

However, I don't particularly like the above solution, so I decided to take
a look at credential-cache--daemon to see why it was leaving a stale socket
in the first place. The following patches are the result:

    [PATCH 1/2] credential-cache--daemon.c: Don't leave stale socket on --exit
    [PATCH 2/2] credential-cache--daemon.c: unlink() a potentially stale unix socket

Note that, in serve_one_client(), the "--exit" action results in the server
exit(0)-ing immediately without close()-ing and unlink()-ing the socket.
So, patch #1 changes serve_one_client() to return a value to serve_cache_loop()
which indicates whether it's caller (serve_cache()) should exit from the main
server loop. This results in the socket being cleaned up correctly in the "--exit"
case.

Note that this does not eliminate all early-exit code paths (for example, we note
an die_errno() call), so it is still possible for the server to exit without
having cleaned up the socket, so patch #2 adds on unlink() call to the beginning of
serve_cache().

Note that each of these patches, separately and together, fix the test on cygwin.

Assuming that a modified http-auth-keyring series will make a return to pu
sometime, could you please squash these patches into (the patch corresponding to)
commit 2d6874d (credentials: add "cache" helper, 18-07-2011). Thanks!

Also, note that this series breaks the build on MinGW. The patch to fix the build
is rather simple, but the result doesn't work, of course, because winsock does
not know about AF_UNIX (or AF_LOCAL). I started to code an win32 emulation of unix
sockets, but stopped working on it when this branch dropped from next. If you
intend to re-submit this work, then I can pick this up again.

HTH.

ATB,
Ramsay Jones

^ permalink raw reply related

* [PATCH 1/2] credential-cache--daemon.c: Don't leave stale socket on --exit
From: Ramsay Jones @ 2011-10-22 17:24 UTC (permalink / raw)
  To: Jeff King; +Cc: GIT Mailing-list



Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 credential-cache--daemon.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/credential-cache--daemon.c b/credential-cache--daemon.c
index 128c5ce..ee2c15a 100644
--- a/credential-cache--daemon.c
+++ b/credential-cache--daemon.c
@@ -137,22 +137,22 @@ static int read_credential_request(FILE *fh, struct credential *c,
 	return 0;
 }
 
-static void serve_one_client(FILE *in, FILE *out)
+static int serve_one_client(FILE *in, FILE *out)
 {
 	struct credential c = { NULL };
 	int timeout = -1;
 	char *action = NULL;
 
 	if (read_credential_request(in, &c, &action, &timeout) < 0)
-		return;
+		return 1;
 
 	if (!action) {
 		warning("cache client didn't specify an action");
-		return;
+		return 1;
 	}
 
 	if (!strcmp(action, "exit"))
-		exit(0);
+		return 0;
 
 	if (!strcmp(action, "get")) {
 		struct credential_cache_entry *e = lookup_credential(&c);
@@ -160,27 +160,27 @@ static void serve_one_client(FILE *in, FILE *out)
 			fprintf(out, "username=%s\n", e->item.username);
 			fprintf(out, "password=%s\n", e->item.password);
 		}
-		return;
+		return 1;
 	}
 
 	if (!strcmp(action, "erase")) {
 		remove_credential(&c);
-		return;
+		return 1;
 	}
 
 	if (!strcmp(action, "store")) {
 		if (timeout < 0) {
 			warning("cache client didn't specify a timeout");
-			return;
+			return 1;
 		}
 
 		remove_credential(&c);
 		cache_credential(&c, timeout);
-		return;
+		return 1;
 	}
 
 	warning("cache client sent unknown action: %s", action);
-	return;
+	return 1;
 }
 
 static int serve_cache_loop(int fd)
@@ -201,7 +201,7 @@ static int serve_cache_loop(int fd)
 	}
 
 	if (pfd.revents & POLLIN) {
-		int client, client2;
+		int client, client2, ret;
 		FILE *in, *out;
 
 		client = accept(fd, NULL, NULL);
@@ -218,9 +218,10 @@ static int serve_cache_loop(int fd)
 
 		in = xfdopen(client, "r");
 		out = xfdopen(client2, "w");
-		serve_one_client(in, out);
+		ret = serve_one_client(in, out);
 		fclose(in);
 		fclose(out);
+		return ret;
 	}
 	return 1;
 }
-- 
1.7.7

^ permalink raw reply related

* [PATCH 2/2] credential-cache--daemon.c: unlink() a potentially stale unix socket
From: Ramsay Jones @ 2011-10-22 17:25 UTC (permalink / raw)
  To: Jeff King; +Cc: GIT Mailing-list



Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 credential-cache--daemon.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/credential-cache--daemon.c b/credential-cache--daemon.c
index ee2c15a..c5fb1b2 100644
--- a/credential-cache--daemon.c
+++ b/credential-cache--daemon.c
@@ -230,6 +230,7 @@ static void serve_cache(const char *socket_path)
 {
 	int fd;
 
+	unlink(socket_path);
 	fd = unix_stream_listen(socket_path);
 	if (fd < 0)
 		die_errno("unable to bind to '%s'", socket_path);
-- 
1.7.7

^ 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