Git development
 help / color / mirror / Atom feed
* Re: [PATCH] write first for-merge ref to FETCH_HEAD first
From: Junio C Hamano @ 2012-01-04  0:12 UTC (permalink / raw)
  To: Joey Hess; +Cc: Junio C Hamano, git
In-Reply-To: <20120104000339.GA22662@gnu.kitenet.net>

Joey Hess <joey@kitenet.net> writes:

> Junio C Hamano wrote:
>> Ping? I think this is a good change to go in before 1.7.9.
>> 
>> The change broke quite a lot of tests, and I think I've fixed them all.
>
> Signed-off-by: Joey Hess <joey@kitenet.net>
>
> (Hope that's enough!)

Yes. Thanks.

^ permalink raw reply

* Incremental preview of "What's cooking" 1st issue of this year
From: Junio C Hamano @ 2012-01-04  0:24 UTC (permalink / raw)
  To: git

These are only notable new bits.  I'll send out the real report probably
tomorrow or the day after.

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

* ss/git-svn-prompt-sans-terminal (2012-01-03) 2 commits
 - git-svn, perl/Git.pm: extend Git::prompt helper for querying users
 - perl/Git.pm: "prompt" helper to honor GIT_ASKPASS and SSH_ASKPASS

The bottom one has been replaced with a rewrite based on comments from
Ævar, and the top one was adjusted to it. Peff's suggestion to give
precedence to tty over SSH_ASKPASS when terminal is available may make
sense for the second one, so we may want to fix the second one further
once 1.7.9 is out. I think the bottom one is OK for 1.7.9.

Will merge the bottom one to 'next' soonish.

* pw/p4-view-updates (2012-01-03) 6 commits
  (merged to 'next' on 2012-01-03 at c3b5872)
 + git-p4: view spec documentation
 + git-p4: rewrite view handling
 + git-p4: support single file p4 client view maps
 + git-p4: sort client views by reverse View number
 + git-p4: fix test for unsupported P4 Client Views
 + git-p4: test client view handling

Will merge to 'master' by 1.7.9 unless real git-p4 users object (I am not
one of them, so I cannot really judge).

--------------------------------------------------
[Graduated to "master"]

* jv/maint-config-set (2011-12-27) 1 commit
  (merged to 'next' on 2011-12-27 at 551ac8f)
 + Fix an incorrect reference to --set-all.

* pw/p4-docs-and-tests (2011-12-27) 11 commits
  (merged to 'next' on 2011-12-28 at 8acf26e)
 + git-p4: document and test submit options
 + git-p4: test and document --use-client-spec
 + git-p4: test --keep-path
 + git-p4: test --max-changes
 + git-p4: document and test --import-local
 + git-p4: honor --changesfile option and test
 + git-p4: document and test clone --branch
 + git-p4: test cloning with two dirs, clarify doc
 + git-p4: clone does not use --git-dir
 + git-p4: introduce asciidoc documentation
 + rename git-p4 tests

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

* jh/fetch-head-update (2012-01-03) 1 commit
 - write first for-merge ref to FETCH_HEAD first

Will merge to 'next'.

* jc/signed-commit (2011-11-29) 5 commits
  (merged to 'next' on 2011-12-21 at 8fcbf00)
 + gpg-interface: allow use of a custom GPG binary
 + pretty: %G[?GS] placeholders
 + test "commit -S" and "log --show-signature"
 + log: --show-signature
 + commit: teach --gpg-sign option

I am ambivalent on this one. I do not desperately need it myself, I know
the kernel folks do not, I heard some other people might.

We should to do something similar to what we do for the embedded "gpgsig"
header in this series to the embedded "mergetag" header that is used to
record a merge of a signed tag when the "--show-signature" option and/or
"%G[?GS]" pretty placeholders are used, so it may make sense to merge this
and build such feature on top of it before 1.7.9 ships.

Opinions?

^ permalink raw reply

* Re: [BUG] gitweb generates wrong links in grep search results (git_search_files)
From: Junio C Hamano @ 2012-01-04  0:28 UTC (permalink / raw)
  To: Thomas Perl, Jakub Narebski; +Cc: git
In-Reply-To: <CA+uOhx6i-07kW8K0y3Co++2ABD=Lmaq3r4h1hN4YLskAE+hR1Q@mail.gmail.com>

Thomas Perl <th.perl@gmail.com> writes:

> I think I found a bug in gitweb when grep'ing for text in a branch
> different from "master". Here's how to reproduce it:

Thanks for a detailed report (and thanks for gpodder ;-).

Jakub, care to take a look?

>
> 1. Have a project with a master branch and a branch different from master
> 2. Start gitweb for that project (e.g. using "git instaweb") and open
> it in a web browser
> 3. Switch to the non-master branch (e.g.
> http://127.0.0.1:1234/?p=.git;a=shortlog;h=refs/heads/mynonmasterbranch)
> 4. In the top right search box, select "grep" in the combo box and
> enter a text that only appears in the non-master branch
> 5. Submit the search by pressing enter, you should be at:
> http://127.0.0.1:1234/?p=.git&a=search&h=refs%2Fheads%2Fmynonmasterbranch&st=grep&s=somesearchtext
>
> ACTUAL RESULT
> In that list of results, you should now see some files matching the
> search - note that the links for the file names and the line numbers
> go to e.g. http://127.0.0.1:1234/?p=.git;a=blob;f=somefile.txt for a
> file "somefile.txt". The links therefore go to the master branch,
> while the search results refer to the non-master branch.
>
> EXPECTED RESULT
> The link should (presumably) go to
> http://127.0.0.1:1234/?p=.git;a=blob;hb=refs%2Fheads%2Fmynonmasterbranch;f=somefile.txt
> so that when the link is clicked, the right file (somefile.txt in
> mynonmasterbranch) is shown.
>
> I also investigated a bit in where the problem happens, and nailed it
> down to: gitweb/gitweb.perl, sub git_search_files, line 5871 in commit
> 17b4e93d5b849293e6a3659bbc4075ed8a6e97e2 (current master tip of
> https://github.com/gitster/git). I haven't looked at the intrinsics of
> the "href" sub, but I believe that it should somehow get the "h"
> parameter from the original page and incorporate it into the final
> link (as "hb" parameter?) to the file. The same fix that is applied
> there then also needs to be applied at line 5891 (same commit, same
> file).
>
> No patch, because after several tries, I didn't get it to work, my
> Perl foo might not be up to the task, and I believe that someone more
> familiar with gitweb's code base might have an easier time to fix
> this.
>
> Thanks,
> Thomas

^ permalink raw reply

* Re: [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS
From: Sven Strickroth @ 2012-01-04  7:55 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Jakub Narebski
In-Reply-To: <7v39bws4xi.fsf@alter.siamese.dyndns.org>

Am 04.01.2012 01:10 schrieb Junio C Hamano:
> I'll queue both of them in 'pu' for now just in case others spot silly
> mistakes I made while rewriting the first one, though.

I just hit another issue (I created another patch, but we might want to
integrate it into the first one). This is especially needed if we want
to apply my second patch in this mail.
From: Sven Strickroth <email@cs-ware.de>
Date: Wed, 4 Jan 2012 08:32:13 +0100
Subject: [PATCH] Git.pm: check if value is defined before accessing it

Some perl versions, like the one from msys, crash sometimes
if reading from STDIN wasn't successful and chomp is applied
to the variable into which was read.

Errormessage:
Username: Use of uninitialized value in chomp at C:\Program
Files\Git/libexec/git-core\git-svn line 4321.
0 [main] perl.exe" 1916 handle_exceptions: Exception:
STATUS_ACCESS_VIOLATION
1297 [main] perl.exe" 1916 open_stackdumpfile: Dumping stack trace to
perl.exe.stackdump

Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
 perl/Git.pm |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index 33e68c4..1c96a20 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -547,7 +547,12 @@ sub prompt {
 			print STDERR "\n";
 			STDERR->flush;
 		} else {
-			chomp($ret = <STDIN>);
+			$ret = <STDIN>;
+			if (defined $ret) {
+				chomp($ret);
+			} else {
+				$ret = '';
+			}
 		}
 	}
 	return $ret;

> For the second patch, I have a feeling that Peff's earlier suggestion to
> give precedence to the terminal interaction over SSH_ASKPASS iff we can
> open terminal, but I think the first one is OK for 1.7.9.

We also do the wrong order for querying the password. if we want to
adopt this, we should also update prompt.c, the make both prompt methods
behave the same way again.

The Git.pm part is easy, but I also tried to update prompt.c (untested).
From: Sven Strickroth <email@cs-ware.de>
Date: Wed, 4 Jan 2012 08:44:48 +0100
Subject: [PATCH] Git.pm, prompt: try reading from interactive terminal
before
 using SSH_ASKPASS

SVN tries to read reading from interactive terminal before using
SSH_ASKPASS helper. This change adjust git to behave the same way.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
 perl/Git.pm |    6 +++---
 prompt.c    |   14 +++++++++++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index 1c96a20..6ce193e 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -530,9 +530,6 @@ sub prompt {
 		$ret = _prompt($ENV{'GIT_ASKPASS'}, $prompt);
 	}
 	if (!defined $ret) {
-		$ret = _prompt($ENV{'SSH_ASKPASS'}, $prompt);
-	}
-	if (!defined $ret) {
 		print STDERR $prompt;
 		STDERR->flush;
 		if ($isPassword) {
@@ -555,5 +552,8 @@ sub prompt {
 		}
 	}
+	if (!defined $ret) {
+		$ret = _prompt($ENV{'SSH_ASKPASS'}, $prompt);
+	}
 	return $ret;
 }


diff --git a/prompt.c b/prompt.c
index 72ab9de..e791619 100644
--- a/prompt.c
+++ b/prompt.c
@@ -52,9 +52,17 @@ char *git_prompt(const char *prompt, int flags)
 	}

 	r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
-	if (!r)
-		die_errno("could not read '%s'", prompt);
-	return r;
+	if (r)
+		return r;
+
+	if (flags & PROMPT_ASKPASS) {
+		const char *askpass;
+		askpass = getenv("SSH_ASKPASS");
+		if (askpass && *askpass)
+			return do_askpass(askpass, prompt);
+	}
+
+	die_errno("could not read '%s'", prompt);
 }

 char *git_getpass(const char *prompt)
-- 
Best regards,
 Sven Strickroth
 ClamAV, a GPL anti-virus toolkit   http://www.clamav.net
 PGP key id F5A9D4C4 @ any key-server

^ permalink raw reply related

* Re: [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS
From: Sven Strickroth @ 2012-01-04  8:31 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Jakub Narebski
In-Reply-To: <4F0405D4.9090102@tu-clausthal.de>

Am 04.01.2012 08:55 schrieb Sven Strickroth:
> The Git.pm part is easy, but I also tried to update prompt.c (untested).

I said "easy" and then I mailed the wrong/outdated patch :(
I'm sorry for the noise.

From: Sven Strickroth <email@cs-ware.de>
Date: Wed, 4 Jan 2012 08:44:48 +0100
Subject: [PATCH] Git.pm, prompt: try reading from interactive terminal
 before using SSH_ASKPASS

SVN tries to read reading from interactive terminal before using
SSH_ASKPASS helper. This change adjust git to behave the same way.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
 perl/Git.pm |    9 ++++-----
 prompt.c    |   14 +++++++++++---
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index 1c96a20..721aef7 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -530,13 +530,9 @@ sub prompt {
 		$ret = _prompt($ENV{'GIT_ASKPASS'}, $prompt);
 	}
 	if (!defined $ret) {
-		$ret = _prompt($ENV{'SSH_ASKPASS'}, $prompt);
-	}
-	if (!defined $ret) {
 		print STDERR $prompt;
 		STDERR->flush;
 		if ($isPassword) {
-			$ret = '';
 			require Term::ReadKey;
 			Term::ReadKey::ReadMode('noecho');
 			while (defined(my $key = Term::ReadKey::ReadKey(0))) {
@@ -551,10 +547,13 @@ sub prompt {
 			if (defined $ret) {
 				chomp($ret);
 			} else {
-				$ret = '';
+				undef $ret;
 			}
 		}
 	}
+	if (!defined $ret) {
+		$ret = _prompt($ENV{'SSH_ASKPASS'}, $prompt);
+	}
 	return $ret;
 }

diff --git a/prompt.c b/prompt.c
index 72ab9de..e791619 100644
--- a/prompt.c
+++ b/prompt.c
@@ -52,9 +52,17 @@ char *git_prompt(const char *prompt, int flags)
 	}

 	r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
-	if (!r)
-		die_errno("could not read '%s'", prompt);
-	return r;
+	if (r)
+		return r;
+
+	if (flags & PROMPT_ASKPASS) {
+		const char *askpass;
+		askpass = getenv("SSH_ASKPASS");
+		if (askpass && *askpass)
+			return do_askpass(askpass, prompt);
+	}
+
+	die_errno("could not read '%s'", prompt);
 }

 char *git_getpass(const char *prompt)
-- 
Best regards,
 Sven Strickroth
 ClamAV, a GPL anti-virus toolkit   http://www.clamav.net
 PGP key id F5A9D4C4 @ any key-server

^ permalink raw reply related

* Re: git-p4 under cygwin
From: Paul Chown @ 2012-01-04  8:54 UTC (permalink / raw)
  To: Thomas Berg; +Cc: git


On 1/3/12, Thomas Berg <merlin66b@gmail.com> wrote:
> On Tue, Jan 3, 2012 at 4:32 PM, Paul Chown <pmchown@yahoo.co.uk> wrote:
>> Path '/cygdrive/c/work/perforce/config_test\...' is not under client's
>> root 'c:\work\perforce\config_test'.
>
> Ah, sorry, I did not see this part of the error message when I first
> replied. This does seem like a cygwin related problem. Not sure how
> easy it is to solve. But as mentioned, msysgit works fine with git-p4.
>
> - Thomas
>

Thanks! with msysgit it works a lot better. The 'vi' invocation failed during the submit, and I tried just about every EDITOR variation that I could think of without success, but I could workround that by setting EDITOR to use the Windows notepad.exe instead.

Paul

^ permalink raw reply

* Auto-refresh git-gui
From: Victor Engmark @ 2012-01-04  9:15 UTC (permalink / raw)
  To: git

Is there some way to make `git-gui` rescan automatically when anything
in the repository changes? That would enable a more fluid workflow when
combined with other Git tools.

Use cases:
* "Dashboard" functionality to keep track of changes without having to
run `git status` all the time.
* `git` / `git-gui` introduction: See what happens live while working
with the other tool.

-- 
Victor Engmark
terreActive AG
Kasinostrasse 30
CH-5001 Aarau
Tel: +41 62 834 00 55
Fax: +41 62 823 93 56
www.terreactive.ch

Wir sichern Ihren Erfolg - seit 15 Jahren

^ permalink raw reply

* Re: Warning from AV software about kill.exe
From: Erik Blake @ 2012-01-04  9:15 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: Thomas Rast, git
In-Reply-To: <878vm4lb9q.fsf@fox.patthoyts.tk>

Another way to implement this (on Windows) would be for the git programs 
to tag themselves with a mutex. Then the "kill" program can determine 
which git programs are running and send them user-defined windows 
messages to shut themselves down. Alternatively, you could send the 
programs the standard windows WM_CLOSE message, but the OS or an AV 
program might still be troubled by that behaviour.

This is how we implement this type of behaviour in our windows programs. 
It does not raise the ire of the OS or AV since you do not have one 
process trying to shut down another. It also bypasses all issues with 
process privileges etc.

Erik

On 2011-12-22 19:19, Pat Thoyts wrote:
> Thomas Rast<trast@student.ethz.ch>  writes:
>
>> Erik Blake<erik@icefield.yk.ca>  writes:
>>
>>> I'm running git under Win7 64. As I selected "Repository|Visualize all
>>> branch history" in the git gui, my AV software (Trustport) trapped the
>>> bin\kill.exe program for "trying to modify system global settings
>>> (time, timezone, registry quota, etc.)"
>>>
>>> Does anyone know the details of this process and what it's function
>>> is? First time I've seen it, though I'm a relatively new user.
>> 'kill' is a standard unix utility that sends signals to processes, in
>> particular signals that cause the processes to exit or be killed
>> forcibly by the kernel, hence the name.  (I don't know how the windows
>> equivalent works under the hood, but presumably it's something similar.)
>>
>> git-gui and gitk use kill to terminate background worker processes that
>> are no longer needed because you closed the window their output would
>> have been displayed in, etc.
> You might try replacing the command in the tcl scripts with 'exec
> taskkill /f /pid $pid' and see if that avoids the error. taskkill is
> present on XP and above as part of the OS distribution so shouldn't
> suffer any AV complaints.
>

^ permalink raw reply

* [PATCH] Catch invalid --depth option passed to clone or fetch
From: Nguyễn Thái Ngọc Duy @ 2012-01-04 10:01 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 transport.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/transport.c b/transport.c
index 51814b5..8a13f43 100644
--- a/transport.c
+++ b/transport.c
@@ -474,8 +474,12 @@ static int set_git_option(struct git_transport_options *opts,
 	} else if (!strcmp(name, TRANS_OPT_DEPTH)) {
 		if (!value)
 			opts->depth = 0;
-		else
-			opts->depth = atoi(value);
+		else {
+			char *end;
+			opts->depth = strtol(value, &end, 0);
+			if (*end)
+				die("transport: invalid depth option '%s'", value);
+		}
 		return 0;
 	}
 	return 1;
-- 
1.7.3.1.256.g2539c.dirty

^ permalink raw reply related

* Re: Stashing individual files
From: Tor Arntsen @ 2012-01-04 10:12 UTC (permalink / raw)
  To: Jeff King; +Cc: Chris Leong, git
In-Reply-To: <20120103190612.GC20926@sigill.intra.peff.net>

On Tue, Jan 3, 2012 at 20:06, Jeff King <peff@peff.net> wrote:

> IOW, make the "--" a requirement for specifying filenames. The only
> regression is that "--" as a single argument can no longer be used in
> stash messages. So this works now:
>
>  git stash save working on foo -- needs bar
>
> but would be interpreted under my proposal as stashing "needs" and "bar"
> with the message "working on foo". You would instead have to spell it:
>
>  git stash save "working on foo -- needs bar"

For what it's worth, that's how I always add messages to stash.. with
quotes. It had never occured to me to use the form
git stash save working on foo -- needs bar
(no quotes), it's so ingrained that a multi-word message should be
quoted that I would never have thought of even trying without the
quotes! :-)

-Tor

^ permalink raw reply

* [PATCH] gitweb: accept trailing "/" in $project_list
From: Matthieu Moy @ 2012-01-04 10:07 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy

The current code is removing the trailing "/", but computing the string
length on the previous value, i.e. with the trailing "/". Later in the
code, we do

  my $path = substr($File::Find::name, $pfxlen + 1);

And the "$pfxlen + 1" is supposed to mean "the length of the prefix, plus
1 for the / separating the prefix and the path", but with an incorrect
$pfxlen, this basically eats the first character of the path, and yields
"404 - No projects found".

While we're there, also fix $pfxdepth to use $dir, although a change of 1
in the depth shouldn't really matter.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
I'm not fluent in Perl, and not familiar at all with gitweb, but this
sounds a rather obvious (too obvious?) fix.

 gitweb/gitweb.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index f80f259..4512b89 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2835,8 +2835,8 @@ sub git_get_projects_list {
 		my $dir = $projects_list;
 		# remove the trailing "/"
 		$dir =~ s!/+$!!;
-		my $pfxlen = length("$projects_list");
-		my $pfxdepth = ($projects_list =~ tr!/!!);
+		my $pfxlen = length("$dir");
+		my $pfxdepth = ($dir =~ tr!/!!);
 		# when filtering, search only given subdirectory
 		if ($filter) {
 			$dir .= "/$filter";
-- 
1.7.8.384.g29bb3

^ permalink raw reply related

* [PATCH] Do not fetch tags on new shallow clones
From: Nguyễn Thái Ngọc Duy @ 2012-01-04 11:35 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

The main purpose of shallow clones is to reduce download. Fetching
tags likely defeats this purpose because old-enough repos tend to have
a lot of tags, spreading across history, which may increase the number
of objects to download significantly.

For example, "git clone --depth=10 git://.../git.git" without changes
fetches ~16M (50k objects). The same command with changes fetches
~6.5M (10k objects).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 This could also be applied for normal clones. But I don't think
 there are many use cases for it, enough to deserve new --no-tags
 option.

 We should also fetch a single branch, but because branches are
 usually less crowded and stay close the tip, they do not produce too
 many extra objects. Let's leave it until somebody yells up.

 We should also fetch tags that reference to downloaded objects. But I
 don't know how fetch does that magic, so for now users have to do
 "git fetch" after cloning for tags. I have only gone as far as
 fetching tags along by setting TRANS_OPT_FOLLOWTAGS? Help?

 builtin/clone.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index 86db954..abd8578 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -428,7 +428,7 @@ static struct ref *wanted_peer_refs(const struct ref *refs,
 	struct ref **tail = head ? &head->next : &local_refs;
 
 	get_fetch_map(refs, refspec, &tail, 0);
-	if (!option_mirror)
+	if (!option_mirror && !option_depth)
 		get_fetch_map(refs, tag_refspec, &tail, 0);
 
 	return local_refs;
-- 
1.7.8.36.g69ee2

^ permalink raw reply related

* Re: [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS
From: Jeff King @ 2012-01-04 13:34 UTC (permalink / raw)
  To: Sven Strickroth; +Cc: git, Junio C Hamano, Jakub Narebski
In-Reply-To: <4F040E46.5030001@tu-clausthal.de>

On Wed, Jan 04, 2012 at 09:31:02AM +0100, Sven Strickroth wrote:

> diff --git a/prompt.c b/prompt.c
> index 72ab9de..e791619 100644
> --- a/prompt.c
> +++ b/prompt.c
> @@ -52,9 +52,17 @@ char *git_prompt(const char *prompt, int flags)
>  	}
> 
>  	r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
> -	if (!r)
> -		die_errno("could not read '%s'", prompt);
> -	return r;
> +	if (r)
> +		return r;
> +
> +	if (flags & PROMPT_ASKPASS) {
> +		const char *askpass;
> +		askpass = getenv("SSH_ASKPASS");
> +		if (askpass && *askpass)
> +			return do_askpass(askpass, prompt);
> +	}
> +
> +	die_errno("could not read '%s'", prompt);
>  }

Wouldn't you also have to drop checking of SSH_ASKPASS in the block
right before calling git_terminal_prompt (right before the context in
your patch)?

-Peff

^ permalink raw reply

* Re: [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS
From: Sven Strickroth @ 2012-01-04 14:13 UTC (permalink / raw)
  To: Jeff King; +Cc: git, Junio C Hamano, Jakub Narebski
In-Reply-To: <20120104133459.GA6564@sigill.intra.peff.net>

Am 04.01.2012 14:34 schrieb Jeff King:
> Wouldn't you also have to drop checking of SSH_ASKPASS in the block
> right before calling git_terminal_prompt (right before the context in
> your patch)?

of course :( Thanks for spotting this...

diff --git a/prompt.c b/prompt.c
index 72ab9de..230ac3c 100644
--- a/prompt.c
+++ b/prompt.c
@@ -45,16 +45,23 @@ char *git_prompt(const char *prompt, int flags)
 		askpass = getenv("GIT_ASKPASS");
 		if (!askpass)
 			askpass = askpass_program;
-		if (!askpass)
-			askpass = getenv("SSH_ASKPASS");
 		if (askpass && *askpass)
 			return do_askpass(askpass, prompt);
 	}

 	r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
-	if (!r)
-		die_errno("could not read '%s'", prompt);
-	return r;
+	if (r)
+		return r;
+
+	if (flags & PROMPT_ASKPASS) {
+		const char *askpass;
+
+		askpass = getenv("SSH_ASKPASS");
+		if (askpass && *askpass)
+			return do_askpass(askpass, prompt);
+	}
+
+	die_errno("could not read '%s'", prompt);
 }

 char *git_getpass(const char *prompt)
-- 
Best regards,
 Sven Strickroth
 ClamAV, a GPL anti-virus toolkit   http://www.clamav.net
 PGP key id F5A9D4C4 @ any key-server

^ permalink raw reply related

* Re: [PATCH] Do not fetch tags on new shallow clones
From: Shawn Pearce @ 2012-01-04 15:16 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1325676922-6995-1-git-send-email-pclouds@gmail.com>

2012/1/4 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:
> The main purpose of shallow clones is to reduce download. Fetching
> tags likely defeats this purpose because old-enough repos tend to have
> a lot of tags, spreading across history, which may increase the number
> of objects to download significantly.

Thank you for looking at this. I complained about it to Junio many
weeks ago, but never took the time myself to fix it. :-)

>  We should also fetch a single branch, but because branches are
>  usually less crowded and stay close the tip, they do not produce too
>  many extra objects. Let's leave it until somebody yells up.

Depends on the project. In git.git maint stays relatively close to
master, but its still not really that close. In other projects, there
are certainly huge differences between two active branches, sometimes
spanning years. Consider any product with a multiple year support
contract on an older version, where the support contract demands
patches for the older version to fix bugs.  :-)

I agree this can be looked at later with a different change, but there
should be a way to specify exactly which branches you want to clone,
especially in the shallow case.

>  We should also fetch tags that reference to downloaded objects. But I
>  don't know how fetch does that magic,

If the remote advertises the capability "include-tag", and the client
wants tags, it asks for that include-tag capability in its request.
This is handled by the fetch_pack args field include_tag being set to
1. When the remote side sees the client requesting include-tag and it
packs the thing a tag points at, the tag is also packed, even though
it wasn't explicitly requested by the client.

> so for now users have to do
>  "git fetch" after cloning for tags. I have only gone as far as
>  fetching tags along by setting TRANS_OPT_FOLLOWTAGS? Help?

Right. Set TRANS_OPT_FOLLOWTAGS in the transport structure to fetch
only tags that are pointing at things already being sent. The delta
increase in transfer is 1 object (the tag) and whatever that tag takes
up on disk.

> diff --git a/builtin/clone.c b/builtin/clone.c
> index 86db954..abd8578 100644
> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -428,7 +428,7 @@ static struct ref *wanted_peer_refs(const struct ref *refs,
>        struct ref **tail = head ? &head->next : &local_refs;
>
>        get_fetch_map(refs, refspec, &tail, 0);
> -       if (!option_mirror)
> +       if (!option_mirror && !option_depth)
>                get_fetch_map(refs, tag_refspec, &tail, 0);
>
>        return local_refs;

I think if you just add this into your patch, you get the auto follow
tag feature enabled:

diff --git a/builtin/clone.c b/builtin/clone.c
index efe8b6c..ecaafdb 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -641,6 +641,7 @@ int cmd_clone(int argc, const char **argv, const char *prefi
                        die(_("Don't know how to clone %s"), transport->url);

                transport_set_option(transport, TRANS_OPT_KEEP, "yes");
+               transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");

                if (option_depth)
                        transport_set_option(transport, TRANS_OPT_DEPTH,

totally untested (didn't even compile). This only works for the
"remote" cases where the native Git protocol is used. A local clone
using the hardlink or copy objects path, or a dumb HTTP or rsync clone
will ignore the option and not supply you the tags.

Annnddddd..... it doesn't appear to work.

You need to copy a block of code from fetch. The problem is the object
was copied locally by the transport, but the transport doesn't tell
you what extra objects came along. Clone has to loop back through the
advertised reference map from the transport, checking each tag to see
if has_sha1_file() says the object exists locally. If it does, then
clone needs to add that reference update to the set of things it will
store (and print to the terminal).

I think this loop is the find_non_local_tags() in builtin/fetch.c. Its
been a long time since I hacked on this code. The JGit version of
looking for these extra objects post transfer is more clearly
documented. *sigh*

^ permalink raw reply related

* git-subtree
From: David Greene @ 2012-01-04 15:53 UTC (permalink / raw)
  To: git

Hey all,

Avery Pennarun has suckered me into^W^W^Wasked me to submit his
git-subtree tool for inclusion into mainline.  Apparently there was some
discussion about this at GitTogether.

I have a patch ready.  It takes git-subtree from the current GitHub
master, fixes the tests to use the standard git test harness and updates
the build to recognize git-subtree.

How does the git community want the patch presented?  Right now it's one
monolithic thing.  I understand that isn't ideal but I don't think
incorporating the entire GitHub master history is necessarily the best
idea either.

So I'm looking for some guidance.

Thanks!

                            -Dave

^ permalink raw reply

* Re: [PATCH 1/2] daemon: add tests
From: Clemens Buchacher @ 2012-01-04 15:55 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jonathan Nieder, Jeff King, Erik Faye-Lund, Ilari Liusvaara,
	Nguyễn Thái Ngọc Duy
In-Reply-To: <7v8vlovavj.fsf@alter.siamese.dyndns.org>

Thanks for your review. Please find fixes in reply to this email. In
order to better show individual changes I have not squashed them into
one commit. For upstream, you will probably want to squash patches 3-6
into patch 2. Patch 2 is the same as the one once queued as part of
cb/daemon-permission-errors.

[PATCH 1/6] t5550: repack everything into one file
[PATCH 2/6] daemon: add tests
[PATCH 3/6] avoid use of pkill
[PATCH 4/6] explain expected exit code
[PATCH 5/6] t5570: everything into one file
[PATCH 6/6] chmod: use lower-case x

On Tue, Jan 03, 2012 at 11:34:08AM -0800, Junio C Hamano wrote:
> >> +
> >> +LIB_DAEMON_PORT=${LIB_DAEMON_PORT-'8121'}
> 
> In lib-httpd.sh, LIB_HTTPD_PORT is defined in a similar way, but that is
> always overridden by the users and the convention there is to use the test
> numbers (cf. "git grep LIB_HTTPD_PORT t/"), which should be followed here
> as well.

This you already fixed in the version previously queued and is contained
in [PATCH 2/6] daemon: add tests.

> I am not very keen on the "lib-daemon.sh", GIT_TEST_DAEMON, etc. naming to
> pretend as if "git daemon" will forever be the only daemon we will ever
> ship, by the way.  We might one day want to add an inotify daemon, a
> daemon for the git-pubsub protocol or somesuch.

Are you saying that the name "daemon" is too general, and it should
instead be "lib-git-daemon.sh" and GIT_TEST_GIT_DAEMON? Or do you
mean that it is not general enough and it should be called
lib-networking.sh and "GIT_TEST_NETWORKING"?

Either way, I have no preference here. Feel free to change any way you
like.

> >> +	# kill git-daemon child of git
> >> +	say >&3 "Stopping git daemon ..."
> >> +	pkill -P "$DAEMON_PID"
> 
> How portable is this one (I usually do not trust use of pkill anywhere)?

I read that it is supposed to be more portable than skill or killall.
But I have no way to research this. I have implemented a workaround
using only 'ps' and 'kill' in [PATCH 3/6] avoid use of pkill.

> >> +  wait "$DAEMON_PID"
> >> +  ret=$?
>       # Please comment what 143 is on this line.
> >> +  if test $ret -ne 143

Fixed in [PATCH 4/6] explain expected exit code.

> >> +	 git --bare repack &&
> 
> As the later tests assume there will be only one pack, don't you want at
> least "-a" and possibly "-a -d" here?

Fixed in

 [PATCH 1/6] t5550: repack everything into one file,
 [PATCH 5/6] t5570: repack everything into one file.

> I find the use of cap X here dubious; it makes your intention unclear.
> 
> Are you interested in the current status of 'x' bits on that directory, or
> are you more interested in dropping the executable/searchable bits from
> the directory no matter what its current status is (rhetorical: I fully
> expect that the answer is the latter)?

For directories, upper-case X does not have that meaning. The status is
always overwritten, irrespective of the current status. I wanted to
emphasize the fact that I am changing 'searchable' bits.  But since that
does not seem to have the desired effect, I changed it to lower-case in
[PATCH 6/6] chmod: use lower-case x.

Clemens

^ permalink raw reply

* [PATCH 4/6] explain expected exit code
From: Clemens Buchacher @ 2012-01-04 15:55 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jonathan Nieder, Jeff King, Erik Faye-Lund, Ilari Liusvaara,
	Nguyễn Thái Ngọc Duy
In-Reply-To: <1325692539-26748-1-git-send-email-drizzd@aon.at>

---
 t/lib-daemon.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/t/lib-daemon.sh b/t/lib-daemon.sh
index 5edced5..4701124 100644
--- a/t/lib-daemon.sh
+++ b/t/lib-daemon.sh
@@ -62,6 +62,10 @@ stop_daemon() {
 	kill_children "$DAEMON_PID"
 	wait "$DAEMON_PID"
 	ret=$?
+	#
+	# We signal TERM=15 to the child and expect the parent to
+	# exit with 143 = 128+15.
+	#
 	if test $ret -ne 143
 	then
 		error "git daemon exited with status: $ret"
-- 
1.7.8

^ permalink raw reply related

* [PATCH 5/6] t5570: repack everything into one file
From: Clemens Buchacher @ 2012-01-04 15:55 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jonathan Nieder, Jeff King, Erik Faye-Lund, Ilari Liusvaara,
	Nguyễn Thái Ngọc Duy
In-Reply-To: <1325692539-26748-1-git-send-email-drizzd@aon.at>

Subsequently we assume that there is only one pack. Currently this is
true only by accident. Pass '-a -d' to repack in order to guarantee that
assumption to hold true.

The prune-packed command is now redundant since repack -d already calls
it.
---
 t/t5570-git-daemon.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
index a7d666c..f2b374b 100755
--- a/t/t5570-git-daemon.sh
+++ b/t/t5570-git-daemon.sh
@@ -50,8 +50,7 @@ test_expect_failure 'remote detects correct HEAD' '
 test_expect_success 'prepare pack objects' '
 	cp -R "$DAEMON_DOCUMENT_ROOT_PATH"/repo.git "$DAEMON_DOCUMENT_ROOT_PATH"/repo_pack.git &&
 	(cd "$DAEMON_DOCUMENT_ROOT_PATH"/repo_pack.git &&
-	 git --bare repack &&
-	 git --bare prune-packed
+	 git --bare repack -a -d
 	)
 '
 
-- 
1.7.8

^ permalink raw reply related

* [PATCH 1/6] t5550: repack everything into one file
From: Clemens Buchacher @ 2012-01-04 15:55 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jonathan Nieder, Jeff King, Erik Faye-Lund, Ilari Liusvaara,
	Nguyễn Thái Ngọc Duy
In-Reply-To: <1325692539-26748-1-git-send-email-drizzd@aon.at>

Subsequently we assume that there is only one pack. Currently this is
true only by accident. Pass '-a -d' to repack in order to guarantee that
assumption to hold true.

The prune-packed command is now redundant since repack -d already calls
it.
---
 t/t5550-http-fetch.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/t/t5550-http-fetch.sh b/t/t5550-http-fetch.sh
index 311a33c..7926ab3 100755
--- a/t/t5550-http-fetch.sh
+++ b/t/t5550-http-fetch.sh
@@ -118,8 +118,7 @@ test_expect_success 'http remote detects correct HEAD' '
 test_expect_success 'fetch packed objects' '
 	cp -R "$HTTPD_DOCUMENT_ROOT_PATH"/repo.git "$HTTPD_DOCUMENT_ROOT_PATH"/repo_pack.git &&
 	(cd "$HTTPD_DOCUMENT_ROOT_PATH"/repo_pack.git &&
-	 git --bare repack &&
-	 git --bare prune-packed
+	 git --bare repack -a -d
 	) &&
 	git clone $HTTPD_URL/dumb/repo_pack.git
 '
-- 
1.7.8

^ permalink raw reply related

* [PATCH 6/6] chmod: use lower-case x
From: Clemens Buchacher @ 2012-01-04 15:55 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jonathan Nieder, Jeff King, Erik Faye-Lund, Ilari Liusvaara,
	Nguyễn Thái Ngọc Duy
In-Reply-To: <1325692539-26748-1-git-send-email-drizzd@aon.at>

---
 t/t5570-git-daemon.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
index f2b374b..d9667f9 100755
--- a/t/t5570-git-daemon.sh
+++ b/t/t5570-git-daemon.sh
@@ -92,7 +92,7 @@ test_remote_error()
 		case $1 in
 		-x)
 			shift
-			chmod -X "$DAEMON_DOCUMENT_ROOT_PATH/repo.git"
+			chmod -x "$DAEMON_DOCUMENT_ROOT_PATH/repo.git"
 			;;
 		-n)
 			shift
@@ -126,7 +126,7 @@ test_remote_error()
 	echo "fatal: remote error: $msg: /$repo" >expect &&
 	test_cmp expect output
 	ret=$?
-	chmod +X "$DAEMON_DOCUMENT_ROOT_PATH/repo.git"
+	chmod +x "$DAEMON_DOCUMENT_ROOT_PATH/repo.git"
 	(exit $ret)
 }
 
-- 
1.7.8

^ permalink raw reply related

* [PATCH 3/6] avoid use of pkill
From: Clemens Buchacher @ 2012-01-04 15:55 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jonathan Nieder, Jeff King, Erik Faye-Lund, Ilari Liusvaara,
	Nguyễn Thái Ngọc Duy
In-Reply-To: <1325692539-26748-1-git-send-email-drizzd@aon.at>

---
 t/lib-daemon.sh |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/t/lib-daemon.sh b/t/lib-daemon.sh
index 30a89ea..5edced5 100644
--- a/t/lib-daemon.sh
+++ b/t/lib-daemon.sh
@@ -31,6 +31,24 @@ start_daemon() {
 	DAEMON_PID=$!
 }
 
+kill_children() {
+	parent=$1
+
+	ps -A -o ppid,pid |
+	(
+		# skip header
+		read
+		while read ppid pid
+		do
+			if test x"$ppid" = x"$parent"
+			then
+				echo "$pid"
+			fi
+		done
+	) |
+	xargs kill
+}
+
 stop_daemon() {
 	if test -z "$DAEMON_PID"
 	then
@@ -41,7 +59,7 @@ stop_daemon() {
 
 	# kill git-daemon child of git
 	say >&3 "Stopping git daemon ..."
-	pkill -P "$DAEMON_PID"
+	kill_children "$DAEMON_PID"
 	wait "$DAEMON_PID"
 	ret=$?
 	if test $ret -ne 143
-- 
1.7.8

^ permalink raw reply related

* [PATCH 2/6] daemon: add tests
From: Clemens Buchacher @ 2012-01-04 15:55 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jonathan Nieder, Jeff King, Erik Faye-Lund, Ilari Liusvaara,
	Nguyễn Thái Ngọc Duy
In-Reply-To: <1325692539-26748-1-git-send-email-drizzd@aon.at>

The semantics of the git daemon tests are similar to the http
transport tests.  In fact, they are only a slightly modified copy
of t5550, plus the newly added remote error tests.

All daemon tests will be skipped unless the environment variable
GIT_TEST_DAEMON is set.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/lib-daemon.sh       |   52 +++++++++++++++++
 t/t5570-git-daemon.sh |  149 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 201 insertions(+), 0 deletions(-)
 create mode 100644 t/lib-daemon.sh
 create mode 100755 t/t5570-git-daemon.sh

diff --git a/t/lib-daemon.sh b/t/lib-daemon.sh
new file mode 100644
index 0000000..30a89ea
--- /dev/null
+++ b/t/lib-daemon.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+if test -z "$GIT_TEST_DAEMON"
+then
+	skip_all="Daemon testing disabled (define GIT_TEST_DAEMON to enable)"
+	test_done
+fi
+
+LIB_DAEMON_PORT=${LIB_DAEMON_PORT-'8121'}
+
+DAEMON_PID=
+DAEMON_DOCUMENT_ROOT_PATH="$PWD"/repo
+DAEMON_URL=git://127.0.0.1:$LIB_DAEMON_PORT
+
+start_daemon() {
+	if test -n "$DAEMON_PID"
+	then
+		error "start_daemon already called"
+	fi
+
+	mkdir -p "$DAEMON_DOCUMENT_ROOT_PATH"
+
+	trap 'code=$?; stop_daemon; (exit $code); die' EXIT
+
+	say >&3 "Starting git daemon ..."
+	git daemon --listen=127.0.0.1 --port="$LIB_DAEMON_PORT" \
+		--reuseaddr --verbose \
+		--base-path="$DAEMON_DOCUMENT_ROOT_PATH" \
+		"$@" "$DAEMON_DOCUMENT_ROOT_PATH" \
+		>&3 2>&4 &
+	DAEMON_PID=$!
+}
+
+stop_daemon() {
+	if test -z "$DAEMON_PID"
+	then
+		return
+	fi
+
+	trap 'die' EXIT
+
+	# kill git-daemon child of git
+	say >&3 "Stopping git daemon ..."
+	pkill -P "$DAEMON_PID"
+	wait "$DAEMON_PID"
+	ret=$?
+	if test $ret -ne 143
+	then
+		error "git daemon exited with status: $ret"
+	fi
+	DAEMON_PID=
+}
diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
new file mode 100755
index 0000000..a7d666c
--- /dev/null
+++ b/t/t5570-git-daemon.sh
@@ -0,0 +1,149 @@
+#!/bin/sh
+
+test_description='test fetching over git protocol'
+. ./test-lib.sh
+
+LIB_DAEMON_PORT=${LIB_DAEMON_PORT-5570}
+. "$TEST_DIRECTORY"/lib-daemon.sh
+start_daemon
+
+test_expect_success 'setup repository' '
+	echo content >file &&
+	git add file &&
+	git commit -m one
+'
+
+test_expect_success 'create git-accessible bare repository' '
+	mkdir "$DAEMON_DOCUMENT_ROOT_PATH/repo.git" &&
+	(cd "$DAEMON_DOCUMENT_ROOT_PATH/repo.git" &&
+	 git --bare init &&
+	 : >git-daemon-export-ok
+	) &&
+	git remote add public "$DAEMON_DOCUMENT_ROOT_PATH/repo.git" &&
+	git push public master:master
+'
+
+test_expect_success 'clone git repository' '
+	git clone $DAEMON_URL/repo.git clone &&
+	test_cmp file clone/file
+'
+
+test_expect_success 'fetch changes via git protocol' '
+	echo content >>file &&
+	git commit -a -m two &&
+	git push public &&
+	(cd clone && git pull) &&
+	test_cmp file clone/file
+'
+
+test_expect_failure 'remote detects correct HEAD' '
+	git push public master:other &&
+	(cd clone &&
+	 git remote set-head -d origin &&
+	 git remote set-head -a origin &&
+	 git symbolic-ref refs/remotes/origin/HEAD > output &&
+	 echo refs/remotes/origin/master > expect &&
+	 test_cmp expect output
+	)
+'
+
+test_expect_success 'prepare pack objects' '
+	cp -R "$DAEMON_DOCUMENT_ROOT_PATH"/repo.git "$DAEMON_DOCUMENT_ROOT_PATH"/repo_pack.git &&
+	(cd "$DAEMON_DOCUMENT_ROOT_PATH"/repo_pack.git &&
+	 git --bare repack &&
+	 git --bare prune-packed
+	)
+'
+
+test_expect_success 'fetch notices corrupt pack' '
+	cp -R "$DAEMON_DOCUMENT_ROOT_PATH"/repo_pack.git "$DAEMON_DOCUMENT_ROOT_PATH"/repo_bad1.git &&
+	(cd "$DAEMON_DOCUMENT_ROOT_PATH"/repo_bad1.git &&
+	 p=`ls objects/pack/pack-*.pack` &&
+	 chmod u+w $p &&
+	 printf %0256d 0 | dd of=$p bs=256 count=1 seek=1 conv=notrunc
+	) &&
+	mkdir repo_bad1.git &&
+	(cd repo_bad1.git &&
+	 git --bare init &&
+	 test_must_fail git --bare fetch $DAEMON_URL/repo_bad1.git &&
+	 test 0 = `ls objects/pack/pack-*.pack | wc -l`
+	)
+'
+
+test_expect_success 'fetch notices corrupt idx' '
+	cp -R "$DAEMON_DOCUMENT_ROOT_PATH"/repo_pack.git "$DAEMON_DOCUMENT_ROOT_PATH"/repo_bad2.git &&
+	(cd "$DAEMON_DOCUMENT_ROOT_PATH"/repo_bad2.git &&
+	 p=`ls objects/pack/pack-*.idx` &&
+	 chmod u+w $p &&
+	 printf %0256d 0 | dd of=$p bs=256 count=1 seek=1 conv=notrunc
+	) &&
+	mkdir repo_bad2.git &&
+	(cd repo_bad2.git &&
+	 git --bare init &&
+	 test_must_fail git --bare fetch $DAEMON_URL/repo_bad2.git &&
+	 test 0 = `ls objects/pack | wc -l`
+	)
+'
+
+test_remote_error()
+{
+	do_export=YesPlease
+	while test $# -gt 0
+	do
+		case $1 in
+		-x)
+			shift
+			chmod -X "$DAEMON_DOCUMENT_ROOT_PATH/repo.git"
+			;;
+		-n)
+			shift
+			do_export=
+			;;
+		*)
+			break
+		esac
+	done
+
+	if test $# -ne 3
+	then
+		error "invalid number of arguments"
+	fi
+
+	cmd=$1
+	repo=$2
+	msg=$3
+
+	if test -x "$DAEMON_DOCUMENT_ROOT_PATH/$repo"
+	then
+		if test -n "$do_export"
+		then
+			: >"$DAEMON_DOCUMENT_ROOT_PATH/$repo/git-daemon-export-ok"
+		else
+			rm -f "$DAEMON_DOCUMENT_ROOT_PATH/$repo/git-daemon-export-ok"
+		fi
+	fi
+
+	test_must_fail git "$cmd" "$DAEMON_URL/$repo" 2>output &&
+	echo "fatal: remote error: $msg: /$repo" >expect &&
+	test_cmp expect output
+	ret=$?
+	chmod +X "$DAEMON_DOCUMENT_ROOT_PATH/repo.git"
+	(exit $ret)
+}
+
+msg="access denied or repository not exported"
+test_expect_success 'clone non-existent' "test_remote_error    clone nowhere.git '$msg'"
+test_expect_success 'push disabled'      "test_remote_error    push  repo.git    '$msg'"
+test_expect_success 'read access denied' "test_remote_error -x fetch repo.git    '$msg'"
+test_expect_success 'not exported'       "test_remote_error -n fetch repo.git    '$msg'"
+
+stop_daemon
+start_daemon --informative-errors
+
+test_expect_success 'clone non-existent' "test_remote_error    clone nowhere.git 'no such repository'"
+test_expect_success 'push disabled'      "test_remote_error    push  repo.git    'service not enabled'"
+test_expect_success 'read access denied' "test_remote_error -x fetch repo.git    'no such repository'"
+test_expect_success 'not exported'       "test_remote_error -n fetch repo.git    'repository not exported'"
+
+stop_daemon
+test_done
-- 
1.7.8

^ permalink raw reply related

* Re: [BUG] gitweb generates wrong links in grep search results (git_search_files)
From: Jakub Narębski @ 2012-01-04 16:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Perl, git
In-Reply-To: <7vhb0cqpix.fsf@alter.siamese.dyndns.org>

On Wed, Jan 4, 2012 at 1:28 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Thomas Perl <th.perl@gmail.com> writes:
>
>> I think I found a bug in gitweb when grep'ing for text in a branch
>> different from "master". Here's how to reproduce it:
>
> Thanks for a detailed report (and thanks for gpodder ;-).
>
> Jakub, care to take a look?

I see the bug: it should be 'hash_base' not 'hash' in href()
creating link to "blob" view in git_search_files().

I'll try to send a fix soon...
-- 
Jakub Narebski

^ permalink raw reply

* Re: Auto-refresh git-gui
From: Clemens Buchacher @ 2012-01-04 16:33 UTC (permalink / raw)
  To: Victor Engmark; +Cc: git
In-Reply-To: <20120104091547.GC3484@victor>

Hi Victor,

On Wed, Jan 04, 2012 at 10:15:47AM +0100, Victor Engmark wrote:
>
> Is there some way to make `git-gui` rescan automatically when anything
> in the repository changes?

How about doing it each time git gui gets focus? Or if that's to
much do it only if it gets focus _and_ the index has changed?

Clemens

^ permalink raw reply


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