Git development
 help / color / mirror / Atom feed
* Re: [PATCH] Teach --text option to diff
From: Junio C Hamano @ 2006-07-07 11:06 UTC (permalink / raw)
  To: Stephan Feder; +Cc: git
In-Reply-To: <11522684373987-git-send-email-sf@b-i-t.de>

Stephan Feder <sf@b-i-t.de> writes:

> I have to send patches of binary data to a customer but the builtin diff
> was no help in this case.

Given the previous patch, and also your point #2 below, I would
have expected you to introduce an option to force files to be
treated as binary even when they are otherwise misidentified as
text, but this patch is going the other way.

Interesting.

> 1. The shorthand -a for --text is not implemented. Is there a conflicting
> shorthand?

I do not think of one offhand, but it's the responsibility for
the party to propose such an enhancement to do the study ;-)

> 2. For diffstat --text is ignored. It seems pointless because binary
> patch data is not for human consumption anyway.

> 3. No documentation yet. If the patch is accepted I will add a short
> description. To Documentation/diff-options.txt?

Most likely that would be the place.

^ permalink raw reply

* Re: [PATCH 1/3] configure: Add test for Perl
From: Petr Baudis @ 2006-07-07 11:06 UTC (permalink / raw)
  To: Timo Hirvonen; +Cc: Dennis Stosberg, git
In-Reply-To: <20060706161011.ccc2ea1c.tihirvon@gmail.com>

Dear diary, on Thu, Jul 06, 2006 at 03:10:11PM CEST, I got a letter
where Timo Hirvonen <tihirvon@gmail.com> said that...
> Dennis Stosberg <dennis@stosberg.net> wrote:
> 
> > +	echocheck "for perl"
> > +	if test -z "$_perl" ; then
> > +		_perl=`which perl`
> > +		test "$_perl" || die "cannot find path to perl"
> > +	fi
> > +	echores "$_perl"
> 
> "which" isn't portable. On SunOS 5.9 "which foo" prints error message to
> stdout and returns 0.

Wait, Git runs on SunOS 5.9?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam

^ permalink raw reply

* Re: [PATCH] diff.c: respect diff.renames config option
From: Junio C Hamano @ 2006-07-07 11:18 UTC (permalink / raw)
  To: Eric Wong; +Cc: git
In-Reply-To: <20060707110123.GA23400@soma>

Eric Wong <normalperson@yhbt.net> writes:

> Nevertheless, it's still opt -in via repo-config, and most people will
> find renames useful unless they need to export to non-git
> systems.

I am more worried about somebody who opts-in finds breakage of
commands that happen to internally use low-level diff machinery
and expect the diff machinery does not automagically do funny
rename detection without being told.

For example, revision walking with path pruning uses diff
machinery without renames.  I do not know what happens if I
override it with diff.renames to allow rename detection but I
fear something might horribly break.

That is why I said I do not want this at _that_ low level.  I do
not have objections to have the configuration at a layer closer
to the UI, e.g. things in builtin-log.c and builtin-diff.c.

^ permalink raw reply

* Re: [PATCH] Do not drop data from '\0' until eol in patch output
From: sf @ 2006-07-07 11:18 UTC (permalink / raw)
  To: git
In-Reply-To: <7vslld1ycq.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:
> Stephan Feder <sf@b-i-t.de> writes:
> 
>> The binary file detection is just a heuristic which can well fail.
>> Do not produce garbage patches in these cases.
>>
>> Signed-off-by: Stephan Feder <sf@b-i-t.de>
> 
> Thanks.
> 
> I do not think this patch is _wrong_ per se, but I wonder what
> you would use a patch like that for.  Specifically, do you apply
> such a patch with NUL and other binary data in it, and if so
> what tool do you use?
> 

GNU patch can apply patches with binary content which are typically
produced with GNU diff with --text option.

^ permalink raw reply

* Re: [PATCH 1/3] configure: Add test for Perl
From: Junio C Hamano @ 2006-07-07 11:20 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git
In-Reply-To: <20060707110655.GR29115@pasky.or.cz>

Petr Baudis <pasky@suse.cz> writes:

>> "which" isn't portable. On SunOS 5.9 "which foo" prints error message to
>> stdout and returns 0.
>
> Wait, Git runs on SunOS 5.9?

I thought so.  In any case, the traditionalist way is to split $PATH
by hand with "IFS=:" -- somebody already posted that on this
thread.

^ permalink raw reply

* Re: [PATCH 1/3] configure: Add test for Perl
From: Timo Hirvonen @ 2006-07-07 11:23 UTC (permalink / raw)
  To: Petr Baudis; +Cc: dennis, git
In-Reply-To: <20060707110655.GR29115@pasky.or.cz>

Petr Baudis <pasky@suse.cz> wrote:

> Dear diary, on Thu, Jul 06, 2006 at 03:10:11PM CEST, I got a letter
> where Timo Hirvonen <tihirvon@gmail.com> said that...
> > "which" isn't portable. On SunOS 5.9 "which foo" prints error message to
> > stdout and returns 0.
> 
> Wait, Git runs on SunOS 5.9?

I have no idea.  I noticed the problem with "which" when I ported my
cmus configure scripts to SunOS.

In the git Makefile there are:

ifeq ($(uname_S),SunOS)
...
    ifeq ($(uname_R),5.8)
...
    ifeq ($(uname_R),5.9)


so it at least tries to work ;)  Oh and that 5.9 is apparently kernel
version, not OS version.  Sorry for the confusion.

-- 
http://onion.dynserv.net/~timo/

^ permalink raw reply

* [PATCH] Makefile: export NO_SVN_TESTS
From: Johannes Schindelin @ 2006-07-07 11:26 UTC (permalink / raw)
  To: git, junkio


Without this patch, it really is not sufficient to define NO_SVN_TESTS
in config.mak or the Makefile.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index e5e536a..2aa0123 100644
--- a/Makefile
+++ b/Makefile
@@ -708,6 +708,7 @@ # However, the environment gets quite bi
 # with that.
 
 export NO_PYTHON
+export NO_SVN_TESTS
 
 test: all
 	$(MAKE) -C t/ all
-- 
1.4.1.g2e7c-dirty

^ permalink raw reply related

* fatal: ambiguous argument '': unknown revision or path not in the working tree.
From: Michal Ludvig @ 2006-07-07 11:52 UTC (permalink / raw)
  To: git

Hi all,

I'm getting this error from most cogito commands in my repository
(created with cg-init):

===
$ cg status
Heads:
   >master      66ef937771695c865e38ff7227c077d9260759ce

? patches/series
fatal: ambiguous argument '': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions
===

I already have some commits and history in there that I'd prefer not to
loose. When I clone this repository the error disappears but I'd prefer
to fix it in place.

Any ideas?

Using cogito-0.17 and git-1.4.0

Thanks

Michal

^ permalink raw reply

* Re: [PATCH] Teach --text option to diff
From: sf @ 2006-07-07 11:53 UTC (permalink / raw)
  To: git
In-Reply-To: <7v64i91xow.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:
> Stephan Feder <sf@b-i-t.de> writes:
> 
>> I have to send patches of binary data to a customer but the builtin diff
>> was no help in this case.
> 
> Given the previous patch, and also your point #2 below, I would
> have expected you to introduce an option to force files to be
> treated as binary even when they are otherwise misidentified as
> text, but this patch is going the other way.
> 
> Interesting.

Not really. I was surprised that the GNU diff option --text is
unsupported in the builtin diff.

> 
>> 1. The shorthand -a for --text is not implemented. Is there a conflicting
>> shorthand?
> 
> I do not think of one offhand, but it's the responsibility for
> the party to propose such an enhancement to do the study ;-)

Of course. I did not find any conflict but as the builtin diff and its
options are used by quite a lot of git commands I wanted to make sure.

If no objections arise I am going to add the shorthand.

>> 2. For diffstat --text is ignored. It seems pointless because binary
>> patch data is not for human consumption anyway.
> 
>> 3. No documentation yet. If the patch is accepted I will add a short
>> description. To Documentation/diff-options.txt?
> 
> Most likely that would be the place.

Good.

^ permalink raw reply

* Re: [PATCH] Do not drop data from '\0' until eol in patch output
From: Junio C Hamano @ 2006-07-07 12:03 UTC (permalink / raw)
  To: sf; +Cc: git
In-Reply-To: <44AE431C.4090509@b-i-t.de>

sf <sf@b-i-t.de> writes:

> GNU patch can apply patches with binary content which are typically
> produced with GNU diff with --text option.

Hmph.  Things must have improved since I looked at it the last
time, perhaps 6-7 years ago.  I remember that I used "diff -a
-u0" as an el-cheapo way to deliber binary contents but found
that patch sometimes could not grok such, and ended up writing a
small customized C program.

^ permalink raw reply

* Re: [PATCH] diff.c: respect diff.renames config option
From: Junio C Hamano @ 2006-07-07 12:17 UTC (permalink / raw)
  To: Eric Wong; +Cc: git
In-Reply-To: <7vpsghzmr1.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> writes:

> I am more worried about somebody who opts-in finds breakage of
> commands that happen to internally use low-level diff machinery
> and expect the diff machinery does not automagically do funny
> rename detection without being told.
> ...
> That is why I said I do not want this at _that_ low level.  I do
> not have objections to have the configuration at a layer closer
> to the UI, e.g. things in builtin-log.c and builtin-diff.c.

Upon closer look I think the revision pruning code is OK.  So
let's cook this as is in "next" and see what happens.

^ permalink raw reply

* Re: [PATCH] diff.c: respect diff.renames config option
From: Junio C Hamano @ 2006-07-07 12:29 UTC (permalink / raw)
  To: Eric Wong; +Cc: git
In-Reply-To: <7vpsghzmr1.fsf@assigned-by-dhcp.cox.net>

In the same spirit...

From: Junio C Hamano <junkio@cox.net>
Date: Fri, 7 Jul 2006 05:27:24 -0700
Subject: [PATCH] diff.c: --no-color to defeat diff.color configuration.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 diff.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/diff.c b/diff.c
index 2534fce..39e608f 100644
--- a/diff.c
+++ b/diff.c
@@ -1622,6 +1622,8 @@ int diff_opt_parse(struct diff_options *
 	}
 	else if (!strcmp(arg, "--color"))
 		options->color_diff = 1;
+	else if (!strcmp(arg, "--no-color"))
+		options->color_diff = 0;
 	else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
 		options->xdl_opts |= XDF_IGNORE_WHITESPACE;
 	else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))
-- 
1.4.1.gfff4c

^ permalink raw reply related

* [PATCH] update Documentation/diff-options.txt
From: Junio C Hamano @ 2006-07-07 12:30 UTC (permalink / raw)
  To: git
In-Reply-To: <7vpsghzmr1.fsf@assigned-by-dhcp.cox.net>

We've been lazy and left things undocumented for some time.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 Documentation/diff-options.txt |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index f523ec2..fdcfd68 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -4,18 +4,21 @@
 -u::
 	Synonym for "-p".
 
+--raw::
+	Generate the raw format.
+
 --patch-with-raw::
-	Generate patch but keep also the default raw diff output.
+	Synonym for "-p --raw".
 
 --stat::
-	Generate a diffstat instead of a patch.
+	Generate a diffstat.
 
 --summary::
 	Output a condensed summary of extended header information
 	such as creations, renames and mode changes.
 
 --patch-with-stat::
-	Generate patch and prepend its diffstat.
+	Synonym for "-p --stat".
 
 -z::
 	\0 line termination on output
@@ -26,11 +29,26 @@
 --name-status::
 	Show only names and status of changed files.
 
+--color::
+	Show colored diff.
+
+--no-color::
+	Turn off colored diff, even when the configuration file
+	gives the default to color output.
+
+--no-renames::
+	Turn off rename detection, even when the configuration
+	file gives the default to do so.
+
 --full-index::
 	Instead of the first handful characters, show full
 	object name of pre- and post-image blob on the "index"
 	line when generating a patch format output.	
 
+--binary::
+	In addition to --full-index, output "binary diff" that
+	can be applied with "git apply".
+
 --abbrev[=<n>]::
 	Instead of showing the full 40-byte hexadecimal object
 	name in diff-raw format output and diff-tree header
-- 
1.4.1.gfff4c

^ permalink raw reply related

* Re: [PATCH] Makefile: export NO_SVN_TESTS
From: Junio C Hamano @ 2006-07-07 12:41 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0607071326030.29667@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Without this patch, it really is not sufficient to define NO_SVN_TESTS
> in config.mak or the Makefile.

Good catch.  I never use config.mak but always use the make
wrapper approach, so I did not notice it.

Thanks.

^ permalink raw reply

* [PATCH 3/3] diff-options: Explain --text and -a
From: Stephan Feder @ 2006-07-07 13:57 UTC (permalink / raw)
  To: git
In-Reply-To: <44AE4B35.6060607@b-i-t.de>

Signed-off-by: Stephan Feder <sf@b-i-t.de>
---
 Documentation/diff-options.txt |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index f523ec2..1a93629 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -94,5 +94,11 @@
 	Swap two inputs; that is, show differences from index or
 	on-disk file to tree contents.
 
+--text::
+	Treat all files as text.
+
+-a::
+	Shorthand for "--text".
+
 For more detailed explanation on these common options, see also
 link:diffcore.html[diffcore documentation].
-- 
1.4.1.gbc483

^ permalink raw reply related

* [PATCH 2/3] Add -a and --text to common diff options help
From: Stephan Feder @ 2006-07-07 13:57 UTC (permalink / raw)
  To: git
In-Reply-To: <44AE4B35.6060607@b-i-t.de>

Signed-off-by: Stephan Feder <sf@b-i-t.de>
---
 diff.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/diff.h b/diff.h
index f80f646..8ab0448 100644
--- a/diff.h
+++ b/diff.h
@@ -162,7 +162,8 @@ #define COMMON_DIFF_OPTIONS_HELP \
 "  -O<file>      reorder diffs according to the <file>.\n" \
 "  -S<string>    find filepair whose only one side contains the string.\n" \
 "  --pickaxe-all\n" \
-"                show all files diff when -S is used and hit is found.\n"
+"                show all files diff when -S is used and hit is found.\n" \
+"  -a  --text    treat all files as text.\n"
 
 extern int diff_queue_is_empty(void);
 extern void diff_flush(struct diff_options*);
-- 
1.4.1.gbc483

^ permalink raw reply related

* [PATCH 1/3] Teach diff -a as shorthand for --text
From: Stephan Feder @ 2006-07-07 13:57 UTC (permalink / raw)
  To: git
In-Reply-To: <44AE4B35.6060607@b-i-t.de>

Signed-off-by: Stephan Feder <sf@b-i-t.de>
---
 diff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff.c b/diff.c
index 1f0219d..b423491 100644
--- a/diff.c
+++ b/diff.c
@@ -1561,7 +1561,7 @@ int diff_opt_parse(struct diff_options *
 		options->output_format |= DIFF_FORMAT_PATCH;
 		options->full_index = options->binary = 1;
 	}
-	else if (!strcmp(arg, "--text")) {
+	else if (!strcmp(arg, "-a") || !strcmp(arg, "--text")) {
 		options->text = 1;
 	}
 	else if (!strcmp(arg, "--name-only"))
-- 
1.4.1.gbc483

^ permalink raw reply related

* Re: fatal: ambiguous argument '': unknown revision or path not in the working tree.
From: Anand Kumria @ 2006-07-07 14:54 UTC (permalink / raw)
  To: git
In-Reply-To: <44AE4B02.2050408@logix.cz>

On Fri, 07 Jul 2006 23:52:34 +1200, Michal Ludvig wrote:

> Hi all,
> 
> I'm getting this error from most cogito commands in my repository
> (created with cg-init):

[snip]

> Using cogito-0.17 and git-1.4.0

You need to upgrade to cogito-0.17.2 with git-1.4.0

Cheers,
Anand

^ permalink raw reply

* [PATCH 0/4] More tests for hand-written configure (resend)
From: Dennis Stosberg @ 2006-07-07 16:25 UTC (permalink / raw)
  To: git

Second version of the additional tests.  Changes relative to
yesterdays's patches:

  -  Calls to the "which" command have been replaced by a shell
     function that Timo Hirvonen has written
  -  Paths to Perl and Python binaries can be given in an
     environment variable to prevent auto-detection.
  -  NO_PYTHON is set, if no suitable python can be found
  -  Fixes to make it run on Solaris.

Tested on Linux (bash, dash), Solaris 9 (sh) and NetBSD (sh/ash).

I noticed that the autoconf-based solution has replaced Pasky's
scripts in the pu branch.  Has a final decision been made?

I must admit that I'm less convinced today that a hand-written
configuration script is better than I was yesterday when I started
to write the tests.

Regards,
Dennis

^ permalink raw reply

* [PATCH 1/4] configure: Add test for Perl
From: Dennis Stosberg @ 2006-07-07 16:26 UTC (permalink / raw)
  To: git
In-Reply-To: <20060707162513.25746.57374.stgit@leonov.stosberg.net>

From: Dennis Stosberg <dennis@stosberg.net>

This patch adds two tests to the configuration script. The first
one tries to find a perl binary in the path.  The second one checks
whether the found perl is of a sufficient version.

The user can override the auto-detection with the --perl parameter
or with the PERL environment variable.

The path_find() function was written by Timo Hirvonen as a replacement
for "which", which cannot be used portably.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---

 config-lib.sh |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/config-lib.sh b/config-lib.sh
index 68fecc5..34dfc05 100755
--- a/config-lib.sh
+++ b/config-lib.sh
@@ -117,6 +117,22 @@ alpha() {
 	esac
 }
 
+# replacement for "which", which cannot be used portably
+path_find()
+{
+        _ifs="$IFS"
+        IFS=:
+        for i in $PATH; do
+                if test -x "$i/$1"; then
+                        IFS="$_ifs"
+                        echo "$i/$1"
+                        return 0
+                fi
+        done
+        IFS="$_ifs"
+        return 1
+}
+
 # not boolean test: implement the posix shell "!" operator for a
 # non-posix /bin/sh.
 #   usage:  not {command}
@@ -240,6 +256,9 @@ process_params() {
 	_cc=cc
 	test "$CC" && _cc="$CC"
 
+	_perl=
+	test "$PERL" && _perl="$PERL"
+
 	for ac_option do
 		case "$ac_option" in
 		--help|-help|-h)
@@ -262,6 +281,7 @@ Installation directories:
 
 Miscellaneous options:
   --cc=COMPILER          use this C compiler to build MPlayer [gcc]
+  --perl=PATH            path to perl binary [autodetect]
   --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
   --with-install=PATH    use a custom install program (useful if your OS uses
                          a GNU-incompatible install utility by default and
@@ -296,6 +316,8 @@ EOF
 
 		--cc=*)
 			_cc=`echo $ac_option | cut -d '=' -f 2` ;;
+		--perl=*)
+			_perl=`echo $ac_option | cut -d '=' -f 2` ;;
 		--target=*)
 			_target=`echo $ac_option | cut -d '=' -f 2` ;;
 		--with-install=*)
@@ -409,8 +431,21 @@ int main(void) { return 0; }
 EOF
 	{ cc_check && tmp_run; } || die "unusable compiler or produced binary"
 	echores yes
-}
 
+	echocheck "for perl"
+	if test -z "$_perl" ; then
+		_perl=`path_find perl`
+		test "$_perl" || die "cannot find path to perl"
+	fi
+	echores "$_perl"
+
+	echocheck "perl version"
+	_perl_version=`"$_perl" -e 'eval{require 5.6.0; printf "%vd", $^V}'`
+	if test -z "$_perl_version" ; then
+		die "your perl is too old. Perl 5.6.0 or newer is required."
+	fi
+	echores "$_perl_version"
+}
 
 write_config() {
 	echo "Creating config.mak.autogen"
@@ -420,6 +455,7 @@ write_config() {
 # -------- Generated by configure -----------
 
 CC = $_cc
+PERL_PATH = $_perl
 INSTALL = $_install
 
 EOF

^ permalink raw reply related

* [PATCH 3/4] configure: Try to figure out compiler options
From: Dennis Stosberg @ 2006-07-07 16:26 UTC (permalink / raw)
  To: git
In-Reply-To: <20060707162513.25746.57374.stgit@leonov.stosberg.net>

From: Dennis Stosberg <dennis@stosberg.net>

This patch adds tests to determine of what flavour the used
compiler is and sets CFLAGS and the PIC flag appropriately.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---

 Makefile      |    3 ++-
 config-lib.sh |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 4dc5379..23c784e 100644
--- a/Makefile
+++ b/Makefile
@@ -96,6 +96,7 @@ ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 PERL_CFLAGS =
 PERL_LDFLAGS =
+PICFLAG = -fPIC
 STRIP ?= strip
 
 prefix = $(HOME)
@@ -483,7 +484,7 @@ endif
 endif
 endif
 ifdef USE_PIC
-	ALL_CFLAGS += -fPIC
+	ALL_CFLAGS += $(PICFLAG)
 endif
 ifdef NO_ACCURATE_DIFF
 	BASIC_CFLAGS += -DNO_ACCURATE_DIFF
diff --git a/config-lib.sh b/config-lib.sh
index 3968245..0bcd4c3 100755
--- a/config-lib.sh
+++ b/config-lib.sh
@@ -35,9 +35,9 @@ compile_check() {
 	echo
 	cat "$1"
 	echo
-	echo "$_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra -o $TMPO $@"
+	echo "$_cc $_cflags $_inc_extra $_ld_static $_ld_extra -o $TMPO $@"
 	rm -f "$TMPO"
-	$_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra -o "$TMPO" "$@" || return $?
+	$_cc $_cflags $_inc_extra $_ld_static $_ld_extra -o "$TMPO" "$@" || return $?
 	echo
 	echo "ldd $TMPO"
 	$_ldd "$TMPO" || return $?
@@ -283,7 +283,7 @@ Installation directories:
   --gitpythondir=DIR     use this prefix for python libraries [PREFIX/share/git-core/python]
 
 Miscellaneous options:
-  --cc=COMPILER          use this C compiler to build MPlayer [gcc]
+  --cc=COMPILER          use this C compiler to build Git [cc]
   --perl=PATH            path to perl binary [autodetect]
   --python=PATH          path to python binary [autodetect]
   --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
@@ -373,8 +373,8 @@ EOF
 				i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;;
 				ia64) host_arch=ia64 ;;
 				x86_64|amd64)
-				if [ -n "`$_cc -dumpmachine | sed -n '/^x86_64-/p;/^amd64-/p'`" -a \
-					-z "`echo $CFLAGS | grep -- -m32`"  ]; then
+				if [ -n "`$_cc -dumpmachine 2>/dev/null | sed -n '/^x86_64-/p;/^amd64-/p'`" -a \
+					-z "`echo $_cflags | grep -- -m32`"  ]; then
 					host_arch=x86_64
 				else
 					host_arch=i386
@@ -430,7 +430,51 @@ test_setup() {
 	TMPS="$I/git-conf-$RANDOM-$$.S"
 }
 
+cc_flavour() {
+
+	echocheck "whether cc is GCC"
+	cat > $TMPC <<EOF
+#ifndef __GNUC__
+#error Not GCC
+#endif
+int main(void) { return 0; }
+EOF
+	if cc_check ; then
+		echores "yes"
+		_cc_flavour="gcc"
+		return
+	fi
+	echores "no"
+
+	echocheck "whether cc is Sun CC"
+	cat > $TMPC <<EOF
+#ifndef __SUNPRO_C
+#error Not SUN CC
+#endif
+int main(void) { return 0; }
+EOF
+	if cc_check ; then
+		echores "yes"
+		_cc_flavour="suncc"
+		return
+	fi
+	echores "no"
+}
+
 basic_tests() {
+	_cc_flavour=unknown
+	cc_flavour
+
+	if test "$_cc_flavour" = "gcc" ; then
+		_cflags="-g -O2 -Wall"
+		_picflag="-fPIC"
+	elif test "$_cc_flavour" = "suncc"; then
+		_cflags="-g -xO3"
+		_picflag="-KPIC"
+	fi
+	test "$CFLAGS" && _cflags="$CFLAGS"
+	test "$PICFLAG" && _picflag="$PICFLAG"
+
 	echocheck "if your build environment is sane"
 	cat > $TMPC <<EOF
 int main(void) { return 0; }
@@ -483,6 +527,8 @@ write_config() {
 # -------- Generated by configure -----------
 
 CC = $_cc
+CFLAGS = $_cflags
+PICFLAG = $_picflag
 PERL_PATH = $_perl
 INSTALL = $_install
 

^ permalink raw reply related

* [PATCH 2/4] configure: Add test for Python
From: Dennis Stosberg @ 2006-07-07 16:26 UTC (permalink / raw)
  To: git
In-Reply-To: <20060707162513.25746.57374.stgit@leonov.stosberg.net>

From: Dennis Stosberg <dennis@stosberg.net>

The test tries to find the path to a suitable Python binary.  The
user can override the auto-detection with the --python parameter
or with the PYTHON environment variable.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---

 config-lib.sh |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/config-lib.sh b/config-lib.sh
index 34dfc05..3968245 100755
--- a/config-lib.sh
+++ b/config-lib.sh
@@ -259,6 +259,9 @@ process_params() {
 	_perl=
 	test "$PERL" && _perl="$PERL"
 
+	_python=
+	test "$PYTHON" && _python="$PYTHON"
+
 	for ac_option do
 		case "$ac_option" in
 		--help|-help|-h)
@@ -282,6 +285,7 @@ Installation directories:
 Miscellaneous options:
   --cc=COMPILER          use this C compiler to build MPlayer [gcc]
   --perl=PATH            path to perl binary [autodetect]
+  --python=PATH          path to python binary [autodetect]
   --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
   --with-install=PATH    use a custom install program (useful if your OS uses
                          a GNU-incompatible install utility by default and
@@ -318,6 +322,8 @@ EOF
 			_cc=`echo $ac_option | cut -d '=' -f 2` ;;
 		--perl=*)
 			_perl=`echo $ac_option | cut -d '=' -f 2` ;;
+		--python=*)
+			_python=`echo $ac_option | cut -d '=' -f 2` ;;
 		--target=*)
 			_target=`echo $ac_option | cut -d '=' -f 2` ;;
 		--with-install=*)
@@ -445,6 +451,28 @@ EOF
 		die "your perl is too old. Perl 5.6.0 or newer is required."
 	fi
 	echores "$_perl_version"
+
+	echocheck "for python"
+	for _py_bin in python python2.4 python2.3; do
+		test "$_python" && continue
+
+		_candidate=`path_find $_py_bin`
+		test "$_candidate" || continue
+
+		$_candidate - <<EOF || continue
+import sys
+v = sys.version_info
+if v < (2, 3):
+    sys.exit(1)
+EOF
+		_python=$_candidate
+	done
+	if test "$_python"; then
+		echores "$_python"
+	else
+		_no_python="ConfigureYesPlease"
+		echores "not found"
+	fi
 }
 
 write_config() {
@@ -465,6 +493,10 @@ EOF
 		test -z $_mandir || ( echo "mandir = $_mandir" && echo "export mandir" )
 		test -z $_templatedir || echo "template_dir = $_templatedir"
 		test -z $_gitpythondir || echo "GIT_PYTHON_DIR = $_gitpythondir"
+
+		test -z $_python || echo "PYTHON_PATH = $_python"
+		test -z $_no_python || echo "NO_PYTHON = $_no_python"
+
 		echo
 		eval "$mkvars"
 	} > config.mak.autogen

^ permalink raw reply related

* [PATCH 4/4] configure: Fixes for Solaris
From: Dennis Stosberg @ 2006-07-07 16:26 UTC (permalink / raw)
  To: git
In-Reply-To: <20060707162513.25746.57374.stgit@leonov.stosberg.net>

From: Dennis Stosberg <dennis@stosberg.net>

- Solaris' /bin/sh will not find a function if there is a variable 
  with the same name.
- 'test -z $var' fails if $var is empty.  Needs to be 'test -z "$var"' 

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---

 config-lib.sh |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/config-lib.sh b/config-lib.sh
index 0bcd4c3..4dd4d00 100755
--- a/config-lib.sh
+++ b/config-lib.sh
@@ -181,7 +181,7 @@ add_library() { # --with
 	lib_help="$lib_help
 $desc [$hdefault]"
 	switches="$switches switch_lib \"$name\" \"$switch\" \"\$ac_option\" || "
-	mkvars="$mkvars mkvar \"\$$name\" \"$mkvar\";"
+	mkvars="$mkvars print_mkvar \"\$$name\" \"$mkvar\";"
 	eval "$name=$default"
 }
 
@@ -196,7 +196,7 @@ add_feature() { # --enable
 	feature_help="$feature_help
 $desc [$hdefault]"
 	switches="$switches switch_feature \"$name\" \"$switch\" \"\$ac_option\" || "
-	mkvars="$mkvars mkvar \"\$$name\" \"$mkvar\";"
+	mkvars="$mkvars print_mkvar \"\$$name\" \"$mkvar\";"
 	eval "$name=$default"
 }
 
@@ -226,7 +226,7 @@ switch_feature() {
 	return 0
 }
 
-mkvar() {
+print_mkvar() {
 	value="$1"; shift; mkvar="$1"; shift
 	noval=""; yesval="ConfigureYesPlease"
 	case $mkvar in
@@ -533,15 +533,15 @@ PERL_PATH = $_perl
 INSTALL = $_install
 
 EOF
-		test -z $_prefix || echo "prefix = $_prefix"
-		test -z $_bindir || echo "bindir = $_bindir"
-		test -z $_gitexecdir || echo "gitexecdir = $_gitexecdir"
-		test -z $_mandir || ( echo "mandir = $_mandir" && echo "export mandir" )
-		test -z $_templatedir || echo "template_dir = $_templatedir"
-		test -z $_gitpythondir || echo "GIT_PYTHON_DIR = $_gitpythondir"
-
-		test -z $_python || echo "PYTHON_PATH = $_python"
-		test -z $_no_python || echo "NO_PYTHON = $_no_python"
+		test -z "$_prefix" || echo "prefix = $_prefix"
+		test -z "$_bindir" || echo "bindir = $_bindir"
+		test -z "$_gitexecdir" || echo "gitexecdir = $_gitexecdir"
+		test -z "$_mandir" || ( echo "mandir = $_mandir" && echo "export mandir" )
+		test -z "$_templatedir" || echo "template_dir = $_templatedir"
+		test -z "$_gitpythondir" || echo "GIT_PYTHON_DIR = $_gitpythondir"
+
+		test -z "$_python" || echo "PYTHON_PATH = $_python"
+		test -z "$_no_python" || echo "NO_PYTHON = $_no_python"
 
 		echo
 		eval "$mkvars"

^ permalink raw reply related

* Re: [PATCH] Add "raw" output option to blobs in "tree" view format
From: Luben Tuikov @ 2006-07-07 16:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vmzbl3nqj.fsf@assigned-by-dhcp.cox.net>

--- Junio C Hamano <junkio@cox.net> wrote:
> Luben Tuikov <ltuikov@yahoo.com> writes:
> 
> > Add a "raw" output option to blobs in "tree" view format, so that the
> > user doesn't have to click on "blob", wait for the (binary) file to be
> > uploaded and shown in "blob" mode, and then click on "plain" to
> > download the (binary) file.
> 
> I appreciate what you are trying to achieve, but at the same
> time wonder if it would make more sense to simply teach a=blob
> action to do this automatically, perhaps using /etc/mime.types
> and/or File::MMagic.

That'd be cool for non-"text/*" files, but it would leave the user
go through the same click "tree->blob->plain" for "text/*" files,
since they are "cat -n"-able and the default action would be git_blob()
if such an algorithm is implemented.

That is, the user would still have to click through "tree->blob->plain"
to download a "text/*" file, as opposed to just "tree->raw".

What this patch allows, is that the user be able to simply download the file,
right from "tree" view, regardless of the type of file. (I.e. the type of
file as decided by the _user_, not gitweb.cgi.)

Having said that, we can still implement it, so that "raw"="blob" for
non-"text/*" files, but "raw"!="blob" for "text/*" files.  I.e. allow
the "cat -n" functionality for "text/*" files, as is currently implemented,
as well as shortcut for downloading ("raw").

> If you know your MUA will mangle whitespace to make your patch
> inapplicable, please do not add a patch to the message _and_
> attach the patch to the message.  The mail-acceptance tools know
> how to flatten MIME attachments, but if you have your log,
> three-dash and then corrupt patch in the cover-letter part, and
> then the true patch in the attachment part, the flattened result
> will have the corrupt patch first to cause the patch application
> to fail.  So please either (preferably) use a MUA that does not
> corrupt your patches, or do a log in the message part with patch
> only as attachment.

Will do.

    Luben

^ permalink raw reply

* Re: comparing file contents in is_exact_match?
From: Florian Weimer @ 2006-07-07 16:33 UTC (permalink / raw)
  To: git
In-Reply-To: <20060706055729.GA12512@admingilde.org>

* Martin Waitz:

> I created a git repository for my photo collection and then renamed
> some photos (about 600).  Now git status and commit get hit by
> the OOM killer.
>
> The reason for that is that is_exact_match (in diffcore-rename.c) maps
> both the source and destination file into memory and then compares them
> byte for byte.  This is a little bit too much for my little machine.

Uhm, this shouldn't trigger the OOM killer, really.  You already have
physical backing storage for both files, so this shouldn't count
towards the OOM limit.  Ah, diff_populate_filespec has the following:

   s->data = mmap(NULL, s->size, PROT_READ, MAP_PRIVATE, fd, 0);

Perhaps the following patch is in order?  On some systems, MAP_PRIVATE
might guarantee some form of repeatable reads, but I don't think GIT
needs this to guard against concurrent modification.

-- >8 --
diff_populate_filespec: use shared mapping

It seems that on some systems, PROT_READ + MAP_PRIVATE counts towards
the OOM limit, even though no additional backing store is required.
Requesting MAP_SHARED mapping should fix this.

Signed-off-by: Florian Weimer <fw@deneb.enyo.de>
---
 diff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff.c b/diff.c
index 428ff78..2b4367e 100644
--- a/diff.c
+++ b/diff.c
@@ -1007,7 +1007,7 @@ int diff_populate_filespec(struct diff_f
                fd = open(s->path, O_RDONLY);
                if (fd < 0)
                        goto err_empty;
-               s->data = mmap(NULL, s->size, PROT_READ, MAP_PRIVATE, fd, 0);
+               s->data = mmap(NULL, s->size, PROT_READ, MAP_SHARED, fd, 0);
                close(fd);
                if (s->data == MAP_FAILED)
                        goto err_empty;
--
1.4.0

^ 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