Re: [PATCH] git-blame: Make the output human readable

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

 



Hi,

On Sun, 5 Mar 2006, Fredrik Kuivinen wrote:

> On Sun, Mar 05, 2006 at 04:10:47AM -0800, Junio C Hamano wrote:
> > Fredrik Kuivinen <freku045@xxxxxxxxxxxxxx> writes:
> > 
> > > +git-blame$X: blame.o $(LIB_FILE)
> > > +	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
> > > +		$(LIBS) -lm
> > > +
> > 
> > I wonder what it is about to link this binary different from others...
> > 
> 
> It uses log(3) to compute the number of digits needed to represent the
> last line number. It is probably better to this some other way
> though...

How about this:

-	max_digits = 1 + log(num_blame_lines+1)/log(10);
+	for (i = 10, max_digits = 1; i <= num_blame_lines + 1;
+		i *= 10, max_digits++);

(Totally untested)

Hth,
Dscho

-
: 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]