* Re: Solaris install error: didn't get git-init link was [Fwd: Re: The Reposithon! Take 2]
From: Jeff King @ 2007-12-17 15:13 UTC (permalink / raw)
To: Sam Vilain; +Cc: Git Mailing List
In-Reply-To: <47668ABB.9000504@vilain.net>
On Tue, Dec 18, 2007 at 03:42:03AM +1300, Sam Vilain wrote:
> Refer attached ... 1.5.3.6 install, didn't get git-init link to git.
> Ring any bells?
I just tried it and it worked OK. Note that the hardlinks are the _last_
part of the install procedure, even after doing the perl and git-gui
subdirectories. Are we sure the "make install" actually made it to
completion?
-Peff
^ permalink raw reply
* Re: [PATCH] Have a flag to stop the option parsing at the first argument.
From: Johannes Sixt @ 2007-12-17 15:13 UTC (permalink / raw)
To: Wincent Colaiuta
Cc: Johannes Schindelin, Pierre Habouzit, Junio C Hamano, git
In-Reply-To: <223E3B44-92DA-4861-83D6-67E56F70E784@wincent.com>
Wincent Colaiuta schrieb:
> But leaving -p aside, will you oppose any patches that make it possible
> for people to write stuff like:
>
> git init --bare
>
> Personally, I think this is an obvious usability improvement worth
> striving for. Given that "git --bare init" will continue to work under
> what I'm proposing, I really can't see any worthwhile argument against
> it. Because we're talking about a UI improvement for newcomers at no
> cost to old timers.
Your point. I hate to have to think hard each time whether it's "git --bare
init" or "git init --bare" and "git clone --bare" or "git --bare clone" and
wouldn't mind if I no longer needed to.
-- Hannes
^ permalink raw reply
* Re: git-clone: Unobvious error messages when update-server-info has not been run
From: Sebastian Harl @ 2007-12-17 15:47 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, Gerrit Pape, git
In-Reply-To: <20071217124359.GA20800@coredump.intra.peff.net>
[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]
Hi Jeff,
On Mon, Dec 17, 2007 at 07:43:59AM -0500, Jeff King wrote:
> On Mon, Dec 17, 2007 at 11:55:41AM +0100, Sebastian Harl wrote:
> > I was just trying to clone a repository using http but missed to run
> > git-update-server-info on the server side. git-clone aborted with the
> > following error messages:
> >
> > % git clone http://some/repo.git
> > Initialized empty Git repository in /path/repo/.git/
> > cat: /path/repo/.git/refs/remotes/origin/master: No such file or directory
> > cd: 482: can't cd to /path/repo/.git/refs/remotes/origin
> > fatal: : not a valid SHA1
> > fatal: Not a valid object name HEAD
> >
> > It's kind of hard to guess where the error comes from in this case (I blamed
> > Git at first). Is there some way to improve the error message in a case like
> > this?
>
> git-clone is supposed to detect this condition, but there was a bug in
> the error checking code. Can you confirm that this patch fixes it?
Yes, this patch seems to fix it. Thanks.
Cheers,
Sebastian
--
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/
Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: Solaris install error: didn't get git-init link was [Fwd: Re: The Reposithon! Take 2]
From: Andre Noll @ 2007-12-17 15:18 UTC (permalink / raw)
To: Sam Vilain; +Cc: Git Mailing List
In-Reply-To: <47668ABB.9000504@vilain.net>
[-- Attachment #1: Type: text/plain, Size: 296 bytes --]
On 03:42, Sam Vilain wrote:
> Refer attached ... 1.5.3.6 install, didn't get git-init link to git.
> Ring any bells?
/usr/sbin/install does not accept all options that git's "make install"
is using?
Andre
--
The only person who always got his work done by Friday was Robinson Crusoe
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [BUG?] git rebase -i
From: Pieter de Bie @ 2007-12-17 16:04 UTC (permalink / raw)
To: Johannes Sixt, git
In-Reply-To: <47623129.2030303@viscovery.net>
Hi,
On Dec 14, 2007, at 8:30 AM, Johannes Sixt wrote:
> Pieter de Bie schrieb:
>> Another thing to note is
>> that the 1.5.4.rc0 tries to apply 215 patches, while the 1.5.3.5
>> tries
>> to apply 206 patches.
>
> This is to be expected: 1.5.3.5 counts the comment lines at the top
> of the
> action file, of which there are exactly 9, 1.5.4.rc0 does not count
> them.
>
Ok, but what about the error in the rebase?
On Dec 14, 2007, at 2:21 AM, Pieter de Bie wrote:
> Tirana:~/git pieter$ time git rebase -p -i HEAD~100
> cat: /Users/pieter/git/.git/.dotest-merge/rewritten/
> 1e8df762b38e01685f3aa3613e2d61f73346fcbe: No such file or directory
- Pieter
^ permalink raw reply
* Re: Solaris install error: didn't get git-init link was [Fwd: Re: The Reposithon! Take 2]
From: Jeff King @ 2007-12-17 16:07 UTC (permalink / raw)
To: Andre Noll; +Cc: Sam Vilain, Git Mailing List
In-Reply-To: <20071217151829.GP32704@skl-net.de>
On Mon, Dec 17, 2007 at 04:18:29PM +0100, Andre Noll wrote:
> > Refer attached ... 1.5.3.6 install, didn't get git-init link to git.
> > Ring any bells?
>
> /usr/sbin/install does not accept all options that git's "make install"
> is using?
/usr/sbin/install doesn't seem to work at all on Solaris. Using
/usr/ucb/install does correctly create the hardlinks.
-Peff
^ permalink raw reply
* Re: [RFH] convert shortlog to use parse_options
From: Kristian Høgsberg @ 2007-12-17 16:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Andreas Ericsson, Pierre Habouzit, Jeff King, git
In-Reply-To: <7v3au1eopr.fsf@gitster.siamese.dyndns.org>
On Sun, 2007-12-16 at 23:59 -0800, Junio C Hamano wrote:
> Andreas Ericsson <ae@op5.se> writes:
>
> > Junio C Hamano wrote:
> >
> >> ... The
> >> "must stick" restriction feels Ok on paper but in practice it looks
> >> rather draconian and very user unfriendly.
> >
> > Usually, optional arguments warrant adding a second parameter. This can
> > often even improve usability, as it's never unclear or ambiguous what's
> > happening. For the 'git tag -l' case, I'd use something like
> > 'git tag -l --match="regex"' or some such,...
>
> That is essentially arguing for POSIXly correct "do not allow optional
> option-arguments" (utility syntax guidelines #7). That position might
> be politically correct, but I am already discussing beyond that:
> usability.
>
> For "git tag -l", the fix was rather simple, as the option would either
> have taken a zero pattern (list all) or a single pattern (list matching
> this pattern), and the command itself did not take any extra arguments,
> so that was what I did in the patch. Compare your POSIXly correct
> version:
>
> git tag -l (ok)
> git tag -l pattern (not ok)
> git tag -l --match=pattern (ok)
>
> with the traditional (and fixed):
>
> git tag -l (ok)
> git tag -l pattern (ok)
> git tag -l pattern garbage (not ok)
>
> Which one is easier for the user?
git tag now lists tags by default so there's a couple of other options
to consider:
git tag (ok)
git tag --match pattern (ok)
git tag --match=pattern (ok)
git tag --match=pattern -l (ok)
git tag -l pattern (not ok)
Or we could repurpose -l as the match option:
git tag (ok)
git tag -l (not ok)
git tag -l pattern (ok)
And that was the point I was trying to make earlier with my rather
abstract sounding post about jumping through hoops. If we can't break
the options interface to make git sane, we'll be stuck with a broken
command line interface and must write complicated documents on what option
sticking is and how it works.
cheers,
Kristian
^ permalink raw reply
* Re: [PATCH] Have a flag to stop the option parsing at the first argument.
From: Pierre Habouzit @ 2007-12-17 16:29 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Wincent Colaiuta, Johannes Schindelin, Junio C Hamano, git
In-Reply-To: <47669234.7020202@viscovery.net>
[-- Attachment #1: Type: text/plain, Size: 958 bytes --]
On Mon, Dec 17, 2007 at 03:13:56PM +0000, Johannes Sixt wrote:
> Wincent Colaiuta schrieb:
> > But leaving -p aside, will you oppose any patches that make it possible
> > for people to write stuff like:
> >
> > git init --bare
> >
> > Personally, I think this is an obvious usability improvement worth
> > striving for. Given that "git --bare init" will continue to work under
> > what I'm proposing, I really can't see any worthwhile argument against
> > it. Because we're talking about a UI improvement for newcomers at no
> > cost to old timers.
>
> Your point. I hate to have to think hard each time whether it's "git --bare
> init" or "git init --bare" and "git clone --bare" or "git --bare clone" and
> wouldn't mind if I no longer needed to.
Seconded.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: Post-1.5.4 stuff: builtin-checkout
From: Kristian Høgsberg @ 2007-12-17 16:30 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0712151529300.5349@iabervon.org>
On Sat, 2007-12-15 at 15:44 -0500, Daniel Barkalow wrote:
> I've got my builtin-checkout implementation at:
>
> git://iabervon.org/~barkalow/git.git builtin-checkout
>
> This may be interesting to some other people at this point, despite it not
> being relevant to 1.5.4, because (a) it includes a slew of small
> preliminary patches to other stuff that might be useful for making other
> things builtin and (b) these changes reflect my debugging of my naive
> implementation of builtin-checkout, and may suggest things that might be
> wrong in existing builtins that do multiple operations in the same
> process.
Thanks, fetching it now.
Kristian
^ permalink raw reply
* Re: add -i not able to find get_colorbool
From: Johannes Schindelin @ 2007-12-17 16:43 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20071217143100.GA21122@coredump.intra.peff.net>
Hi,
On Mon, 17 Dec 2007, Jeff King wrote:
> On Mon, Dec 17, 2007 at 02:04:21PM +0000, Johannes Schindelin wrote:
>
> > The second line of git-add--interactive reads thusly:
> >
> > use lib (split(/:/, $ENV{GITPERLLIB} ||
> > "/home/gitte/lib/perl5/site_perl/5.8.8"));
> >
> > and this puzzles me:
> >
> > $ grep -n get_colorbool /home/gitte/lib/perl5/site_perl/5.8.8/Git.pm
> > 584:=item get_colorbool ( NAME )
> > 591:sub get_colorbool {
> >
> > So it has it, but cannot locate get_colorbool?
>
> That does seem odd. Can you try running git-add--interactive in the perl
> debugger and doing this:
>
> x \&Git::get_colorbool
> x \&Git::repository
>
> It should tell you where it is getting the functions from (in the first
> case, it will presumably not find it at all, but you seem to have a
> Git::repository, so it should point to the file that has been loaded).
Good call!
main::(/home/gitte/bin/git-add--interactive:8):
8: my ($prompt_color, $header_color, $help_color, $normal_color);
DB<1> x \&Git::get_colorbool
0 CODE(0x853b25c)
-> &CODE(0x853b25c) in ???
DB<2> x \&Git::repository
0 CODE(0x833e8ac)
-> &Git::repository in
/home/gitte/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi/Git.pm:145-217
So it seems that somehow on 8. Nov 10:42 Git.pm was installed into
i586-linux-thread-multi/ and is preferred over the Git.pm which was
installed on 6. Dec 12:24 into site_perl/5.8.8/.
I have no idea how that happened on Nov 8, could be that I was desperate
enough to hand-copy Git.pm there. Git.pm seems to hate me (this was not
the first time I had problems with it).
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Fix config lockfile handling.
From: Kristian Høgsberg @ 2007-12-17 16:24 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vfxy5os60.fsf@gitster.siamese.dyndns.org>
On Fri, 2007-12-14 at 13:57 -0800, Junio C Hamano wrote:
> Kristian Høgsberg <krh@redhat.com> writes:
>
> > When we commit or roll back the lock file the fd is automatically closed,
> > so don't do that again.
>
> With your change, we do not check the return status from close(2)
> anymore, which means that we may have run out of diskspace without
> noticing and renamed the incomplete file into the real place. Oops?
You're right of course. Ok, so lets just stick with the current config
file handling for 1.5.4, it's not seriously broken.
Kristian
^ permalink raw reply
* [PATCH] rebase -p -i: handle "no changes" gracefully
From: Johannes Schindelin @ 2007-12-17 16:59 UTC (permalink / raw)
To: Pieter de Bie; +Cc: Johannes Sixt, git, gitster
In-Reply-To: <9CC305E7-3325-4D17-A43E-0A2072F52084@ai.rug.nl>
Since commit 376ccb8cbb453343998e734d8a1ce79f57a4e092, unchanged
SHA-1s are no longer mapped via $REWRITTEN. But the updating
phase was not prepared for the old head not being rewritten.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
On Mon, 17 Dec 2007, Pieter de Bie wrote:
> Ok, but what about the error in the rebase?
>
> On Dec 14, 2007, at 2:21 AM, Pieter de Bie wrote:
> > Tirana:~/git pieter$ time git rebase -p -i HEAD~100
> > cat:
> > /Users/pieter/git/.git/.dotest-merge/rewritten/1e8df762b38e01685f3aa3613e2d61f73346fcbe:
> > No such file or directory
This buglet was not caught earlier, probably because a
non-rewriting rebase is not really interesting ;-)
git-rebase--interactive.sh | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index f83e00f..cd7e43f 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -322,7 +322,12 @@ do_next () {
test -f "$DOTEST"/current-commit &&
current_commit=$(cat "$DOTEST"/current-commit) &&
git rev-parse HEAD > "$REWRITTEN"/$current_commit
- NEWHEAD=$(cat "$REWRITTEN"/$OLDHEAD)
+ if test -f "$REWRITTEN"/$OLDHEAD
+ then
+ NEWHEAD=$(cat "$REWRITTEN"/$OLDHEAD)
+ else
+ NEWHEAD=$OLDHEAD
+ fi
else
NEWHEAD=$(git rev-parse HEAD)
fi &&
--
1.5.4.rc0.59.g1d10d
^ permalink raw reply related
* Re: Failed to clone http://repo.or.cz/w/msysgit.git
From: Johannes Schindelin @ 2007-12-17 17:06 UTC (permalink / raw)
To: Abdelrazak Younes
Cc: msysgit-/JYPxA39Uh5TLH3MbocFFw, git-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <fk5u4d$j9b$1@ger.gmane.org>
Hi,
[please do not cull me from the Cc: list when you reply to me. This is
like replying to me, but talking away from me (to the public).]
On Mon, 17 Dec 2007, Abdelrazak Younes wrote:
> Johannes Schindelin wrote:
> >
> > On Mon, 17 Dec 2007, Abdelrazak Younes wrote:
> >
> > > I am trying to clone the msysgit repository but I get this error:
> > >
> > > $ git clone http://repo.or.cz/w/msysgit.git
> > > Initialized empty Git repository in d:/devel/git/msysgit/.git/
> > > D:/program/Git/bin/git-clone: line 144: /bin/git-http-fetch: Bad file
> > > number
Okay, I get the same error here. Fishy. But then, this is not the
correct URL either (so I think Peff's patch probably fixes it).
What you tried is the gitweb URL, which explicitely says
Mirror URL git://repo.or.cz/msysgit.git
http://repo.or.cz/r/msysgit.git
IOW replace your "/w/" by "/r/" and have fun,
Dscho
^ permalink raw reply
* Question about git-svn import
From: Pascal Obry @ 2007-12-17 17:18 UTC (permalink / raw)
To: git list
Hi,
You'll find a script into this message that reproduce what I'll describe
below. Basically the Subversion repository add a given structure in the
past then rearranged to use the "standard" structure. The former
structure was:
<root>
|
| - dir1
| - dir2
The new one is:
<root>
|
|- trunk
| | - dir1
| | - dir2
|- branches
|- tags
Now I want to import this project into Git (using git-svn) as the
project won't leave Subversion for the moment. When doing:
$ git svn clone -s <repo> <git-repo>
In git-repo we get only the commits done inside <root>/trunk and not the
commits done in the former repository.
The question is what is the best way to deal with such a case with git-svn ?
Thanks.
############################ CUT HERE #############################
#!/bin/sh
REP=file://$(pwd)/repo
rm -fr repo co-repo git-repo
svnadmin create repo
svn co $REP co-repo
cd co-repo
mkdir dir
echo file1 > dir/file1
svn add dir dir/file1
svn ci -m "ci1" dir dir/file1
svn mkdir -m "create trunk" $REP/trunk
svn mkdir -m "create branches" $REP/branches
svn mkdir -m "create tags" $REP/tags
svn move -m "move dir under trunk" $REP/dir $REP/trunk/dir
svn update
sleep 2
echo file1 >> trunk/dir/file1
svn ci -m "ci2" trunk/dir/file1
sleep 2
svn update
cd ..
git svn clone -s $REP git-repo
############################ CUT HERE #############################
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
^ permalink raw reply
* Re: Failed to clone http://repo.or.cz/w/msysgit.git
From: Abdelrazak Younes @ 2007-12-17 17:40 UTC (permalink / raw)
To: msysgit-/JYPxA39Uh5TLH3MbocFFw; +Cc: git-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <Pine.LNX.4.64.0712171702360.9446-OGWIkrnhIhzN0uC3ymp8PA@public.gmane.org>
Johannes Schindelin wrote:
> Hi,
>
> [please do not cull me from the Cc: list when you reply to me. This is
> like replying to me, but talking away from me (to the public).]
Sorry, I am afraid I cannot do that right now because I use the gmane
news interface and I don't have access to my smtp from here. If it is
too irritating I'll wait up until I go back home before I answer. In any
case, sorry for the inconvenience.
>
> On Mon, 17 Dec 2007, Abdelrazak Younes wrote:
>
>> Johannes Schindelin wrote:
>>> On Mon, 17 Dec 2007, Abdelrazak Younes wrote:
>>>
>>>> I am trying to clone the msysgit repository but I get this error:
>>>>
>>>> $ git clone http://repo.or.cz/w/msysgit.git
>>>> Initialized empty Git repository in d:/devel/git/msysgit/.git/
>>>> D:/program/Git/bin/git-clone: line 144: /bin/git-http-fetch: Bad file
>>>> number
>
> Okay, I get the same error here. Fishy. But then, this is not the
> correct URL either (so I think Peff's patch probably fixes it).
>
> What you tried is the gitweb URL, which explicitely says
>
> Mirror URL git://repo.or.cz/msysgit.git
>
> http://repo.or.cz/r/msysgit.git
>
> IOW replace your "/w/" by "/r/" and have fun,
Yes, it works! Thanks and sorry for the mixup, I just copied and pasted
the link without thinking.
Abdel.
^ permalink raw reply
* Re: [PATCH] Re-re-re-fix common tail optimization
From: Junio C Hamano @ 2007-12-17 17:58 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Johannes Sixt, Wincent Colaiuta, Jeff King, Linus Torvalds, git
In-Reply-To: <Pine.LNX.4.64.0712171250550.9446@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> >> But as at least one released version of GNU diff has a pretty serious
>> >> bug,
>> >> I would rather not rely too much on diff. (BTW this was the reason I
>> >> wanted --no-index so badly.)
>> >>
>> >> So yeah, the second "diff" cannot be "git diff". Maybe "cmp", but not
>> >> "git diff".
>> >
>> > Well cmp would be fine as well, seeing all we want is a boolean "is
>> > this the same or not" answer. (I'm not familiar with the GNU diff bug
>> > you speak of, but was it so bad that it couldn't even get *that*
>> > answer right?)
>>
>> Heh, there's at least one distribution out there (Suse 10.1) that comes
>> with a *cmp* that doesn't get that answer right if its output is
>> connected to /dev/null, which is the case when you simply 'make test'.
>
> Yeah. That's what it was. I even posted a patch to GNU diff, only to
> find out that it was already fixed in CVS. Sigh.
Wait. Are you still talking about diff or cmp, or are you saying that
your earlier statement about avoiding GNU diff due to its bugs is
unfounded?
^ permalink raw reply
* Re: The Reposithon! Take 2 [URL FIX]
From: Junio C Hamano @ 2007-12-17 18:00 UTC (permalink / raw)
To: Sam Vilain; +Cc: Nicholas Clark, Perl 5 Porters, Git Mailing List
In-Reply-To: <476664EB.5030500@vilain.net>
Sam Vilain <sam@vilain.net> writes:
> The error message isn't the best, no.
>
> Junio, any chance of this going in?
Looks innocuous and an obvious improvement to me.
^ permalink raw reply
* Re: The Reposithon! Take 2 [URL FIX]
From: Nicholas Clark @ 2007-12-17 18:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Sam Vilain, Perl 5 Porters, Git Mailing List
In-Reply-To: <7vmys98ali.fsf@gitster.siamese.dyndns.org>
On Mon, Dec 17, 2007 at 10:00:57AM -0800, Junio C Hamano wrote:
> Sam Vilain <sam@vilain.net> writes:
>
> > The error message isn't the best, no.
> >
> > Junio, any chance of this going in?
>
> Looks innocuous and an obvious improvement to me.
Cool. Thanks to you both for addressing this concern of mine so rapidly.
Nicholas Clark
^ permalink raw reply
* Re: [PATCH] Re-re-re-fix common tail optimization
From: Johannes Schindelin @ 2007-12-17 18:05 UTC (permalink / raw)
To: Junio C Hamano
Cc: Johannes Sixt, Wincent Colaiuta, Jeff King, Linus Torvalds, git
In-Reply-To: <7vsl218aqd.fsf@gitster.siamese.dyndns.org>
Hi,
On Mon, 17 Dec 2007, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> >> >> But as at least one released version of GNU diff has a pretty
> >> >> serious bug, I would rather not rely too much on diff. (BTW this
> >> >> was the reason I wanted --no-index so badly.)
> >> >>
> >> >> So yeah, the second "diff" cannot be "git diff". Maybe "cmp", but
> >> >> not "git diff".
> >> >
> >> > Well cmp would be fine as well, seeing all we want is a boolean "is
> >> > this the same or not" answer. (I'm not familiar with the GNU diff
> >> > bug you speak of, but was it so bad that it couldn't even get
> >> > *that* answer right?)
> >>
> >> Heh, there's at least one distribution out there (Suse 10.1) that
> >> comes with a *cmp* that doesn't get that answer right if its output
> >> is connected to /dev/null, which is the case when you simply 'make
> >> test'.
> >
> > Yeah. That's what it was. I even posted a patch to GNU diff, only to
> > find out that it was already fixed in CVS. Sigh.
>
> Wait. Are you still talking about diff or cmp, or are you saying that
> your earlier statement about avoiding GNU diff due to its bugs is
> unfounded?
I do not remember offhand. I only remembered that it was the GNU diff
package. But maybe it was only the "cmp" tool. Symptoms were that tests
were failing without "-i", but succeeding with "-i".
Okay, I found the mail:
http://article.gmane.org/gmane.comp.version-control.git/25107/match=cmp
Seems it was only "cmp".
Sorry for the noise,
Dscho
^ permalink raw reply
* [PATCH] the use of 'tr' in the test suite isn't really portable
From: H.Merijn Brand @ 2007-12-17 18:15 UTC (permalink / raw)
To: git
Some versions of 'tr' only accept octal codes if entered with three digits,
and therefor misinterpret the '\0' in the test suite.
Some versions of 'tr' reject the (needless) use of character classes.
Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
---
diff -pur git-2007-12-10_01/git-filter-branch.sh git-2007-12-10/git-filter-branch.sh
--- git-2007-12-10_01/git-filter-branch.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/git-filter-branch.sh 2007-12-11 13:39:02 +0100
@@ -290,7 +290,7 @@ while read commit parents; do
eval "$filter_tree" < /dev/null ||
die "tree filter failed: $filter_tree"
- git diff-index -r $commit | cut -f 2- | tr '\n' '\0' | \
+ git diff-index -r $commit | cut -f 2- | tr '\n' '\000' | \
xargs -0 git update-index --add --replace --remove
git ls-files -z --others | \
xargs -0 git update-index --add --replace --remove
diff -pur git-2007-12-10_01/t/diff-lib.sh git-2007-12-10/t/diff-lib.sh
--- git-2007-12-10_01/t/diff-lib.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/t/diff-lib.sh 2007-12-11 13:39:56 +0100
@@ -21,8 +21,8 @@ compare_diff_raw_z () {
# Also we do not check SHA1 hash generation in this test, which
# is a job for t0000-basic.sh
- tr '\0' '\012' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
- tr '\0' '\012' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
+ tr '\000' '\012' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
+ tr '\000' '\012' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
git diff .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
}
diff -pur git-2007-12-10_01/t/t0020-crlf.sh git-2007-12-10/t/t0020-crlf.sh
--- git-2007-12-10_01/t/t0020-crlf.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/t/t0020-crlf.sh 2007-12-10 14:25:58 +0100
@@ -5,7 +5,7 @@ test_description='CRLF conversion'
. ./test-lib.sh
q_to_nul () {
- tr Q '\0'
+ tr Q '\000'
}
append_cr () {
diff -pur git-2007-12-10_01/t/t1300-repo-config.sh git-2007-12-10/t/t1300-repo-config.sh
--- git-2007-12-10_01/t/t1300-repo-config.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/t/t1300-repo-config.sh 2007-12-10 09:49:48 +0100
@@ -591,12 +591,12 @@ Qsection.sub=section.val4
Qsection.sub=section.val5Q
EOF
-git config --null --list | tr '[\000]' 'Q' > result
+git config --null --list | tr '\000' 'Q' > result
echo >>result
test_expect_success '--null --list' 'cmp result expect'
-git config --null --get-regexp 'val[0-9]' | tr '[\000]' 'Q' > result
+git config --null --get-regexp 'val[0-9]' | tr '\000' 'Q' > result
echo >>result
test_expect_success '--null --get-regexp' 'cmp result expect'
diff -pur git-2007-12-10_01/t/t3300-funny-names.sh git-2007-12-10/t/t3300-funny-names.sh
--- git-2007-12-10_01/t/t3300-funny-names.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/t/t3300-funny-names.sh 2007-12-11 13:40:32 +0100
@@ -54,7 +54,7 @@ echo 'just space
no-funny
tabs ," (dq) and spaces' >expected
test_expect_success 'git ls-files -z with-funny' \
- 'git ls-files -z | tr \\0 \\012 >current &&
+ 'git ls-files -z | tr \\000 \\012 >current &&
git diff expected current'
t1=`git write-tree`
@@ -83,11 +83,11 @@ test_expect_success 'git diff-tree with-
echo 'A
tabs ," (dq) and spaces' >expected
test_expect_success 'git diff-index -z with-funny' \
- 'git diff-index -z --name-status $t0 | tr \\0 \\012 >current &&
+ 'git diff-index -z --name-status $t0 | tr \\000 \\012 >current &&
git diff expected current'
test_expect_success 'git diff-tree -z with-funny' \
- 'git diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current &&
+ 'git diff-tree -z --name-status $t0 $t1 | tr \\000 \\012 >current &&
git diff expected current'
cat > expected <<\EOF
diff -pur git-2007-12-10_01/t/t4020-diff-external.sh git-2007-12-10/t/t4020-diff-external.sh
--- git-2007-12-10_01/t/t4020-diff-external.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/t/t4020-diff-external.sh 2007-12-11 13:40:44 +0100
@@ -99,7 +99,7 @@ test_expect_success 'no diff with -diff'
git diff | grep Binary
'
-echo NULZbetweenZwords | tr Z '\0' > file
+echo NULZbetweenZwords | tr Z '\000' > file
test_expect_success 'force diff with "diff"' '
echo >.gitattributes "file diff" &&
diff -pur git-2007-12-10_01/t/t4103-apply-binary.sh git-2007-12-10/t/t4103-apply-binary.sh
--- git-2007-12-10_01/t/t4103-apply-binary.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/t/t4103-apply-binary.sh 2007-12-11 13:40:57 +0100
@@ -24,10 +24,10 @@ git update-index --add --remove file1 fi
git-commit -m 'Initial Version' 2>/dev/null
git-checkout -b binary
-tr 'x' '\0' <file1 >file3
+tr 'x' '\000' <file1 >file3
cat file3 >file4
git add file2
-tr '\0' 'v' <file3 >file1
+tr '\000' 'v' <file3 >file1
rm -f file2
git update-index --add --remove file1 file2 file3 file4
git-commit -m 'Second Version'
diff -pur git-2007-12-10_01/t/t4116-apply-reverse.sh git-2007-12-10/t/t4116-apply-reverse.sh
--- git-2007-12-10_01/t/t4116-apply-reverse.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/t/t4116-apply-reverse.sh 2007-12-11 13:42:13 +0100
@@ -12,14 +12,14 @@ test_description='git apply in reverse
test_expect_success setup '
for i in a b c d e f g h i j k l m n; do echo $i; done >file1 &&
- tr "[ijk]" '\''[\0\1\2]'\'' <file1 >file2 &&
+ tr "ijk" '\''\000\001\002'\'' <file1 >file2 &&
git add file1 file2 &&
git commit -m initial &&
git tag initial &&
for i in a b c g h i J K L m o n p q; do echo $i; done >file1 &&
- tr "[mon]" '\''[\0\1\2]'\'' <file1 >file2 &&
+ tr "mon" '\''\000\001\002'\'' <file1 >file2 &&
git commit -a -m second &&
git tag second &&
diff -pur git-2007-12-10_01/t/t4200-rerere.sh git-2007-12-10/t/t4200-rerere.sh
--- git-2007-12-10_01/t/t4200-rerere.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/t/t4200-rerere.sh 2007-12-11 13:42:28 +0100
@@ -129,7 +129,7 @@ test_expect_success 'rerere kicked in' "
test_expect_success 'rerere prefers first change' 'git diff a1 expect'
rm $rr/postimage
-echo "$sha1 a1" | tr '\012' '\0' > .git/rr-cache/MERGE_RR
+echo "$sha1 a1" | tr '\012' '\000' > .git/rr-cache/MERGE_RR
test_expect_success 'rerere clear' 'git rerere clear'
diff -pur git-2007-12-10_01/t/t5300-pack-object.sh git-2007-12-10/t/t5300-pack-object.sh
--- git-2007-12-10_01/t/t5300-pack-object.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/t/t5300-pack-object.sh 2007-12-11 13:42:46 +0100
@@ -15,7 +15,7 @@ test_expect_success \
'rm -f .git/index*
for i in a b c
do
- dd if=/dev/zero bs=4k count=1 | tr "\\0" $i >$i &&
+ dd if=/dev/zero bs=4k count=1 | tr "\\000" $i >$i &&
git update-index --add $i || return 1
done &&
cat c >d && echo foo >>d && git update-index --add d &&
diff -pur git-2007-12-10_01/test-sha1.sh git-2007-12-10/test-sha1.sh
--- git-2007-12-10_01/test-sha1.sh 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/test-sha1.sh 2007-12-11 13:39:29 +0100
@@ -10,7 +10,7 @@ do
{
test -z "$pfx" || echo "$pfx"
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
- tr '[\0]' '[g]'
+ tr '\000' 'g'
} | ./test-sha1 $cnt
`
if test "$expect" = "$actual"
@@ -55,7 +55,7 @@ do
{
test -z "$pfx" || echo "$pfx"
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
- tr '[\0]' '[g]'
+ tr '\000' 'g'
} | sha1sum |
sed -e 's/ .*//'
`
--
git-2007-12-17
--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin. http://qa.perl.org
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
http://www.goldmark.org/jeff/stupid-disclaimers/
^ permalink raw reply
* [PATCH] HP-UX does not have select.h
From: H.Merijn Brand @ 2007-12-17 18:23 UTC (permalink / raw)
To: git
HP-UX does not have select.h, but it offers all select () functionality.
The defines are in <sys/types.h> and <X11/fd.h>
Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
---
diff -pur git-2007-12-10_01/git-compat-util.h git-2007-12-10/git-compat-util.h
--- git-2007-12-10_01/git-compat-util.h 2007-12-09 10:23:48 +0100
+++ git-2007-12-10/git-compat-util.h 2007-12-10 14:25:26 +0100
@@ -68,7 +68,9 @@
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#ifndef _HPUX_SOURCE
#include <sys/select.h>
+#endif
#include <assert.h>
#include <regex.h>
#include <netinet/in.h>
--
git-2007-12-17
--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin. http://qa.perl.org
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
http://www.goldmark.org/jeff/stupid-disclaimers/
^ permalink raw reply
* [PATCH 2/7] parse-options: allow callbacks to ignore arguments they don't need to use.
From: Pierre Habouzit @ 2007-12-17 18:23 UTC (permalink / raw)
To: gitster; +Cc: git, Pierre Habouzit
In-Reply-To: <1197915797-30679-2-git-send-email-madcoder@debian.org>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
parse-options.c | 22 +++++++++++++++-------
parse-options.h | 7 +++++++
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/parse-options.c b/parse-options.c
index 8f70e5d..d716ccc 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -38,7 +38,10 @@ static int get_value(struct optparse_t *p,
{
const char *s, *arg;
const int unset = flags & PARSE_OPT_UNSET;
+ int may_ign = 0, res;
+ if (!unset && !p->opt && (opt->flags & PARSE_OPT_OPTARG))
+ may_ign = PARSE_OPT_MAY_IGN;
if (unset && p->opt)
return opterror(opt, "takes no value", flags);
if (unset && (opt->flags & PARSE_OPT_NONEG))
@@ -86,7 +89,7 @@ static int get_value(struct optparse_t *p,
*(const char **)opt->value = NULL;
return 0;
}
- if (opt->flags & PARSE_OPT_OPTARG && (!arg || *arg == '-')) {
+ if (may_ign && (!arg || *arg == '-')) {
*(const char **)opt->value = (const char *)opt->defval;
return 0;
}
@@ -98,18 +101,23 @@ static int get_value(struct optparse_t *p,
case OPTION_CALLBACK:
if (unset || (opt->flags & PARSE_OPT_NOARG))
return (*opt->callback)(opt, NULL, flags);
- if (opt->flags & PARSE_OPT_OPTARG && (!arg || *arg == '-'))
- return (*opt->callback)(opt, NULL, flags);
- if (!arg)
+ if (!may_ign && !arg)
return opterror(opt, "requires a value", flags);
- return (*opt->callback)(opt, get_arg(p), flags);
+ if (may_ign && arg && arg[0] == '-' && arg[1])
+ return (*opt->callback)(opt, NULL, flags);
+ res = (*opt->callback)(opt, arg, flags);
+ if (!may_ign && res == PARSE_OPT_IGNORE)
+ die("should not happen: MAY_IGN unset, but arg was IGNOREd");
+ if (res == PARSE_OPT_IGNORE)
+ get_arg(p);
+ return res;
case OPTION_INTEGER:
if (unset) {
*(int *)opt->value = 0;
return 0;
}
- if (opt->flags & PARSE_OPT_OPTARG && (!arg || !isdigit(*arg))) {
+ if (may_ign && (!arg || !isdigit(*arg))) {
*(int *)opt->value = opt->defval;
return 0;
}
@@ -251,7 +259,7 @@ int parse_options(int argc, const char **argv, const struct option *options,
usage_with_options_internal(usagestr, options, 1);
if (!strcmp(arg + 2, "help"))
usage_with_options(usagestr, options);
- if (parse_long_opt(&args, arg + 2, options))
+ if (parse_long_opt(&args, arg + 2, options) < 0)
usage_with_options(usagestr, options);
}
diff --git a/parse-options.h b/parse-options.h
index ae6b3ca..eeb40a4 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -27,9 +27,16 @@ enum parse_opt_option_flags {
PARSE_OPT_HIDDEN = 8,
};
+enum parse_opt_cbres {
+ PARSE_OPT_ERR = -1,
+ PARSE_OPT_OK = 0,
+ PARSE_OPT_IGNORE = 1,
+};
+
enum parse_opt_cbflags {
PARSE_OPT_SHORT = 1,
PARSE_OPT_UNSET = 2,
+ PARSE_OPT_MAY_IGN = 4,
};
struct option;
--
1.5.4.rc0.1148.ga3ab1-dirty
^ permalink raw reply related
* [proposal] make parse-options nicer wrt optional arguments (supersedes all my recent posts on the matter)
From: Pierre Habouzit @ 2007-12-17 18:23 UTC (permalink / raw)
To: gitster; +Cc: git
Here is a series that aims at fixing the various issues with
parse-options that were raised recently.
* preliminary patch:
[PATCH 1/7] parse-options: Make callbacks take flags instead of boolean `unset`
* teach git parse-options to allow callbacks to ignore arguments that
don't seem to be theirs, refactors:
[PATCH 2/7] parse-options: allow callbacks to ignore arguments they don't need to use.
[PATCH 3/7] parse-options: Let the integer/string cases be callbacks as well.
[PATCH 4/7] parse-options: let OPT__ABBREV ignore arguments.
* Document this (my previous proposal + Junio's squashed):
[PATCH 5/7] parse-options: Add a gitcli(5) man page.
* Implement my `{}` proposal, a sed -e s/{}/_/ will replace {} with _
as a wildcard. Contains documentation for this placeholder.
[PATCH 6/7] parse-options: have a `use default value` wildcard.
* Somehow unrelated patch, but still parse-option related (resend):
[PATCH 7/7] git-tag: fix -l switch handling regression.
This has been pushed as my ph/parseopt branch on
git://git.madism.org/git.git.
^ permalink raw reply
* [PATCH 4/7] parse-options: let OPT__ABBREV ignore arguments.
From: Pierre Habouzit @ 2007-12-17 18:23 UTC (permalink / raw)
To: gitster; +Cc: git, Pierre Habouzit
In-Reply-To: <1197915797-30679-4-git-send-email-madcoder@debian.org>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
parse-options.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/parse-options.c b/parse-options.c
index f3f0f2a..679a963 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -359,19 +359,21 @@ void usage_with_options(const char * const *usagestr,
int parse_opt_abbrev_cb(const struct option *opt, const char *arg, int flags)
{
- int v;
-
- if (!arg) {
- v = flags & PARSE_OPT_UNSET ? 0 : DEFAULT_ABBREV;
- } else {
+ int v = flags & PARSE_OPT_UNSET ? 0 : DEFAULT_ABBREV;
+ if (arg) {
v = strtol(arg, (char **)&arg, 10);
- if (*arg)
+ if (*arg) {
+ if (flags & PARSE_OPT_MAY_IGN) {
+ *(int *)opt->value = DEFAULT_ABBREV;
+ return PARSE_OPT_IGNORE;
+ }
return opterror(opt, "expects a numerical value", 0);
+ }
if (v && v < MINIMUM_ABBREV)
v = MINIMUM_ABBREV;
else if (v > 40)
v = 40;
}
- *(int *)(opt->value) = v;
+ *(int *)opt->value = v;
return 0;
}
--
1.5.4.rc0.1148.ga3ab1-dirty
^ permalink raw reply related
* [PATCH 3/7] parse-options: Let the integer/string cases be callbacks as well.
From: Pierre Habouzit @ 2007-12-17 18:23 UTC (permalink / raw)
To: gitster; +Cc: git, Pierre Habouzit
In-Reply-To: <1197915797-30679-3-git-send-email-madcoder@debian.org>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
parse-options.c | 115 ++++++++++++++++++++++++++++---------------------------
1 files changed, 59 insertions(+), 56 deletions(-)
diff --git a/parse-options.c b/parse-options.c
index d716ccc..f3f0f2a 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -7,15 +7,14 @@ struct optparse_t {
const char *opt;
};
-static inline const char *get_arg(struct optparse_t *p)
+static inline void use_arg(struct optparse_t *p)
{
if (p->opt) {
- const char *res = p->opt;
p->opt = NULL;
- return res;
+ } else {
+ p->argc--;
+ ++p->argv;
}
- p->argc--;
- return *++p->argv;
}
static inline const char *skip_prefix(const char *str, const char *prefix)
@@ -33,15 +32,62 @@ static int opterror(const struct option *opt, const char *reason, int flags)
return error("option `%s' %s", opt->long_name, reason);
}
+static int parse_opt_string(const struct option *opt,
+ const char *arg, int flags)
+{
+ *(const char **)opt->value = flags & PARSE_OPT_UNSET ? NULL : arg;
+ return 0;
+}
+
+static int parse_opt_integer(const struct option *opt,
+ const char *arg, int flags)
+{
+ int v = flags & PARSE_OPT_UNSET ? 0 : opt->defval;
+ if (arg) {
+ v = strtol(arg, (char **)&arg, 10);
+ if (*arg) {
+ if (flags & PARSE_OPT_MAY_IGN) {
+ *(int *)opt->value = opt->defval;
+ return PARSE_OPT_IGNORE;
+ }
+ return opterror(opt, "expects a numerical value", 0);
+ }
+ }
+ *(int *)opt->value = v;
+ return 0;
+}
+
+static int run_callback(struct optparse_t *p, parse_opt_cb *cb,
+ const struct option *opt, int flags)
+{
+ const char *arg = p->opt ? p->opt : (p->argc > 1 ? p->argv[1] : NULL);
+ int may_ign = 0;
+
+ if (!p->opt && (opt->flags & PARSE_OPT_OPTARG))
+ may_ign = PARSE_OPT_MAY_IGN;
+ if ((flags & PARSE_OPT_UNSET) || (opt->flags & PARSE_OPT_NOARG))
+ return (*cb)(opt, NULL, flags);
+ if (!may_ign && !arg)
+ return opterror(opt, "requires a value", flags);
+ if (may_ign && arg && arg[0] == '-' && arg[1])
+ return (*cb)(opt, NULL, flags);
+ switch ((*cb)(opt, arg, flags | may_ign)) {
+ case PARSE_OPT_OK:
+ use_arg(p);
+ return PARSE_OPT_OK;
+ case PARSE_OPT_IGNORE:
+ if (!may_ign)
+ die("should not happen: MAY_IGN unset, but arg was IGNOREd");
+ return PARSE_OPT_IGNORE;
+ default:
+ return PARSE_OPT_ERR;
+ }
+}
+
static int get_value(struct optparse_t *p,
const struct option *opt, int flags)
{
- const char *s, *arg;
const int unset = flags & PARSE_OPT_UNSET;
- int may_ign = 0, res;
-
- if (!unset && !p->opt && (opt->flags & PARSE_OPT_OPTARG))
- may_ign = PARSE_OPT_MAY_IGN;
if (unset && p->opt)
return opterror(opt, "takes no value", flags);
if (unset && (opt->flags & PARSE_OPT_NONEG))
@@ -63,7 +109,6 @@ static int get_value(struct optparse_t *p,
}
}
- arg = p->opt ? p->opt : (p->argc > 1 ? p->argv[1] : NULL);
switch (opt->type) {
case OPTION_BIT:
if (unset)
@@ -71,63 +116,21 @@ static int get_value(struct optparse_t *p,
else
*(int *)opt->value |= opt->defval;
return 0;
-
case OPTION_BOOLEAN:
*(int *)opt->value = unset ? 0 : *(int *)opt->value + 1;
return 0;
-
case OPTION_SET_INT:
*(int *)opt->value = unset ? 0 : opt->defval;
return 0;
-
case OPTION_SET_PTR:
*(void **)opt->value = unset ? NULL : (void *)opt->defval;
return 0;
-
case OPTION_STRING:
- if (unset) {
- *(const char **)opt->value = NULL;
- return 0;
- }
- if (may_ign && (!arg || *arg == '-')) {
- *(const char **)opt->value = (const char *)opt->defval;
- return 0;
- }
- if (!arg)
- return opterror(opt, "requires a value", flags);
- *(const char **)opt->value = get_arg(p);
- return 0;
-
+ return run_callback(p, &parse_opt_string, opt, flags);
case OPTION_CALLBACK:
- if (unset || (opt->flags & PARSE_OPT_NOARG))
- return (*opt->callback)(opt, NULL, flags);
- if (!may_ign && !arg)
- return opterror(opt, "requires a value", flags);
- if (may_ign && arg && arg[0] == '-' && arg[1])
- return (*opt->callback)(opt, NULL, flags);
- res = (*opt->callback)(opt, arg, flags);
- if (!may_ign && res == PARSE_OPT_IGNORE)
- die("should not happen: MAY_IGN unset, but arg was IGNOREd");
- if (res == PARSE_OPT_IGNORE)
- get_arg(p);
- return res;
-
+ return run_callback(p, opt->callback, opt, flags);
case OPTION_INTEGER:
- if (unset) {
- *(int *)opt->value = 0;
- return 0;
- }
- if (may_ign && (!arg || !isdigit(*arg))) {
- *(int *)opt->value = opt->defval;
- return 0;
- }
- if (!arg)
- return opterror(opt, "requires a value", flags);
- *(int *)opt->value = strtol(get_arg(p), (char **)&s, 10);
- if (*s)
- return opterror(opt, "expects a numerical value", flags);
- return 0;
-
+ return run_callback(p, &parse_opt_integer, opt, flags);
default:
die("should not happen, someone must be hit on the forehead");
}
--
1.5.4.rc0.1148.ga3ab1-dirty
^ permalink raw reply related
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