* 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
* Re: [PATCH] Catch invalid --depth option passed to clone or fetch
From: Junio C Hamano @ 2012-01-04 17:43 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1325671315-24931-1-git-send-email-pclouds@gmail.com>
Thanks.
^ permalink raw reply
* Re: [PATCH] gitweb: accept trailing "/" in $project_list
From: Junio C Hamano @ 2012-01-04 17:51 UTC (permalink / raw)
To: Matthieu Moy; +Cc: git
In-Reply-To: <1325671665-16847-1-git-send-email-Matthieu.Moy@imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
> 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.
Yeah, probably not many people use $project_maxdepth with a meaningful
value.
^ permalink raw reply
* Re: [PATCH 1/2] daemon: add tests
From: Junio C Hamano @ 2012-01-04 18:00 UTC (permalink / raw)
To: Clemens Buchacher
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>
Clemens Buchacher <drizzd@aon.at> writes:
> 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"?
The former. "daemon" is too general and letting "git daemon" squat on that
name makes it harder for other people to build daemons for new git
services and write tests for them.
> Either way, I have no preference here. Feel free to change any way you
> like.
No thanks.
>> >> + # 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.
Yuck, that patch looks even uglier X-<.
Do you really need to kill the children but not the daemon?
^ permalink raw reply
* Re: [PATCH 1/6] t5550: repack everything into one file
From: Junio C Hamano @ 2012-01-04 18:05 UTC (permalink / raw)
To: Clemens Buchacher; +Cc: git
In-Reply-To: <1325692539-26748-2-git-send-email-drizzd@aon.at>
Thanks; I assume this is also signed off?
^ 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: Junio C Hamano @ 2012-01-04 18:58 UTC (permalink / raw)
To: Sven Strickroth; +Cc: git, Jeff King, Jakub Narebski
In-Reply-To: <4F0405D4.9090102@tu-clausthal.de>
Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
> 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.
Depending on how widespread such implementations of Perl are, a patch to
fix other uses of chomps might deserve to be on the maintenance track
independent from this patch series. I seem to find many hits to:
$ git grep -e 'chomp *([^)@]*='
already in our codebase.
^ 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: Junio C Hamano @ 2012-01-04 19:08 UTC (permalink / raw)
To: Sven Strickroth; +Cc: git, Jeff King, Jakub Narebski
In-Reply-To: <4F040E46.5030001@tu-clausthal.de>
Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
> 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.
It might be an accurate description of what Subversion does ("tries to" is
the key phrase). I however do not know if it is equivalent to what your
patch does.
When GIT_ASKPASS is not set, the $prompt is given to the standard error
stream unconditionally and then the "require Term::ReadKey" codepath is
used. When the terminal is unavailable, you might get undef in $ret and be
able to fall back on SSH_ASKPASS part, but you cannot take back the noise
you have given to the standard error stream.
Is there a way to ask Term::ReadKey (or possibly some other module) if we
will be able to interact with the terminal _before_ we give that prompt?
The simplest would be to do this, I would think, but I didn't test it.
if (!defined $ret && -t) {
print STDERR $prompt;
if ($isPassword) {
...
}
if (!defined $ret) {
$ret = _prompt($ENV{'SSH_ASKPASS'}, $prompt);
}
^ 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 19:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King, Jakub Narebski
In-Reply-To: <7vmxa3pa6e.fsf@alter.siamese.dyndns.org>
Am 04.01.2012 19:58 schrieb Junio C Hamano:
> Depending on how widespread such implementations of Perl are, a patch to
> fix other uses of chomps might deserve to be on the maintenance track
> independent from this patch series. I seem to find many hits to:
>
> $ git grep -e 'chomp *([^)@]*='
>
> already in our codebase.
I'm not sure if this is a general chomp problem. I think that this is
more related to a variable which is accessed after a readfailure on STDIN.
Reported to msys team.
--
Best regards,
Sven Strickroth
ClamAV, a GPL anti-virus toolkit http://www.clamav.net
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox