Re: [RFC/PATCH 01/11] ref-filter: add %(objectname:size=X) option

2015-07-29 Thread Karthik Nayak
On Tue, Jul 28, 2015 at 9:49 PM, Junio C Hamano gits...@pobox.com wrote: Karthik Nayak karthik@gmail.com writes: From: Karthik Nayak karthik@gmail.com Add support for %(objectname:size=X) where X is a number. This will print the first X characters of an objectname. The minimum value

Re: [RFC/PATCH 01/11] ref-filter: add %(objectname:size=X) option

2015-07-28 Thread Matthieu Moy
Karthik Nayak karthik@gmail.com writes: + if (skip_prefix(name, objectname:size=, p)) { + unsigned int size = atoi(p); You have the same problem as for tag.c: don't use atoi, and make accurate error checking (absence of value, negative value, non-integer value). If you

[RFC/PATCH 01/11] ref-filter: add %(objectname:size=X) option

2015-07-28 Thread Karthik Nayak
From: Karthik Nayak karthik@gmail.com Add support for %(objectname:size=X) where X is a number. This will print the first X characters of an objectname. The minimum value for X is 5. Hence any value lesser than 5 will default to 5 characters. Mentored-by: Christian Couder

Re: [RFC/PATCH 01/11] ref-filter: add %(objectname:size=X) option

2015-07-28 Thread Junio C Hamano
Karthik Nayak karthik@gmail.com writes: From: Karthik Nayak karthik@gmail.com Add support for %(objectname:size=X) where X is a number. This will print the first X characters of an objectname. The minimum value for X is 5. Hence any value lesser than 5 will default to 5 characters.

Re: [RFC/PATCH 01/11] ref-filter: add %(objectname:size=X) option

2015-07-28 Thread Karthik Nayak
On Tue, Jul 28, 2015 at 9:13 PM, Junio C Hamano gits...@pobox.com wrote: Karthik Nayak karthik@gmail.com writes: From: Karthik Nayak karthik@gmail.com Add support for %(objectname:size=X) where X is a number. This will print the first X characters of an objectname. The minimum value

Re: [RFC/PATCH 01/11] ref-filter: add %(objectname:size=X) option

2015-07-28 Thread Karthik Nayak
On Tue, Jul 28, 2015 at 2:12 PM, Matthieu Moy matthieu@grenoble-inp.fr wrote: Karthik Nayak karthik@gmail.com writes: + if (skip_prefix(name, objectname:size=, p)) { + unsigned int size = atoi(p); You have the same problem as for tag.c: don't use atoi, and make

Re: [RFC/PATCH 01/11] ref-filter: add %(objectname:size=X) option

2015-07-28 Thread Junio C Hamano
Karthik Nayak karthik@gmail.com writes: From: Karthik Nayak karthik@gmail.com Add support for %(objectname:size=X) where X is a number. This will print the first X characters of an objectname. The minimum value for X is 5. Hence any value lesser than 5 will default to 5 characters.