Git development
 help / color / mirror / Atom feed
* Re: [PATCH v3] git-completion.bash: add support for path completion
From: Manlio Perillo @ 2012-12-19 23:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, SZEDER Gábor, Felipe Contreras
In-Reply-To: <7vzk1995mx.fsf@alter.siamese.dyndns.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 19/12/2012 20:57, Junio C Hamano ha scritto:
> [...]

I just found a serious bug with "git commit" path completion.

When doing the first commit on an empty repository, completion will
cause an error:

$git commit -m init <TAB>fatal: ambiguous argument 'HEAD': unknown
revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

The problem is that for a newly created repository there is no HEAD.

If HEAD does not exists, code must use ls-files instead of diff-index
to get the completion list.

Another change is to always call git commands with stderr redirected to
/dev/null.


By the way, this is also a bug of current bash completion code:

    $ git show does-not-exists:<TAB>fatal: Not a valid object name
      does-not-exists

I will write a patch (based on master) to fix this.

> [...]


Regards  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDSUR0ACgkQscQJ24LbaUSkRwCfVKk9JhSD4sKDFm4heAkVbN0o
KAAAn3paTXyUiFlfY/UBpnkwiARegLsE
=7Q5s
-----END PGP SIGNATURE-----

^ permalink raw reply

* Re: [PATCH] git-completion.bash: add support for path completion
From: Manlio Perillo @ 2012-12-19 23:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vy5gt7j3c.fsf@alter.siamese.dyndns.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 19/12/2012 23:49, Junio C Hamano ha scritto:
> Manlio Perillo <manlio.perillo@gmail.com> writes:
> 
>>> 	git mv COPYING README X
>>
>> Assuming X is a new untracked directory, do you think it is an usability
>> problem if an user try to do:
>>
>> 	git mv COPYING README <TAB>
>>
>> and X does not appear in the completion list?
> 
> It is hard to say.  Will it show "Documentation/" in the list?  Will
> it show "git.c" in the list?
> 

Currently all cached files will be showed.

> Your "git mv git.<TAB>" completing to "git mv git.c" would be an
> improvement compared to the stock "less git.<TAB>" that offers
> "git.c" and "git.o" as choices.  For things like "mv" and "rm", this
> may not make too much of a difference, "git add <TAB>" would be a
> vast improvement from the stock one.  The users will notice that the
> completion knows what it is doing, and will come to depend on it.
> 

Yes, this is precisely the reason why I'm implementing it ;-).

I also use Mercurial (I discovered Git just a few weeks ago, after
reading Pro Git), and Mercurial do have path completion (completion list
does not stop at directory boundary, however).

When I started to use Git, one of the first thing I noticed was the lack
of path completion for git add.

> [...]
> In the ideal world (read: I am *not* saying "you should implement it
> this way, or we won't look at your patch"), I think you would want
> to show tracked files (because it may be the third path that the
> user wants to move with the command, not the destination directory)
> and any directory on the filesystem (it could be the third path that
> is being moved if it has tracked files, or it could be the final
> destination directory argument).

What about this?

* show all and only cached files for the first argument
* show all cached + untracked directories and files for all other
  arguments

This should solve most of the problem, and will still not show ignored
files.  And, most important, it is very easy to implement.


The only issue is that "git ls-files -o" does not show empty
directories, and "git ls-files --directory -o" will add a trailing slash.



Thanks   Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDSUr4ACgkQscQJ24LbaURf0gCeJVZviwfKHgHNZ8vYBjnjwP8+
WF4AnAn3/KPJciJg9r387qIzCajx4j0s
=/10k
-----END PGP SIGNATURE-----

^ permalink raw reply

* Re: [RFC] test: Old shells and physical paths
From: Junio C Hamano @ 2012-12-20  0:17 UTC (permalink / raw)
  To: David Michael; +Cc: git@vger.kernel.org
In-Reply-To: <CAEvUa7=sOPF9xwfGuBXv0CBZhT+79+8z3tm9ar_cz3q--kfqRQ@mail.gmail.com>

David Michael <fedora.dm0@gmail.com> writes:

> In working on a port, I have to tolerate an ancient shell.  The "cd"
> and "pwd" commands don't understand the "-P" flag for physical paths,
> as some tests use.  The biggest offender is "cd -P" causing a failure
> in t/test-lib.sh (since 1bd9c64), which is sourced by every test
> script.

Is "here is a nickel, get a better shell" an option?  Running tests
is one thing, but I'd be worried more about scripted Porcelains
broken by a non-POSIX shell if I were you.

> Would it be acceptable to instead force the platform's shell option
> (if it exists) to always use physical paths for the tests and drop the
> "-P" flags?

As a patch to the source files in my tree?  Not likely, even though
I cannot say for sure without looking at how the change would look
like.

^ permalink raw reply

* Re: [PATCH] add core.pathspecGlob config option
From: Nguyen Thai Ngoc Duy @ 2012-12-20  1:28 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <20121219203449.GA10001@sigill.intra.peff.net>

On Thu, Dec 20, 2012 at 3:34 AM, Jeff King <peff@peff.net> wrote:
> Part of me thinks this is just gross, because ":(noglob)" is the right
> solution. But after spending a few hours trying it this morning, there
> is a ton of refactoring required to make it work correctly everywhere
> (although we could die() if we see it in places that are not using
> init_pathspec, so at least we could say "not supported yet" and not just
> silently ignore it).

Yep, I'm still half way to converting everything to the new pathspec
code. I'm not there yet. And things like this probably better goes
with a config key or command line option, appending :(noglob) to every
pathspec item is not pleasant. :(icase) may go the same way.

> So I think this is a nice, simple approach for sites that want it, and
> noglob magic can come later (and will not be any harder to implement as
> a result of this patch).

Any chance to make use of nd/pathspec-wildcard? It changes the same
code path in match_one. If you base on top of nd/pathspec-wildcard,
all you have to do is assign nowildcard_len to len (i.e. no wildcard
part).
-- 
Duy

^ permalink raw reply

* Re: [PATCH 2/3] wildmatch: support "no FNM_PATHNAME" mode
From: Nguyen Thai Ngoc Duy @ 2012-12-20  1:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vlicu9cpk.fsf@alter.siamese.dyndns.org>

On Thu, Dec 20, 2012 at 12:24 AM, Junio C Hamano <gitster@pobox.com> wrote:
> When that happens, we should want to retain the same "do not bother
> to descend into subdirectories that will never match" optimization
> for a pattern like "Doc*tion/**/*.txt".  Because of FNM_PATHNAME, we
> can tell if a subdirectory is worth descending into by looking at
> the not-so-simple prefix "Doc*tion/"; "Documentation" will match,
> "Doc" will not (because '*' won't match '/').
>
> Which tells me that integrating this _well_ into the rest of the
> system is not just a matter of replacing fnmatch() with wildmatch().

Yeah, we open a door for more opportunities and a lot more headache.

> I also expect that wildmatch() would be much slower than fnmatch()
> especially when doing its "**" magic, but I personally do not think
> it will be a showstopper.

A potential showstopper is the lack of multibyte support. I don't know
if people want that though.

> If the user asks for a more powerful but
> expensive operation, we are saving time for the user by doing a more
> powerful thing (reducing the need to postprocess the results) and
> can afford to spend extra cycles.

In some case we may be able to spend fewer cycles by preprocessing
patterns first.

> As long as simpler patterns fnmatch() groks (namely, '?', '*', and
> '[class]' wildcards only) are not slowed down by replacing it with
> wildmatch(), that is, of course.

I'm concerned about performance vs fnmatch too. I'll probably write a
small program to exercise both and measure it with glibc.
-- 
Duy

^ permalink raw reply

* Re: [RFC] test: Old shells and physical paths
From: David Michael @ 2012-12-20  2:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git@vger.kernel.org
In-Reply-To: <7vmwx97f0o.fsf@alter.siamese.dyndns.org>

Hi,

On Thu, Dec 20, 2012 at 12:17 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Is "here is a nickel, get a better shell" an option?

It is, somewhat.  There is a pre-built port of GNU bash 2.03 for the
platform, but I was trying to see how far things could go with the
OS's supported shell before having to bring in unsupported
dependencies.  Unfortunately, I do not believe the OS fully conforms
to POSIX.1-2001 yet, so that means no "-P" or "-L" without going
rogue.

I'll carry test fixes for this platform locally.

Thanks.

David

^ permalink raw reply

* Re: sys/param.h
From: Mark Levedahl @ 2012-12-20  2:49 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, git
In-Reply-To: <CABPQNSZQk6hHm-dWqFFQf0HF34Mvbjc8-mgzCr=G0zbBKiYUvA@mail.gmail.com>

On 12/19/2012 02:59 AM, Erik Faye-Lund wrote:
> On Tue, Dec 18, 2012 at 6:01 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Johannes Sixt <j.sixt@viscovery.net> writes:
>>
>>>> Junio C Hamano wrote:
>>>>> It could turn out that we may be able to get rid of sys/param.h
>>>>> altogether, but one step at a time.  Inputs from people on minority
>>>>> platforms are very much appreciated---does your platform build fine
>>>>> when the inclusion of the file is removed from git-compat-util.h?

cygwin is fine with that removed.

Mark

^ permalink raw reply

* Re: sys/param.h
From: Junio C Hamano @ 2012-12-20  3:03 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: git
In-Reply-To: <50D27CC6.3000203@gmail.com>

Thanks.

^ permalink raw reply

* Re: [PATCH] add core.pathspecGlob config option
From: Jeff King @ 2012-12-20  3:13 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git
In-Reply-To: <CACsJy8BB3=3ZHD5Ua9M-0+98JVigHBBuo07gBSgEwanvB0zBSA@mail.gmail.com>

On Thu, Dec 20, 2012 at 08:28:57AM +0700, Nguyen Thai Ngoc Duy wrote:

> > So I think this is a nice, simple approach for sites that want it, and
> > noglob magic can come later (and will not be any harder to implement as
> > a result of this patch).
> 
> Any chance to make use of nd/pathspec-wildcard? It changes the same
> code path in match_one. If you base on top of nd/pathspec-wildcard,
> all you have to do is assign nowildcard_len to len (i.e. no wildcard
> part).

I'd rather keep it separate for now. One, just because they really are
independent topics, and two, because I am actually back-porting it for
GitHub (we are fairly conservative about upgrading our backend git
versions, as most of the interesting stuff happens on the client side; I
cherry-pick critical patches with no regard to the release cycle).

And the resolution is pretty trivial, too. It looks like this:

diff --cc dir.c
index 5c0e5f6,03ff36b..81cb439
--- a/dir.c
+++ b/dir.c
@@@ -1456,14 -1433,10 +1460,18 @@@ int init_pathspec(struct pathspec *path
  
  		item->match = path;
  		item->len = strlen(path);
- 		item->nowildcard_len = simple_length(path);
 -		item->use_wildcard = !limit_pathspec_to_literal() &&
 -				     !no_wildcard(path);
 -		if (item->use_wildcard)
 -			pathspec->has_wildcard = 1;
 +		item->flags = 0;
- 		if (item->nowildcard_len < item->len) {
- 			pathspec->has_wildcard = 1;
- 			if (path[item->nowildcard_len] == '*' &&
- 			    no_wildcard(path + item->nowildcard_len + 1))
- 				item->flags |= PATHSPEC_ONESTAR;
++		if (limit_pathspec_to_literal())
++			item->nowildcard_len = item->len;
++		else {
++			item->nowildcard_len = simple_length(path);
++			if (item->nowildcard_len < item->len) {
++				pathspec->has_wildcard = 1;
++				if (path[item->nowildcard_len] == '*' &&
++				    no_wildcard(path + item->nowildcard_len + 1))
++					item->flags |= PATHSPEC_ONESTAR;
++			}
 +		}
  	}
  
  	qsort(pathspec->items, pathspec->nr,

Not re-indenting the conditional would make the diff more readable, but
I think the resulting code is simpler to read if all of the wildcard
stuff is inside the "else" block.

-Peff

^ permalink raw reply

* Re: [PATCH] add core.pathspecGlob config option
From: Junio C Hamano @ 2012-12-20  3:51 UTC (permalink / raw)
  To: Jeff King; +Cc: Nguyen Thai Ngoc Duy, git
In-Reply-To: <20121220031327.GB9917@sigill.intra.peff.net>

Jeff King <peff@peff.net> writes:

> On Thu, Dec 20, 2012 at 08:28:57AM +0700, Nguyen Thai Ngoc Duy wrote:
>
>> > So I think this is a nice, simple approach for sites that want it, and
>> > noglob magic can come later (and will not be any harder to implement as
>> > a result of this patch).
>> 
>> Any chance to make use of nd/pathspec-wildcard? It changes the same
>> code path in match_one. If you base on top of nd/pathspec-wildcard,
>> all you have to do is assign nowildcard_len to len (i.e. no wildcard
>> part).
>
> I'd rather keep it separate for now. One, just because they really are
> independent topics, and two, because I am actually back-porting it for
> GitHub (we are fairly conservative about upgrading our backend git
> versions, as most of the interesting stuff happens on the client side; I
> cherry-pick critical patches with no regard to the release cycle).
>
> And the resolution is pretty trivial, too. It looks like this:
>
> diff --cc dir.c
> index 5c0e5f6,03ff36b..81cb439
> --- a/dir.c
> +++ b/dir.c
> @@@ -1456,14 -1433,10 +1460,18 @@@ int init_pathspec(struct pathspec *path
>   
>   		item->match = path;
>   		item->len = strlen(path);
> - 		item->nowildcard_len = simple_length(path);
>  -		item->use_wildcard = !limit_pathspec_to_literal() &&
>  -				     !no_wildcard(path);
>  -		if (item->use_wildcard)
>  -			pathspec->has_wildcard = 1;
>  +		item->flags = 0;
> - 		if (item->nowildcard_len < item->len) {
> - 			pathspec->has_wildcard = 1;
> - 			if (path[item->nowildcard_len] == '*' &&
> - 			    no_wildcard(path + item->nowildcard_len + 1))
> - 				item->flags |= PATHSPEC_ONESTAR;
> ++		if (limit_pathspec_to_literal())
> ++			item->nowildcard_len = item->len;
> ++		else {
> ++			item->nowildcard_len = simple_length(path);
> ++			if (item->nowildcard_len < item->len) {
> ++				pathspec->has_wildcard = 1;
> ++				if (path[item->nowildcard_len] == '*' &&
> ++				    no_wildcard(path + item->nowildcard_len + 1))
> ++					item->flags |= PATHSPEC_ONESTAR;
> ++			}
>  +		}
>   	}
>   
>   	qsort(pathspec->items, pathspec->nr,

Hmph.  I thought that returning the length without any "stop at glob
special" trick from simple_length() would be a simpler resolution.

That is what is queued at the tip of 'pu', anyway.

^ permalink raw reply

* Re: [PATCH] add core.pathspecGlob config option
From: Jeff King @ 2012-12-20  3:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Nguyen Thai Ngoc Duy, git
In-Reply-To: <7vehil7557.fsf@alter.siamese.dyndns.org>

On Wed, Dec 19, 2012 at 07:51:16PM -0800, Junio C Hamano wrote:

> > ++		if (limit_pathspec_to_literal())
> > ++			item->nowildcard_len = item->len;
> > ++		else {
> > ++			item->nowildcard_len = simple_length(path);
> > ++			if (item->nowildcard_len < item->len) {
> > ++				pathspec->has_wildcard = 1;
> > ++				if (path[item->nowildcard_len] == '*' &&
> > ++				    no_wildcard(path + item->nowildcard_len + 1))
> > ++					item->flags |= PATHSPEC_ONESTAR;
> > ++			}
> >  +		}
> 
> Hmph.  I thought that returning the length without any "stop at glob
> special" trick from simple_length() would be a simpler resolution.
> 
> That is what is queued at the tip of 'pu', anyway.

I don't think we can make a change in simple_length. It gets used not
only for pathspecs, but also for parsing exclude patterns, which I do
not think should be affected by this option.

-Peff

^ permalink raw reply

* Re: [PATCH] add core.pathspecGlob config option
From: Jeff King @ 2012-12-20  4:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Nguyen Thai Ngoc Duy, git
In-Reply-To: <20121220035543.GA14965@sigill.intra.peff.net>

On Wed, Dec 19, 2012 at 10:55:43PM -0500, Jeff King wrote:

> On Wed, Dec 19, 2012 at 07:51:16PM -0800, Junio C Hamano wrote:
> 
> > > ++		if (limit_pathspec_to_literal())
> > > ++			item->nowildcard_len = item->len;
> > > ++		else {
> > > ++			item->nowildcard_len = simple_length(path);
> > > ++			if (item->nowildcard_len < item->len) {
> > > ++				pathspec->has_wildcard = 1;
> > > ++				if (path[item->nowildcard_len] == '*' &&
> > > ++				    no_wildcard(path + item->nowildcard_len + 1))
> > > ++					item->flags |= PATHSPEC_ONESTAR;
> > > ++			}
> > >  +		}
> > 
> > Hmph.  I thought that returning the length without any "stop at glob
> > special" trick from simple_length() would be a simpler resolution.
> > 
> > That is what is queued at the tip of 'pu', anyway.
> 
> I don't think we can make a change in simple_length. It gets used not
> only for pathspecs, but also for parsing exclude patterns, which I do
> not think should be affected by this option.

Our test suite wouldn't catch such a misfeature, of course, because the
feature is not turned on by default. But I found it instructive to run
all of the tests with GIT_LITERAL_PATHSPECS on. There are failures, of
course, but by inspecting each failure you can see that it is an
intended effect of the patch (i.e., each tries to use a wildcard
pathspec, which no longer works).

When you suggested changing common_prefix, I ran such a test both with
and without the change[1] and confirmed that it did not change the set
of failure sites. I did not try it, but I suspect running such a test
with the tip of pu would reveal new failures in the .gitignore tests.

-Peff

[1] This is in addition to reading and reasoning about the code, of
    course. I would not consider this a very robust form of testing,
    though a test failure which cannot be easily explained would be a
    good starting point for investigation.

^ permalink raw reply

* Re: [PATCH] add core.pathspecGlob config option
From: Jeff King @ 2012-12-20  4:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Nguyen Thai Ngoc Duy, git
In-Reply-To: <20121220040602.GA15172@sigill.intra.peff.net>

On Wed, Dec 19, 2012 at 11:06:02PM -0500, Jeff King wrote:

> > I don't think we can make a change in simple_length. It gets used not
> > only for pathspecs, but also for parsing exclude patterns, which I do
> > not think should be affected by this option.
> 
> Our test suite wouldn't catch such a misfeature, of course, because the
> feature is not turned on by default. But I found it instructive to run
> all of the tests with GIT_LITERAL_PATHSPECS on. There are failures, of
> course, but by inspecting each failure you can see that it is an
> intended effect of the patch (i.e., each tries to use a wildcard
> pathspec, which no longer works).
> 
> When you suggested changing common_prefix, I ran such a test both with
> and without the change[1] and confirmed that it did not change the set
> of failure sites. I did not try it, but I suspect running such a test
> with the tip of pu would reveal new failures in the .gitignore tests.

I just tried it, and indeed, running the test suite with this patch:

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 256f1c6..1c43593 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -102,6 +102,9 @@ export EDITOR
 export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
 export EDITOR
 
+GIT_LITERAL_PATHSPECS=1
+export GIT_LITERAL_PATHSPECS
+
 # Add libc MALLOC and MALLOC_PERTURB test
 # only if we are not executing the test with valgrind
 if expr " $GIT_TEST_OPTS " : ".* --valgrind " >/dev/null ||


produces many more failures on "pu" than it does on jk/pathspec-literal.

-Peff

^ permalink raw reply related

* Re: [PATCH] mergetools/p4merge: Handle "/dev/null"
From: David Aguilar @ 2012-12-20  4:41 UTC (permalink / raw)
  To: Jeremy Morton; +Cc: Junio C Hamano, git
In-Reply-To: <508B9F89.7050909@game-point.net>

On Sat, Oct 27, 2012 at 1:47 AM, Jeremy Morton <admin@game-point.net> wrote:
> Sorry to be replying to this so late; I hadn't noticed the post until now!
>
> I've tried putting that code in my p4merge script and yes it does indeed
> work fine.  However, it puts a temporary file in the working directory which
> I'm not sure is a good idea?  If we look at this patch which actually solved
> pretty much the same problem, but when merging and, during a merge conflict,
> a file was created in both branches:
> https://github.com/git/git/commit/ec245ba
>
> ... it is creating a temp file in a proper temp dir, rather than in the
> working dir.  I think that would be the proper solution here.  However, I
> really want to get this fixed so I'd be happy for this band-aid fix of the
> p4merge script to be checked in until we could get a patch more like the
> aforementioned one, at a later date, to create empty files in a proper temp
> dir and pass them as $LOCAL and $REMOTE.  :-)

I had the same thoughts when I wrote it, but I figured that following
the existing pattern used by mergetool for $REMOTE and $LOCAL when
they do exist was simpler as the first step.

I have a patch that fixes this by using mktemp that I will send shortly.
It only does it for the /dev/null file since the existing behavior for
files that do exist is fine.
-- 
David

^ permalink raw reply

* [PATCH] mergetools/p4merge: Honor $TMPDIR for the /dev/null placeholder
From: David Aguilar @ 2012-12-20  4:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Use mktemp to create the /dev/null placeholder for p4merge.
This keeps it out of the current directory.

Reported-by: Jeremy Morton <admin@game-point.net>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
I consider this a final finishing touch on a new 1.8.1 feature,
so hopefully we can get this in before 1.8.1.

 mergetools/p4merge | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mergetools/p4merge b/mergetools/p4merge
index 295361a..090fa9b 100644
--- a/mergetools/p4merge
+++ b/mergetools/p4merge
@@ -4,13 +4,13 @@ diff_cmd () {
 	rm_remote=
 	if test "/dev/null" = "$LOCAL"
 	then
-		LOCAL="./p4merge-dev-null.LOCAL.$$"
+		LOCAL="$(create_empty_file)"
 		>"$LOCAL"
 		rm_local=true
 	fi
 	if test "/dev/null" = "$REMOTE"
 	then
-		REMOTE="./p4merge-dev-null.REMOTE.$$"
+		REMOTE="$(create_empty_file)"
 		>"$REMOTE"
 		rm_remote=true
 	fi
@@ -33,3 +33,7 @@ merge_cmd () {
 	"$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
 	check_unchanged
 }
+
+create_empty_file () {
+	mktemp -t git-difftool-p4merge-empty-file.XXXXXX
+}
-- 
1.8.1.rc2.6.g18499ba

^ permalink raw reply related

* Re: [RFC] test: Old shells and physical paths
From: David Aguilar @ 2012-12-20  5:01 UTC (permalink / raw)
  To: David Michael; +Cc: Junio C Hamano, git@vger.kernel.org
In-Reply-To: <CAEvUa7=_iyXxaaRs3WtxZOy5PNnncG-iMAUNkCMLJ19ZtReqaw@mail.gmail.com>

On Wed, Dec 19, 2012 at 6:28 PM, David Michael <fedora.dm0@gmail.com> wrote:
> Hi,
>
> On Thu, Dec 20, 2012 at 12:17 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Is "here is a nickel, get a better shell" an option?
>
> It is, somewhat.  There is a pre-built port of GNU bash 2.03 for the
> platform, but I was trying to see how far things could go with the
> OS's supported shell before having to bring in unsupported
> dependencies.  Unfortunately, I do not believe the OS fully conforms
> to POSIX.1-2001 yet, so that means no "-P" or "-L" without going
> rogue.
>
> I'll carry test fixes for this platform locally.

Do you know if the differences are relegated to "cd",
or do other common commands such as awk, grep, sed, mktemp, expr,
etc. have similar issues?

I wonder if it'd be helpful to have a low-numbered test that checks
the basics needed by the scripted Porcelains and test suite.
It would give us an easy way to answer these questions, and could
be a good way to document (in code) the capabilities we expect.
-- 
David

^ permalink raw reply

* Re: [PATCH] add core.pathspecGlob config option
From: Junio C Hamano @ 2012-12-20  5:26 UTC (permalink / raw)
  To: Jeff King; +Cc: Nguyen Thai Ngoc Duy, git
In-Reply-To: <20121220035543.GA14965@sigill.intra.peff.net>

Jeff King <peff@peff.net> writes:

> On Wed, Dec 19, 2012 at 07:51:16PM -0800, Junio C Hamano wrote:
>
>> > ++		if (limit_pathspec_to_literal())
>> > ++			item->nowildcard_len = item->len;
>> > ++		else {
>> > ++			item->nowildcard_len = simple_length(path);
>> > ++			if (item->nowildcard_len < item->len) {
>> > ++				pathspec->has_wildcard = 1;
>> > ++				if (path[item->nowildcard_len] == '*' &&
>> > ++				    no_wildcard(path + item->nowildcard_len + 1))
>> > ++					item->flags |= PATHSPEC_ONESTAR;
>> > ++			}
>> >  +		}
>> 
>> Hmph.  I thought that returning the length without any "stop at glob
>> special" trick from simple_length() would be a simpler resolution.
>> 
>> That is what is queued at the tip of 'pu', anyway.
>
> I don't think we can make a change in simple_length. It gets used not
> only for pathspecs, but also for parsing exclude patterns, which I do
> not think should be affected by this option.

Ouch, yeah, you're right.

^ permalink raw reply

* Re: [PATCH] mergetools/p4merge: Honor $TMPDIR for the /dev/null placeholder
From: Junio C Hamano @ 2012-12-20  6:28 UTC (permalink / raw)
  To: David Aguilar; +Cc: git
In-Reply-To: <1355978754-7041-1-git-send-email-davvid@gmail.com>

David Aguilar <davvid@gmail.com> writes:

> Use mktemp to create the /dev/null placeholder for p4merge.
> This keeps it out of the current directory.
>
> Reported-by: Jeremy Morton <admin@game-point.net>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> I consider this a final finishing touch on a new 1.8.1 feature,
> so hopefully we can get this in before 1.8.1.

Does everybody have mktemp(1), which is not even in POSIX.1?

I'm a bit hesitant to apply this to the upcoming release without
cooking it in 'next' for sufficiently long time to give it a chance
to be tried by wider audience.

>  mergetools/p4merge | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/mergetools/p4merge b/mergetools/p4merge
> index 295361a..090fa9b 100644
> --- a/mergetools/p4merge
> +++ b/mergetools/p4merge
> @@ -4,13 +4,13 @@ diff_cmd () {
>  	rm_remote=
>  	if test "/dev/null" = "$LOCAL"
>  	then
> -		LOCAL="./p4merge-dev-null.LOCAL.$$"
> +		LOCAL="$(create_empty_file)"
>  		>"$LOCAL"
>  		rm_local=true
>  	fi
>  	if test "/dev/null" = "$REMOTE"
>  	then
> -		REMOTE="./p4merge-dev-null.REMOTE.$$"
> +		REMOTE="$(create_empty_file)"
>  		>"$REMOTE"
>  		rm_remote=true
>  	fi
> @@ -33,3 +33,7 @@ merge_cmd () {
>  	"$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
>  	check_unchanged
>  }
> +
> +create_empty_file () {
> +	mktemp -t git-difftool-p4merge-empty-file.XXXXXX
> +}

^ permalink raw reply

* Re: [PATCH] mergetools/p4merge: Honor $TMPDIR for the /dev/null placeholder
From: Junio C Hamano @ 2012-12-20  7:07 UTC (permalink / raw)
  To: David Aguilar; +Cc: git
In-Reply-To: <7v623x6xvv.fsf@alter.siamese.dyndns.org>

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

> David Aguilar <davvid@gmail.com> writes:
>
>> Use mktemp to create the /dev/null placeholder for p4merge.
>> This keeps it out of the current directory.
>>
>> Reported-by: Jeremy Morton <admin@game-point.net>
>> Signed-off-by: David Aguilar <davvid@gmail.com>
>> ---
>> I consider this a final finishing touch on a new 1.8.1 feature,
>> so hopefully we can get this in before 1.8.1.
>
> Does everybody have mktemp(1), which is not even in POSIX.1?
>
> I'm a bit hesitant to apply this to the upcoming release without
> cooking it in 'next' for sufficiently long time to give it a chance
> to be tried by wider audience.

One approach may be to do something like this as a preparation step
(current callers of unpack-file may want to do their temporary work
in TMPDIR as well), and then use

	git unpack-file -t e69de29bb2d1d6434b8b29ae775ad8c2e48c5391

to create your empty temporary file.

 Documentation/git-unpack-file.txt | 10 +++++++---
 builtin/unpack-file.c             | 28 +++++++++++++++++++++-------
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/Documentation/git-unpack-file.txt b/Documentation/git-unpack-file.txt
index e9f148a..56af328 100644
--- a/Documentation/git-unpack-file.txt
+++ b/Documentation/git-unpack-file.txt
@@ -10,16 +10,20 @@ git-unpack-file - Creates a temporary file with a blob's contents
 SYNOPSIS
 --------
 [verse]
-'git unpack-file' <blob>
+'git unpack-file' [-t] <blob>
 
 DESCRIPTION
 -----------
 Creates a file holding the contents of the blob specified by sha1. It
-returns the name of the temporary file in the following format:
-	.merge_file_XXXXX
+returns the name of the temporary file (by default `.merge_file_XXXXX`).
+
 
 OPTIONS
 -------
+-t::
+	The temporary file is created in `$TMPDIR` directory,
+	instead of the current directory.
+
 <blob>::
 	Must be a blob id
 
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index 1920029..de1f845 100644
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
@@ -1,8 +1,9 @@
 #include "builtin.h"
 
-static char *create_temp_file(unsigned char *sha1)
+static char *create_temp_file(unsigned char *sha1, int in_tempdir)
 {
-	static char path[50];
+	static char path[1024];
+	static const char template[] = ".merge_file_XXXXXX";
 	void *buf;
 	enum object_type type;
 	unsigned long size;
@@ -12,8 +13,12 @@ static char *create_temp_file(unsigned char *sha1)
 	if (!buf || type != OBJ_BLOB)
 		die("unable to read blob object %s", sha1_to_hex(sha1));
 
-	strcpy(path, ".merge_file_XXXXXX");
-	fd = xmkstemp(path);
+	if (in_tempdir) {
+		fd = git_mkstemp(path, sizeof(path) - 1, template);
+	} else {
+		strcpy(path, template);
+		fd = xmkstemp(path);
+	}
 	if (write_in_full(fd, buf, size) != size)
 		die_errno("unable to write temp-file");
 	close(fd);
@@ -23,14 +28,23 @@ static char *create_temp_file(unsigned char *sha1)
 int cmd_unpack_file(int argc, const char **argv, const char *prefix)
 {
 	unsigned char sha1[20];
+	int in_tempdir = 0;
+
+	if (argc < 2 || 3 < argc || !strcmp(argv[1], "-h"))
+		usage("git unpack-file [-t] <sha1>");
+	if (argc == 3) {
+		if (strcmp(argv[1], "-t"))
+			usage("git unpack-file [-t] <sha1>");
+		in_tempdir = 1;
+		argc--;
+		argv++;
+	}
 
-	if (argc != 2 || !strcmp(argv[1], "-h"))
-		usage("git unpack-file <sha1>");
 	if (get_sha1(argv[1], sha1))
 		die("Not a valid object name %s", argv[1]);
 
 	git_config(git_default_config, NULL);
 
-	puts(create_temp_file(sha1));
+	puts(create_temp_file(sha1, in_tempdir));
 	return 0;
 }

^ permalink raw reply related

* Re: [PATCH] mergetools/p4merge: Honor $TMPDIR for the /dev/null placeholder
From: David Aguilar @ 2012-12-20  8:03 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v623x6xvv.fsf@alter.siamese.dyndns.org>

On Wed, Dec 19, 2012 at 10:28 PM, Junio C Hamano <gitster@pobox.com> wrote:
> David Aguilar <davvid@gmail.com> writes:
>
>> Use mktemp to create the /dev/null placeholder for p4merge.
>> This keeps it out of the current directory.
>>
>> Reported-by: Jeremy Morton <admin@game-point.net>
>> Signed-off-by: David Aguilar <davvid@gmail.com>
>> ---
>> I consider this a final finishing touch on a new 1.8.1 feature,
>> so hopefully we can get this in before 1.8.1.
>
> Does everybody have mktemp(1), which is not even in POSIX.1?
>
> I'm a bit hesitant to apply this to the upcoming release without
> cooking it in 'next' for sufficiently long time to give it a chance
> to be tried by wider audience.

True.  I only tried Linux and Mac OS X, so I would not be
surprised to find some exotic UNIX that does not have mktemp.

I meant to write "is this portable?" in the section after
the double-dash; saying that it's polish for a fix
is only true if it's portable.

The git-unpack thing looks interesting...
is the SHA-1 in your example the special SHA-1 for an
empty tree or blob?

The reason I ask is because in this code path we are
comparing an unknown blob, basically a blob that does
not exist in one of the trees, so I'm not sure if an
'unpack' command would help for this case because we
would not have a blob SHA-1 to unpack.


As far as portability goes, the "UNIX" list
for p4merge is here:

http://www.perforce.com/downloads/complete_list

I do not have AIX, Solaris, or FreeBSD to test,
so I agree that this can wait.

Does msysgit have mktemp?

p4merge is available on Windows too so I would
need to check there too unless someone happens
to know off the top of their heads.

My other thought was to write a simple shell
function that checks TMPDIR itself, and defaults
to creating some file under /tmp when it is undefined.
I can pursue this option if you think it's a safer choice.
-- 
David

^ permalink raw reply

* Re: [PATCH] mergetools/p4merge: Honor $TMPDIR for the /dev/null placeholder
From: Joachim Schmitz @ 2012-12-20  8:20 UTC (permalink / raw)
  To: git
In-Reply-To: <7v623x6xvv.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:
> David Aguilar <davvid@gmail.com> writes:
>
>> Use mktemp to create the /dev/null placeholder for p4merge.
>> This keeps it out of the current directory.
>>
>> Reported-by: Jeremy Morton <admin@game-point.net>
>> Signed-off-by: David Aguilar <davvid@gmail.com>
>> ---
>> I consider this a final finishing touch on a new 1.8.1 feature,
>> so hopefully we can get this in before 1.8.1.
>
> Does everybody have mktemp(1), which is not even in POSIX.1?

HP-NonStop doesn't have it, unless you're on the latest release, which added 
GNU coreutils.

Bye, Jojo 

^ permalink raw reply

* Re: [PATCH 3/3] Convert all fnmatch() calls to wildmatch()
From: Nguyen Thai Ngoc Duy @ 2012-12-20 12:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v8v8tanyn.fsf@alter.siamese.dyndns.org>

On Thu, Dec 20, 2012 at 1:36 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> @@ -627,7 +628,7 @@ enum interesting tree_entry_interesting(const struct name_entry *entry,
>>                               return entry_interesting;
>>
>>                       if (item->use_wildcard) {
>> -                             if (!fnmatch(match + baselen, entry->path, 0))
>> +                             if (!wildmatch(match + baselen, entry->path, 0))
>>                                       return entry_interesting;
>
> This and the change to dir.c obviously have interactions with
> 8c6abbc (pathspec: apply "*.c" optimization from exclude,
> 2012-11-24).
>
> I've already alluded to it in my response to 2/3, I guess.

Conflict of plans. I did not expect myself to work on replacing
fnmatch soon and git_fnmatch is an intermediate step to collect more
optimizations and gradually replace fnmatch. Eventually git_fnmatch()
would become a wrapper of wildmatch, all the optimizations are pushed
down there. If we replace fnmatch->wildmatch first then there's little
reason for the existence of git_fnmatch(). Maybe I should merge this
with the fnmatch elimination into a single series.
-- 
Duy

^ permalink raw reply

* Re: [PATCH 2/3] wildmatch: support "no FNM_PATHNAME" mode
From: Nguyen Thai Ngoc Duy @ 2012-12-20 13:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <CACsJy8C9Nhdq_xBAOxtmLcUnrUioAMvWCPk=sBZKOzFY2WR+iA@mail.gmail.com>

On Thu, Dec 20, 2012 at 8:55 AM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
>> As long as simpler patterns fnmatch() groks (namely, '?', '*', and
>> '[class]' wildcards only) are not slowed down by replacing it with
>> wildmatch(), that is, of course.
>
> I'm concerned about performance vs fnmatch too. I'll probably write a
> small program to exercise both and measure it with glibc.

I'll send out proper patches later this weekend, but unless I make big
mistakes it seems wildmatch is faster than fnmatch from glibc 2.14.1
on x86-64 :) Maybe I did make mistakes. The test matches every line in
/tmp/filelist.txt (which is ls-files from linux-2.6.git) 2000 times.
"pathname" means FNM_PATHNAME.

$ export LANG=C
$ ./test-wildmatch-perf /tmp/filelist.txt 'Documentation/*' 2000
wildmatch 1s 528394us
fnmatch   2s 588396us
$ ./test-wildmatch-perf /tmp/filelist.txt 'drivers/*' 2000
wildmatch 1s 957243us
fnmatch   3s 134839us
$ ./test-wildmatch-perf /tmp/filelist.txt 'Documentation/*' 2000 pathname
wildmatch 1s 548575us
fnmatch   2s 629680us
$ ./test-wildmatch-perf /tmp/filelist.txt 'drivers/*' 2000 pathname
wildmatch 2s 142377us
fnmatch   3s 318295us
$ ./test-wildmatch-perf /tmp/filelist.txt '[Dd]ocu[Mn]entation/*' 2000
wildmatch 1s 748505us
fnmatch   3s 224414us
$ ./test-wildmatch-perf /tmp/filelist.txt '[Dd]o?u[Mn]en?ati?n/*' 2000
wildmatch 1s 743268us
fnmatch   3s 278034us
$ ./test-wildmatch-perf /tmp/filelist.txt '[Dd]o?u[Mn]en?ati?n/*' 2000 pathname
wildmatch 1s 745151us
fnmatch   3s 314127us
$ ./test-wildmatch-perf /tmp/filelist.txt nonsense 2000 pathname
wildmatch 1s 310727us
fnmatch   2s 279123us
-- 
Duy

^ permalink raw reply

* Gitweb running as FCGI does not print its output in UTF-8
From: Sergio Talens-Oliag @ 2012-12-20 13:53 UTC (permalink / raw)
  To: git

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

Hello, I'm sending this message to explain a problem I've found with
gitweb.cgi when running it using a call like the following:

    export FCGI_SOCKET_PATH="/run/gitweb.socket"
    gitweb.cgi --fcgi --nproc 2

I've fixed the problem for my installation usign a wrapper script, as
explained below.

I'm not sending a patch because I'm no expert in Perl and I'm unsure that
the solution I've found is the right one, but in the hope that my description
of the problem and the provided solution will be useful for others.

Problem description:

   When using gitweb.cgi in FCGI mode the answers from the script are returned
   using the wrong encoding (UTF-8 characters are printed as LATIN-1).
   
   It seems that the problem appears because the FCGI streams are implemented
   using the older stream API, TIEHANDLE and applying PerlIO layers using
   binmode() has no effect to them.

Applied solution:

   A solution similar to the use of binmode for the output stream is to
   redefine the FCGI::Stream::PRINT function to use UTF-8 as output encoding.

   To do it with minimal chages I've created a gitweb.cgi wrapper that
   redefines the function and runs the original script; I'm doing it like this
   to be able to use the packaged script until upstream includes a fix for the
   problem.

Wrapper code (uses /usr/share/gitweb/gitweb.cgi as the PATH for gitweb.cgi):

  #!/usr/bin/perl
  # gitweb.cgi wrapper that fixes the UTF-8 problem with fastcgi

  # Local redefinition of FCGI::Stream::PRINT
  use Encode;
  use FCGI;

  our $enc = Encode::find_encoding('UTF-8');
  our $org = \&FCGI::Stream::PRINT;
  no warnings 'redefine';

  local *FCGI::Stream::PRINT = sub {
    my @OUTPUT = @_;
    for (my $i = 1; $i < @_; $i++) {
      $OUTPUT[$i] = $enc->encode($_[$i], Encode::FB_CROAK|Encode::LEAVE_SRC);
    }
    @_ = @OUTPUT;
    goto $org;
  };

  # Execute original script
  do "/usr/share/gitweb/gitweb.cgi";

References:

   The applied solution has been found on the following StackOverflow
   question:

     http://stackoverflow.com/questions/5005104

Environment:

  The system I'm using is Debian Wheezy and I'm serving gitweb using nginx's
  fastcgi interface.

  The versions of the related debian packages are:
  
	Package: git
	Version: 1:1.7.10.4-1+wheezy1
	Package: libcgi-fast-perl
	Version: 5.14.2-16
	Package: libfcgi-procmanager-perl
	Version: 0.24-1
	Package: perl
	Version: 5.14.2-16

  To launch gitweb as fastcgi I'm using an init.d script that runs the wrapper
  script in the background as the `www-user` using a call similar to the
  following:

    export FCGI_SOCKET_PATH="/run/gitweb/socket"
    gitweb.cgi-wrapper --fcgi --nproc 2

Greetings,

  Sergio.

-- 
Sergio Talens-Oliag <sto@iti.es>               <http://www.iti.es/>
Key fingerprint = FF77 A16B 9D09 FC7B 6656 CFAD 261D E19A 578A 36F2

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

^ permalink raw reply

* [PATCH] Python scripts audited for minimum compatible version and checks added.
From: Eric S. Raymond @ 2012-12-20 14:13 UTC (permalink / raw)
  To: git

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
---
 contrib/ciabot/ciabot.py           | 5 +++++
 contrib/fast-import/import-zips.py | 5 +++++
 contrib/hg-to-git/hg-to-git.py     | 5 +++++
 contrib/p4import/git-p4import.py   | 5 +++++
 contrib/svn-fe/svnrdump_sim.py     | 4 ++++
 git-p4.py                          | 5 +++++
 git-remote-testgit.py              | 5 +++++
 git_remote_helpers/git/__init__.py | 4 ++++
 8 files changed, 38 insertions(+)

diff --git a/contrib/ciabot/ciabot.py b/contrib/ciabot/ciabot.py
index bd24395..b55648f 100755
--- a/contrib/ciabot/ciabot.py
+++ b/contrib/ciabot/ciabot.py
@@ -50,6 +50,11 @@
 import os, sys, commands, socket, urllib
 from xml.sax.saxutils import escape
 
+if sys.hexversion < 0x02000000:
+	# The limiter is the xml.sax module
+        sys.stderr.write("import-zips.py: requires Python 2.0.0 or later.")
+        sys.exit(1)
+
 # Changeset URL prefix for your repo: when the commit ID is appended
 # to this, it should point at a CGI that will display the commit
 # through gitweb or something similar. The defaults will probably
diff --git a/contrib/fast-import/import-zips.py b/contrib/fast-import/import-zips.py
index 82f5ed3..d9ad71d 100755
--- a/contrib/fast-import/import-zips.py
+++ b/contrib/fast-import/import-zips.py
@@ -13,6 +13,11 @@ from sys import argv, exit
 from time import mktime
 from zipfile import ZipFile
 
+if sys.hexversion < 0x01060000:
+	# The limiter is the zipfile module
+        sys.stderr.write("import-zips.py: requires Python 1.6.0 or later.")
+        sys.exit(1)
+
 if len(argv) < 2:
 	print 'Usage:', argv[0], '<zipfile>...'
 	exit(1)
diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index 046cb2b..9f39ce5 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -23,6 +23,11 @@ import os, os.path, sys
 import tempfile, pickle, getopt
 import re
 
+if sys.hexversion < 0x02030000:
+   # The behavior of the pickle module changed significantly in 2.3
+   sys.stderr.write("hg-to-git.py: requires Python 2.3 or later.")
+   sys.exit(1)
+
 # Maps hg version -> git version
 hgvers = {}
 # List of children for each hg revision
diff --git a/contrib/p4import/git-p4import.py b/contrib/p4import/git-p4import.py
index b6e534b..fb48e2a 100644
--- a/contrib/p4import/git-p4import.py
+++ b/contrib/p4import/git-p4import.py
@@ -14,6 +14,11 @@ import sys
 import time
 import getopt
 
+if sys.hexversion < 0x02020000:
+   # The behavior of the marshal module changed significantly in 2.2
+   sys.stderr.write("git-p4import.py: requires Python 2.2 or later.")
+   sys.exit(1)
+
 from signal import signal, \
    SIGPIPE, SIGINT, SIG_DFL, \
    default_int_handler
diff --git a/contrib/svn-fe/svnrdump_sim.py b/contrib/svn-fe/svnrdump_sim.py
index 1cfac4a..ed43dbb 100755
--- a/contrib/svn-fe/svnrdump_sim.py
+++ b/contrib/svn-fe/svnrdump_sim.py
@@ -7,6 +7,10 @@ to the highest revision that should be available.
 """
 import sys, os
 
+if sys.hexversion < 0x02040000:
+	# The limiter is the ValueError() calls. This may be too conservative
+        sys.stderr.write("svnrdump-sim.py: requires Python 2.4 or later.")
+        sys.exit(1)
 
 def getrevlimit():
         var = 'SVNRMAX'
diff --git a/git-p4.py b/git-p4.py
index 551aec9..ec060b4 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -12,6 +12,11 @@ import optparse, sys, os, marshal, subprocess, shelve
 import tempfile, getopt, os.path, time, platform
 import re, shutil
 
+if sys.hexversion < 0x02040000:
+    # The limiter is the subprocess module
+    sys.stderr.write("git-p4.py: requires Python 2.4 or later.")
+    sys.exit(1)
+
 verbose = False
 
 # Only labels/tags matching this will be imported/exported
diff --git a/git-remote-testgit.py b/git-remote-testgit.py
index 5f3ebd2..22d2eb6 100644
--- a/git-remote-testgit.py
+++ b/git-remote-testgit.py
@@ -31,6 +31,11 @@ from git_remote_helpers.git.exporter import GitExporter
 from git_remote_helpers.git.importer import GitImporter
 from git_remote_helpers.git.non_local import NonLocalGit
 
+if sys.hexversion < 0x01050200:
+    # os.makedirs() is the limiter
+    sys.stderr.write("git-remote-testgit.py: requires Python 1.5.2 or later.")
+    sys.exit(1)
+
 def get_repo(alias, url):
     """Returns a git repository object initialized for usage.
     """
diff --git a/git_remote_helpers/git/__init__.py b/git_remote_helpers/git/__init__.py
index e69de29..776e891 100644
--- a/git_remote_helpers/git/__init__.py
+++ b/git_remote_helpers/git/__init__.py
@@ -0,0 +1,4 @@
+if sys.hexversion < 0x02040000:
+    # The limiter is the subprocess module
+    sys.stderr.write("git_remote_helpers: requires Python 2.4 or later.")
+    sys.exit(1)
-- 
1.8.1.rc2



-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

"The state calls its own violence `law', but that of the individual `crime'"
	-- Max Stirner

^ 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