Re: [PATCH 07/10] rev-list: call new "filter_skip" function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le jeudi 26 mars 2009, Junio C Hamano a écrit :
> Christian Couder <chriscool@xxxxxxxxxxxxx> writes:
> > This patch implements a new "filter_skip" function in C in
> > "bisect.c" that will later replace the existing implementation in
> > shell in "git-bisect.sh".
> >
> > An array is used to store the skipped commits. But the array is
> > not yet fed anything.
> >
> > Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
> > ---
> >  bisect.c           |   65
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++ bisect.h          
> > |    6 ++++-
> >  builtin-rev-list.c |   30 ++++++++++++++++++++----
> >  3 files changed, 95 insertions(+), 6 deletions(-)
> >
> > diff --git a/bisect.c b/bisect.c
> > index 27def7d..39189f2 100644
> > --- a/bisect.c
> > +++ b/bisect.c
> > @@ -4,6 +4,11 @@
> >  #include "revision.h"
> >  #include "bisect.h"
> >
> > +
> > +static unsigned char (*skipped_sha1)[20];
> > +static int skipped_sha1_nr;
> > +static int skipped_sha1_alloc;
> > +
> >  /* bits #0-15 in revision.h */
> >
> >  #define COUNTED		(1u<<16)
> > @@ -386,3 +391,63 @@ struct commit_list *find_bisection(struct
> > commit_list *list, return best;
> >  }
> >
> > +static int skipcmp(const void *a, const void *b)
> > +{
> > +	return hashcmp(a, b);
> > +}
>
> I've learned to suspect without reading a qsort() callback that does not
> derefence its arguments.  Is this doing the right thing?

I think so.

Here is a gdb session that seems to show that it's ok:

---------------------------------------------------
...
$ git bisect skip
There are only 'skip'ped commit left to test.
The first bad commit could be any of:
3de952f2416b6084f557ec417709eac740c6818c
7b7f204a749c3125d5224ed61ea2ae1187ad046f
32a594a3fdac2d57cf6d02987e30eec68511498c
We cannot bisect more!
$
$ gdb git
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) b skipcmp
Breakpoint 1 at 0x46edfd: file bisect.c, line 457.
(gdb) run bisect--helper --next-vars
Starting program: /home/christian/git/bin/git bisect--helper --next-vars
[Thread debugging using libthread_db enabled]
[New Thread 47665987240336 (LWP 9703)]
[Switching to Thread 47665987240336 (LWP 9703)]

Breakpoint 1, skipcmp (a=0x77a800, b=0x77a814) at bisect.c:457
457             return hashcmp(a, b);
(gdb) p skipped_sha1
$1 = (unsigned char (*)[20]) 0x77a800
(gdb) p a - b
$2 = -20
(gdb) p sha1_to_hex(a)
$3 = 0x771256 "3de952f2416b6084f557ec417709eac740c6818c"
(gdb) p sha1_to_hex(b)
$4 = 0x7711c0 "7b7f204a749c3125d5224ed61ea2ae1187ad046f"
(gdb)    
---------------------------------------------------

Do you think I should add a comment and/or perhaps cast a and b into "const 
unsigned char *"?

Thanks,
Christian.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux