[PATCH v13 04/12] ref-filter: implement an `align` atom

2015-08-21 Thread Karthik Nayak
s whenever the stack has more than one element, and performing formatting for the entire stack element when the `%(end)` atoms is encountered. Add documentation and tests for the same. Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- Documentation/gi

[PATCH v13 03/12] utf8: add function to align a string into given strbuf

2015-08-21 Thread Karthik Nayak
Add strbuf_utf8_align() which will align a given string into a strbuf as per given align_type and width. If the width is greater than the string length then no alignment is performed. Helped-by: Eric Sunshine Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak

[PATCH v13 00/12] port tag.c to use ref-filter APIs

2015-08-21 Thread Karthik Nayak
(). * In tag.c support usage of --format with -n. Karthik Nayak (12): ref-filter: move `struct atom_value` to ref-filter.c ref-filter: introduce ref_formatting_state and ref_formatting_stack utf8: add function to align a string into given strbuf ref-filter: implement an `align` atom ref-filter

[PATCH v13 02/12] ref-filter: introduce ref_formatting_state and ref_formatting_stack

2015-08-21 Thread Karthik Nayak
() -> append_atom() emit()-> append_literal() Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- ref-filter.c | 78 +--- 1 file changed, 59 insertions(+), 19 deletions(-) diff --git a/ref-filter.c

[PATCH v13 08/12] ref-filter: add option to match literal pattern

2015-08-21 Thread Karthik Nayak
From: Karthik Nayak Since 'ref-filter' only has an option to match path names add an option for plain fnmatch pattern-matching. This is to support the pattern matching options which are used in `git tag -l` and `git branch -l` where we can match patterns like `git tag -l foo*` which w

[PATCH v13 07/12] ref-filter: add support to sort by version

2015-08-21 Thread Karthik Nayak
From: Karthik Nayak Add support to sort by version using the "v:refname" and "version:refname" option. This is achieved by using the 'versioncmp()' function as the comparing function for qsort. This option is included to support sorting by versions in `git ta

[PATCH v13 05/12] ref-filter: add option to filter out tags, branches and remotes

2015-08-21 Thread Karthik Nayak
From: Karthik Nayak Add a function called 'for_each_reftype_fullpath()' to refs.{c,h} which iterates through each ref for the given path without trimming the path and also accounting for broken refs, if mentioned. Add 'filter_ref_kind()' in ref-filter.c to check the kind

[PATCH v13 09/12] tag.c: use 'ref-filter' data structures

2015-08-21 Thread Karthik Nayak
From: Karthik Nayak Make 'tag.c' use 'ref-filter' data structures and make changes to support the new data structures. This is a part of the process of porting 'tag.c' to use 'ref-filter' APIs. This is a temporary step before porting 'tag.c&

[PATCH v13 12/12] tag.c: implement '--merged' and '--no-merged' options

2015-08-21 Thread Karthik Nayak
t merged into the named commit. If no object is provided it assumes HEAD as the object. Add documentation and tests for the same. Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- Documentation/git-tag.txt | 7 ++- builtin/t

[PATCH v13 10/12] tag.c: use 'ref-filter' APIs

2015-08-21 Thread Karthik Nayak
From: Karthik Nayak Make 'tag.c' use 'ref-filter' APIs for iterating through refs, sorting and printing of refs. This removes most of the code used in 'tag.c' replacing it with calls to the 'ref-filter' library. Make 'tag.c' use the 'fil

[PATCH v13 01/12] ref-filter: move `struct atom_value` to ref-filter.c

2015-08-21 Thread Karthik Nayak
Since atom_value is only required for the internal working of ref-filter it doesn't belong in the public header. Helped-by: Eric Sunshine Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- ref-filter.c | 5 + ref-filter.h | 5 + 2 files ch

Re: [PATCH v12 05/13] ref-filter: implement an `align` atom

2015-08-20 Thread Karthik Nayak
On Fri, Aug 21, 2015 at 1:53 AM, Eric Sunshine wrote: > On Tue, Aug 18, 2015 at 2:37 PM, Karthik Nayak wrote: >> Implement an `align` atom which left-, middle-, or right-aligns the >> content between %(align:..) and %(end). >> >> It is followed by `:,`, where the ``

Re: [PATCH v12 12/13] tag.c: implement '--format' option

2015-08-20 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 8:23 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >> --- a/Documentation/git-tag.txt >> +++ b/Documentation/git-tag.txt >> @@ -158,6 +159,18 @@ This option is only applicable when listing tags >> without annotation lines. >>

Re: [PATCH v12 03/13] ref-filter: introduce the ref_formatting_state stack machinery

2015-08-20 Thread Karthik Nayak
ill. > > I think this is the right way to go. As you explained in your later > messages, this is conceptually a global setting that applies to > anybody working in the callchain and not something individual > recursion levels would want to muck with. > > Thanks. > I'll work o

Re: [PATCH v12 03/13] ref-filter: introduce the ref_formatting_state stack machinery

2015-08-20 Thread Karthik Nayak
On Thu, Aug 20, 2015 at 12:59 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >> Speaking of quote_value, The quote doesn't work well with color's >> for e.g. >> git for-each-ref --shell --format="%(color:green)%(refname)" >> ''&

Re: [PATCH v12 03/13] ref-filter: introduce the ref_formatting_state stack machinery

2015-08-19 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 9:24 PM, Karthik Nayak wrote: > On Wed, Aug 19, 2015 at 9:14 PM, Matthieu Moy > wrote: >> Karthik Nayak writes: >> >>>> --- a/ref-filter.c >>>> +++ b/ref-filter.c >>>> @@ -155,6 +155,8 @@ static void pu

Re: [PATCH v2 3/8] branch: roll show_detached HEAD into regular ref_list

2015-08-19 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 8:48 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >> + /* >> + * First we obtain all regular branch refs and if the HEAD is >> + * detached then we insert that ref to the end of the ref_fist >> + * s

Re: [PATCH v2 5/8] branch: drop non-commit error reporting

2015-08-19 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 8:53 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >> Remove the error reporting variable to make the code easier to port >> over to using ref-filter APIs. This variable is not require as in > > s/is not require/&d/ > Will change. -

Re: [PATCH v12 03/13] ref-filter: introduce the ref_formatting_state stack machinery

2015-08-19 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 9:14 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >>> --- a/ref-filter.c >>> +++ b/ref-filter.c >>> @@ -155,6 +155,8 @@ static void push_new_state(struct ref_formatting_state >>> **stack) >>> >>>

Re: [RFC/PATCH 10/11] branch.c: use 'ref-filter' APIs

2015-08-19 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 9:19 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >> On Thu, Jul 30, 2015 at 12:59 PM, Matthieu Moy >> wrote: >> >>> IIRC, historicaly Git allowed some weirdly named refs which made some >>> commands ambiguous (e.

Re: [PATCH v12 10/13] tag.c: use 'ref-filter' data structures

2015-08-19 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 8:26 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >> This is a temporary step before porting 'tag.c' to use 'ref-filter' >> completely. As this is a temporary step, most of the code >> introduced here will be removed when

Re: [PATCH v12 03/13] ref-filter: introduce the ref_formatting_state stack machinery

2015-08-19 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 8:26 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >> +static void pop_state(struct ref_formatting_state **stack) >> +{ >> + struct ref_formatting_state *current = *stack; >> + struct ref_formatting_state *prev = current

Re: [PATCH v12 01/13] ref-filter: move `struct atom_value` to ref-filter.c

2015-08-19 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 8:26 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >> +static void end_atom_handler(struct atom_value *atomv, struct >> ref_formatting_state **state) >> +{ >> + struct ref_formatting_state *current = *state; >> + if (!c

Re: [PATCH v12 05/13] ref-filter: implement an `align` atom

2015-08-18 Thread Karthik Nayak
dth then no alignment is On Wed, Aug 19, 2015 at 12:07 AM, Karthik Nayak wrote: > Implement an `align` atom which left-, middle-, or right-aligns the > content between %(align:..) and %(end). > > It is followed by `:,`, where the `` is > either left, right or middle and `` is th

Re: [PATCH v12 00/13] port tag.c to use ref-filter.c APIs

2015-08-18 Thread Karthik Nayak
On Wed, Aug 19, 2015 at 12:48 AM, Eric Sunshine wrote: > On Tue, Aug 18, 2015 at 2:37 PM, Karthik Nayak wrote: >> Version 11 was posted here: >> http://article.gmane.org/gmane.comp.version-control.git/275997 >> >> Changes in this version: >> * Small style an

[PATCH v2 6/8] branch.c: use 'ref-filter' data structures

2015-08-18 Thread Karthik Nayak
f-filter' completely. As this is a temporary step, most of the code introduced here will be removed when 'branch.c' is ported over to use 'ref-filter' APIs Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- builtin/branch.c | 321

[PATCH v2 8/8] branch: add '--points-at' option

2015-08-18 Thread Karthik Nayak
Add the '--points-at' option provided by 'ref-filter'. The option lets the user to list only branches which points at the given object. Add documentation and tests for the same. Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --

[PATCH v2 7/8] branch.c: use 'ref-filter' APIs

2015-08-18 Thread Karthik Nayak
x27;--merged' option and now that is handled by ref-filter. The test t1430 'git branch shows badly named ref' fails as this checks the ability of branch.c to list broken refs, which is now displayed as a warning while using ref-filter APIs. Modify documentation and add tests for t

[PATCH v2 5/8] branch: drop non-commit error reporting

2015-08-18 Thread Karthik Nayak
-by: Karthik Nayak --- builtin/branch.c | 18 -- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index bba7752..d15d184 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -313,7 +313,6 @@ static char *resolve_symref(const char

[PATCH v2 3/8] branch: roll show_detached HEAD into regular ref_list

2015-08-18 Thread Karthik Nayak
show_detached() used to check if the HEAD branch satisfies the '--contains' option, now that is taken care by append_ref(). Based-on-patch-by: Jeff King Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- builtin/bra

[PATCH v2 0/8] port brnach.c to use ref-filter APIs

2015-08-18 Thread Karthik Nayak
ref-filter. * 1/8: we first check for ignore before computing width. * 2/8: spelling error. * 3/8: add a to_free variable. Karthik Nayak (8): branch: refactor width computation branch: bump get_head_description() to the top branch: roll show_detached HEAD into regular ref_list branch: mov

[PATCH v2 2/8] branch: bump get_head_description() to the top

2015-08-18 Thread Karthik Nayak
This is a preperatory patch for 'roll show_detached HEAD into regular ref_list'. This patch moves get_head_description() to the top so that it can be used in print_ref_item(). Based-on-patch-by: Jeff King Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Kar

[PATCH v2 1/8] branch: refactor width computation

2015-08-18 Thread Karthik Nayak
From: Karthik Nayak Remove unnecessary variables from ref_list and ref_item which were used for width computation. This is to make ref_item similar to ref-filter's ref_array_item. This will ensure a smooth port of branch.c to use ref-filter APIs in further patches. Previously the maxwidt

[PATCH v2 4/8] branch: move 'current' check down to the presentation layer

2015-08-18 Thread Karthik Nayak
We check if given ref is the current branch in print_ref_list(). Move this check to print_ref_item() where it is checked right before printing. Based-on-patch-by: Jeff King Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- builtin/branch.c | 22

[PATCH v12 13/13] tag.c: implement '--merged' and '--no-merged' options

2015-08-18 Thread Karthik Nayak
From: Karthik Nayak Use 'ref-filter' APIs to implement the '--merged' and '--no-merged' options into 'tag.c'. The '--merged' option lets the user to only list tags merged into the named commit. The '--no-merged' option lets the use

[PATCH v12 09/13] ref-filter: add option to match literal pattern

2015-08-18 Thread Karthik Nayak
From: Karthik Nayak Since 'ref-filter' only has an option to match path names add an option for plain fnmatch pattern-matching. This is to support the pattern matching options which are used in `git tag -l` and `git branch -l` where we can match patterns like `git tag -l foo*` which w

[PATCH v12 11/13] tag.c: use 'ref-filter' APIs

2015-08-18 Thread Karthik Nayak
From: Karthik Nayak Make 'tag.c' use 'ref-filter' APIs for iterating through refs, sorting and printing of refs. This removes most of the code used in 'tag.c' replacing it with calls to the 'ref-filter' library. Make 'tag.c' use the 'fil

[PATCH v12 06/13] ref-filter: add option to filter out tags, branches and remotes

2015-08-18 Thread Karthik Nayak
From: Karthik Nayak Add a function called 'for_each_reftype_fullpath()' to refs.{c,h} which iterates through each ref for the given path without trimming the path and also accounting for broken refs, if mentioned. Add 'filter_ref_kind()' in ref-filter.c to check the kind

[PATCH v12 12/13] tag.c: implement '--format' option

2015-08-18 Thread Karthik Nayak
From: Karthik Nayak Implement the '--format' option provided by 'ref-filter'. This lets the user list tags as per desired format similar to the implementation in 'git for-each-ref'. Add tests and documentation for the same. Mentored-by: Christian Couder Mentore

[PATCH v12 10/13] tag.c: use 'ref-filter' data structures

2015-08-18 Thread Karthik Nayak
From: Karthik Nayak Make 'tag.c' use 'ref-filter' data structures and make changes to support the new data structures. This is a part of the process of porting 'tag.c' to use 'ref-filter' APIs. This is a temporary step before porting 'tag.c&

[PATCH v12 07/13] ref-filter: support printing N lines from tag annotation

2015-08-18 Thread Karthik Nayak
From: Karthik Nayak In 'tag.c' we can print N lines from the annotation of the tag using the '-n' option. Copy code from 'tag.c' to 'ref-filter' and modify 'ref-filter' to support printing of N lines from the annotation of tags. Mentored-by: C

[PATCH v12 08/13] ref-filter: add support to sort by version

2015-08-18 Thread Karthik Nayak
From: Karthik Nayak Add support to sort by version using the "v:refname" and "version:refname" option. This is achieved by using the 'versioncmp()' function as the comparing function for qsort. This option is included to support sorting by versions in `git ta

[PATCH v12 01/13] ref-filter: move `struct atom_value` to ref-filter.c

2015-08-18 Thread Karthik Nayak
Since atom_value is only required for the internal working of ref-filter it doesn't belong in the public header. Helped-by: Eric Sunshine Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- ref-filter.c | 5 + ref-filter.h | 5 + 2 files ch

[PATCH v12 05/13] ref-filter: implement an `align` atom

2015-08-18 Thread Karthik Nayak
ed 'at_end' function for each state. The align_handler() defined uses strbuf_utf8_align() from utf8.c to perform the alignment. Add documentation and tests for the same. Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- Documentation/git-fo

[PATCH v12 00/13] port tag.c to use ref-filter.c APIs

2015-08-18 Thread Karthik Nayak
formatting changes. * Remove unnecessary variable from push_new_state(). * pop_state doesn't return a value now and attaches the buffer into the previous state. * use strcmp() rather than starts_with() while checking for alignment position. * Change attend to at_end Karthik Nayak (13

[PATCH v12 02/13] ref-filter: introduce ref_formatting_state

2015-08-18 Thread Karthik Nayak
() -> append_atom() emit()-> append_literal() Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- ref-filter.c | 44 +--- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/ref-filter.c b/ref-filter.c

[PATCH v12 04/13] utf8: add function to align a string into given strbuf

2015-08-18 Thread Karthik Nayak
Add strbuf_utf8_align() which will align a given string into a strbuf as per given align_type and width. If the width is greater than the string length then no alignment is performed. Helped-by: Eric Sunshine Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak

[PATCH v12 03/13] ref-filter: introduce the ref_formatting_state stack machinery

2015-08-18 Thread Karthik Nayak
: Matthieu Moy Signed-off-by: Karthik Nayak --- ref-filter.c | 42 +- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index dd62640..74532d3 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -56,6 +56,7 @@ static struct

Re: [PATCH v11 11/13] tag.c: use 'ref-filter' APIs

2015-08-17 Thread Karthik Nayak
On Tue, Aug 18, 2015 at 12:30 AM, Junio C Hamano wrote: > Karthik Nayak writes: > >> We improve the sorting option provided by 'tag.c' by using the sorting >> options provided by 'ref-filter'. This causes the test 'invalid sort >> parameter

Re: [PATCH v11 12/13] tag.c: implement '--format' option

2015-08-17 Thread Karthik Nayak
On Tue, Aug 18, 2015 at 12:34 AM, Junio C Hamano wrote: > Karthik Nayak writes: > >> From: Karthik Nayak >> >> Implement the '--format' option provided by 'ref-filter'. >> This lets the user list tags as per desired format similar >> to t

Re: [PATCH v11 05/13] ref-filter: implement an `align` atom

2015-08-17 Thread Karthik Nayak
On Mon, Aug 17, 2015 at 11:52 PM, Eric Sunshine wrote: > On Mon, Aug 17, 2015 at 10:28 AM, Karthik Nayak wrote: >> On Mon, Aug 17, 2015 at 7:37 AM, Eric Sunshine >> wrote: >>> On Sat, Aug 15, 2015 at 2:00 PM, Karthik Nayak >>> wrote: >>>> +{ >

Re: [PATCH v11 08/13] ref-filter: add support to sort by version

2015-08-17 Thread Karthik Nayak
On Mon, Aug 17, 2015 at 10:23 AM, Eric Sunshine wrote: > On Sat, Aug 15, 2015 at 2:00 PM, Karthik Nayak wrote: >> Add support to sort by version using the "v:refname" and >> "version:refname" option. This is achieved by using the 'versioncmp()' &g

Re: [PATCH v11 06/13] ref-filter: add option to filter out tags, branches and remotes

2015-08-17 Thread Karthik Nayak
On Mon, Aug 17, 2015 at 10:12 AM, Eric Sunshine wrote: > On Sat, Aug 15, 2015 at 2:00 PM, Karthik Nayak wrote: >> Add a function called 'for_each_reftype_fullpath()' to refs.{c,h} >> which iterates through each ref for the given path without trimming >> the path

Re: [PATCH v11 05/13] ref-filter: implement an `align` atom

2015-08-17 Thread Karthik Nayak
On Mon, Aug 17, 2015 at 7:37 AM, Eric Sunshine wrote: > On Sat, Aug 15, 2015 at 2:00 PM, Karthik Nayak wrote: >> Implement an `align` atom which left-, middle-, or right-aligns the >> content between %(align:..) and %(end). >> >> It is followed by `:,`, where the ``

Re: [PATCH v11 04/13] utf8: add function to align a string into given strbuf

2015-08-17 Thread Karthik Nayak
On Mon, Aug 17, 2015 at 5:18 AM, Eric Sunshine wrote: > On Sat, Aug 15, 2015 at 2:00 PM, Karthik Nayak wrote: >> Add strbuf_utf8_align() which will align a given string into a strbuf >> as per given align_type and width. If the width is greater than the >> string length

Re: [PATCH v11 03/13] ref-filter: introduce ref_formatting_state

2015-08-17 Thread Karthik Nayak
On Mon, Aug 17, 2015 at 5:01 AM, Eric Sunshine wrote: > On Sat, Aug 15, 2015 at 2:00 PM, Karthik Nayak wrote: >> Introduce ref_formatting_state which will hold the formatted >> output strbuf and is used for nesting of modifier atoms. >> >> Signed-off-by: Karthik Nayak

Re: [PATCH v11 05/13] ref-filter: implement an `align` atom

2015-08-16 Thread Karthik Nayak
I think we need to squash this in diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt index 3099631..17bd15e 100644 --- a/Documentation/git-for-each-ref.txt +++ b/Documentation/git-for-each-ref.txt @@ -129,7 +129,7 @@ color:: align:: left-, middle-, or ri

Re: [PATCH v11 00/13] port tag.c to use ref-filter APIs

2015-08-16 Thread Karthik Nayak
On Sun, Aug 16, 2015 at 1:08 PM, Jacob Keller wrote: > On Sat, Aug 15, 2015 at 11:00 AM, Karthik Nayak wrote: > >> >> align:: >> - Implement an `align` atom which left-, middle-, or >> - right-aligns the content between %(align:..) and >> -

[PATCH v11 11/13] tag.c: use 'ref-filter' APIs

2015-08-15 Thread Karthik Nayak
From: Karthik Nayak Make 'tag.c' use 'ref-filter' APIs for iterating through refs, sorting and printing of refs. This removes most of the code used in 'tag.c' replacing it with calls to the 'ref-filter' library. Make 'tag.c' use the 'fil

[PATCH v11 10/13] tag.c: use 'ref-filter' data structures

2015-08-15 Thread Karthik Nayak
From: Karthik Nayak Make 'tag.c' use 'ref-filter' data structures and make changes to support the new data structures. This is a part of the process of porting 'tag.c' to use 'ref-filter' APIs. This is a temporary step before porting 'tag.c&

[PATCH v11 07/13] ref-filter: support printing N lines from tag annotation

2015-08-15 Thread Karthik Nayak
From: Karthik Nayak In 'tag.c' we can print N lines from the annotation of the tag using the '-n' option. Copy code from 'tag.c' to 'ref-filter' and modify 'ref-filter' to support printing of N lines from the annotation of tags. Mentored-by: C

[PATCH v11 06/13] ref-filter: add option to filter out tags, branches and remotes

2015-08-15 Thread Karthik Nayak
From: Karthik Nayak Add a function called 'for_each_reftype_fullpath()' to refs.{c,h} which iterates through each ref for the given path without trimming the path and also accounting for broken refs, if mentioned. Add 'filter_ref_kind()' in ref-filter.c to check the kind

[PATCH v11 09/13] ref-filter: add option to match literal pattern

2015-08-15 Thread Karthik Nayak
From: Karthik Nayak Since 'ref-filter' only has an option to match path names add an option for plain fnmatch pattern-matching. This is to support the pattern matching options which are used in `git tag -l` and `git branch -l` where we can match patterns like `git tag -l foo*` which w

[PATCH v11 08/13] ref-filter: add support to sort by version

2015-08-15 Thread Karthik Nayak
From: Karthik Nayak Add support to sort by version using the "v:refname" and "version:refname" option. This is achieved by using the 'versioncmp()' function as the comparing function for qsort. This option is included to support sorting by versions in `git ta

[PATCH v11 13/13] tag.c: implement '--merged' and '--no-merged' options

2015-08-15 Thread Karthik Nayak
From: Karthik Nayak Using 'ref-filter' APIs implement the '--merged' and '--no-merged' options into 'tag.c'. The '--merged' option lets the user to only list tags merged into the named commit. The '--no-merged' option lets the user to o

[PATCH v11 12/13] tag.c: implement '--format' option

2015-08-15 Thread Karthik Nayak
From: Karthik Nayak Implement the '--format' option provided by 'ref-filter'. This lets the user list tags as per desired format similar to the implementation in 'git for-each-ref'. Add tests and documentation for the same. Mentored-by: Christian Couder Mentore

[PATCH v11 05/13] ref-filter: implement an `align` atom

2015-08-15 Thread Karthik Nayak
entored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- Documentation/git-for-each-ref.txt | 8 ref-filter.c | 81 +++--- ref-filter.h | 1 + t/t6302-for-each-ref-filter.s

[PATCH v11 02/13] ref-filter: print output to strbuf for formatting

2015-08-15 Thread Karthik Nayak
Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- ref-filter.c | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index e53c77e..edfb1c7 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1195,30 +1195,25 @

[PATCH v11 01/13] ref-filter: move `struct atom_value` to ref-filter.c

2015-08-15 Thread Karthik Nayak
Since atom_value is only required for the internal working of ref-filter it doesn't belong in the public header. Helped-by: Eric Sunshine Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- ref-filter.c | 5 + ref-filter.h | 5 + 2 files ch

[PATCH v11 04/13] utf8: add function to align a string into given strbuf

2015-08-15 Thread Karthik Nayak
Add strbuf_utf8_align() which will align a given string into a strbuf as per given align_type and width. If the width is greater than the string length then no alignment is performed. Helped-by: Eric Sunshine Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak

[PATCH v11 03/13] ref-filter: introduce ref_formatting_state

2015-08-15 Thread Karthik Nayak
Introduce ref_formatting_state which will hold the formatted output strbuf and is used for nesting of modifier atoms. Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- ref-filter.c | 65 1 file

[PATCH v11 00/13] port tag.c to use ref-filter APIs

2015-08-15 Thread Karthik Nayak
Karthik Nayak (13): ref-filter: move `struct atom_value` to ref-filter.c ref-filter: print output to strbuf for formatting ref-filter: introduce ref_formatting_state utf8: add function to align a string into given strbuf ref-filter: implement an `align` atom ref-filter: add option to

Re: [PATCH 01/10] ref-filter: add option to filter only branches

2015-08-14 Thread Karthik Nayak
On Fri, Aug 14, 2015 at 9:26 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >> On Thu, Aug 13, 2015 at 5:05 PM, Karthik Nayak wrote: >>> On Thu, Aug 13, 2015 at 4:21 PM, Karthik Nayak >>> wrote: >>>> >>>> This was taken from

Re: [PATCH v10 05/13] ref-filter: implement an `align` atom

2015-08-14 Thread Karthik Nayak
On Thu, Aug 13, 2015 at 1:54 AM, Junio C Hamano wrote: > Karthik Nayak writes: > >> On Wed, Aug 12, 2015 at 10:43 PM, Junio C Hamano wrote: >> ... >>> %(objectname:abbrev=8). To specify two modification magics, each of >>> which ta

Re: [PATCH v10 04/13] utf8: add function to align a string into given strbuf

2015-08-13 Thread Karthik Nayak
On Fri, Aug 14, 2015 at 12:38 AM, Eric Sunshine wrote: > On Sun, Aug 9, 2015 at 10:11 AM, Karthik Nayak wrote: >> Add strbuf_utf8_align() which will align a given string into a strbuf >> as per given align_type and width. If the width is greater than the >> string length

Re: [PATCH v10 05/13] ref-filter: implement an `align` atom

2015-08-13 Thread Karthik Nayak
On Thu, Aug 13, 2015 at 11:56 PM, Eric Sunshine wrote: > On Sun, Aug 9, 2015 at 10:11 AM, Karthik Nayak wrote: >> Implement an `align` atom which left-, middle-, or right-aligns the >> content between %(align:..) and %(end). >> >> Signed-off-by: Karthik Na

Re: [PATCH 01/10] ref-filter: add option to filter only branches

2015-08-13 Thread Karthik Nayak
On Thu, Aug 13, 2015 at 10:22 PM, Matthieu Moy wrote: > > > Le 13 août 2015 13:35:21 GMT+02:00, Karthik Nayak a > écrit : >>On Thu, Aug 13, 2015 at 4:21 PM, Karthik Nayak >>wrote: >>> >>> This was taken from branch.c, I thought of using an enum inste

Re: [PATCH 01/10] ref-filter: add option to filter only branches

2015-08-13 Thread Karthik Nayak
On Thu, Aug 13, 2015 at 5:05 PM, Karthik Nayak wrote: > On Thu, Aug 13, 2015 at 4:21 PM, Karthik Nayak wrote: >> >> This was taken from branch.c, I thought of using an enum instead but that >> would again require most of branch.c, hence it's been carried over >>

Re: [PATCH 01/10] ref-filter: add option to filter only branches

2015-08-13 Thread Karthik Nayak
On Thu, Aug 13, 2015 at 4:21 PM, Karthik Nayak wrote: > > This was taken from branch.c, I thought of using an enum instead but that > would again require most of branch.c, hence it's been carried over > without changing > I'm thinking of changing it, any suggestions? >

Re: [PATCH 01/10] ref-filter: add option to filter only branches

2015-08-13 Thread Karthik Nayak
On Tue, Aug 11, 2015 at 11:03 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >> From: Karthik Nayak >> >> Add an option in 'filter_refs()' to use 'for_each_branch_ref()' >> and filter refs. This type checking is done by adding a >>

Re: [PATCH v10 05/13] ref-filter: implement an `align` atom

2015-08-12 Thread Karthik Nayak
On Wed, Aug 12, 2015 at 10:43 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >> On Wed, Aug 12, 2015 at 12:22 AM, Junio C Hamano wrote: >> >>> Minor nits on the design. %(align:[,]) would let >>> us write %(align:16)...%(end) and use the "default

Re: [PATCH v10 04/13] utf8: add function to align a string into given strbuf

2015-08-12 Thread Karthik Nayak
On Wed, Aug 12, 2015 at 10:10 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >> On Tue, Aug 11, 2015 at 11:52 PM, Junio C Hamano wrote: >>> Karthik Nayak writes: >>> >>>> +void strbuf_utf8_align(struct strbuf *buf, ali

Re: [PATCH v10 02/13] ref-filter: print output to strbuf for formatting

2015-08-12 Thread Karthik Nayak
On Wed, Aug 12, 2015 at 9:59 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >>>> + format_quote_value(atomv, quote_style, &output); >>> >>> If the one to add a literal string (with %hex escaping) is called "append_", >

Re: [PATCH v10 05/13] ref-filter: implement an `align` atom

2015-08-12 Thread Karthik Nayak
On Wed, Aug 12, 2015 at 12:22 AM, Junio C Hamano wrote: > Karthik Nayak writes: > >> struct atom_value{ > > Obviously not a problem with this step, but you need a SP before the > open brace. > Will add. >> @@ -692,6 +704,26 @@ static void populate_va

Re: [PATCH v10 04/13] utf8: add function to align a string into given strbuf

2015-08-12 Thread Karthik Nayak
On Tue, Aug 11, 2015 at 11:52 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >> +void strbuf_utf8_align(struct strbuf *buf, align_type position, unsigned >> int width, >> +const char *s) >> +{ >> + int display_len = utf8_strn

Re: [PATCH v10 03/13] ref-filter: introduce ref_formatting_state

2015-08-12 Thread Karthik Nayak
On Tue, Aug 11, 2015 at 11:43 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >> get_ref_atom_value(info, parse_ref_filter_atom(sp + 2, ep), >> &atomv); >> - format_quote_value(atomv, quote_style, &output); >> +

Re: [PATCH v10 02/13] ref-filter: print output to strbuf for formatting

2015-08-12 Thread Karthik Nayak
On Tue, Aug 11, 2015 at 11:30 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >> @@ -1283,9 +1279,11 @@ void show_ref_array_item(struct ref_array_item *info, >> const char *format, int qu >> if (color_parse("reset", color) < 0) >>

Re: [PATCH v10 02/13] ref-filter: print output to strbuf for formatting

2015-08-12 Thread Karthik Nayak
On Tue, Aug 11, 2015 at 11:26 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >> -static void print_value(struct atom_value *v, int quote_style) >> +static void format_quote_value(struct atom_value *v, int quote_style, >> struct strbuf *output) >> { > >

Re: [PATCH 04/10] branch: roll show_detached HEAD into regular ref_list

2015-08-11 Thread Karthik Nayak
On Tue, Aug 11, 2015 at 8:11 AM, Eric Sunshine wrote: > On Tue, Aug 4, 2015 at 9:01 AM, Karthik Nayak wrote: >> Remove show_detached() and make detached HEAD to be rolled into >> regular ref_list by adding REF_DETACHED_HEAD as a kind of branch and >> supporting the same

Re: [PATCH 03/10] branch: bump get_head_description() to the top

2015-08-11 Thread Karthik Nayak
On Tue, Aug 11, 2015 at 7:29 AM, Eric Sunshine wrote: > On Tue, Aug 4, 2015 at 9:01 AM, Karthik Nayak wrote: >> This is a preperatory patch for 'roll show_detached HEAD into regular >> ref_list'. This patch moves get_head_descrition() to the top so that > > s/desc

Re: [PATCH 02/10] branch: refactor width computation

2015-08-11 Thread Karthik Nayak
On Tue, Aug 11, 2015 at 7:28 AM, Eric Sunshine wrote: > On Tue, Aug 4, 2015 at 9:01 AM, Karthik Nayak wrote: >> Remove unnecessary variables from ref_list and ref_item which were >> used for width computation. This is to make ref_item similar to >> ref-filter's ref_arra

[PATCH v10 12/13] tag.c: implement '--format' option

2015-08-09 Thread Karthik Nayak
From: Karthik Nayak Implement the '--format' option provided by 'ref-filter'. This lets the user list tags as per desired format similar to the implementation in 'git for-each-ref'. Add tests and documentation for the same. Mentored-by: Christian Couder Mentore

[PATCH v10 13/13] tag.c: implement '--merged' and '--no-merged' options

2015-08-09 Thread Karthik Nayak
From: Karthik Nayak Using 'ref-filter' APIs implement the '--merged' and '--no-merged' options into 'tag.c'. The '--merged' option lets the user to only list tags merged into the named commit. The '--no-merged' option lets the user to o

[PATCH v10 11/13] tag.c: use 'ref-filter' APIs

2015-08-09 Thread Karthik Nayak
From: Karthik Nayak Make 'tag.c' use 'ref-filter' APIs for iterating through refs, sorting and printing of refs. This removes most of the code used in 'tag.c' replacing it with calls to the 'ref-filter' library. Make 'tag.c' use the 'fil

[PATCH v10 10/13] tag.c: use 'ref-filter' data structures

2015-08-09 Thread Karthik Nayak
From: Karthik Nayak Make 'tag.c' use 'ref-filter' data structures and make changes to support the new data structures. This is a part of the process of porting 'tag.c' to use 'ref-filter' APIs. This is a temporary step before porting 'tag.c&

[PATCH v10 07/13] ref-filter: support printing N lines from tag annotation

2015-08-09 Thread Karthik Nayak
From: Karthik Nayak In 'tag.c' we can print N lines from the annotation of the tag using the '-n' option. Copy code from 'tag.c' to 'ref-filter' and modify 'ref-filter' to support printing of N lines from the annotation of tags. Mentored-by: C

[PATCH v10 06/13] ref-filter: add option to filter only tags

2015-08-09 Thread Karthik Nayak
From: Karthik Nayak Add a functions called 'for_each_tag_ref_fullpath()' to refs.{c,h} which iterates through each tag ref without trimming the path. Add an option in 'filter_refs()' to use 'for_each_tag_ref_fullpath()' and filter refs. This type checking is done

[PATCH v10 09/13] ref-filter: add option to match literal pattern

2015-08-09 Thread Karthik Nayak
From: Karthik Nayak Since 'ref-filter' only has an option to match path names add an option for plain fnmatch pattern-matching. This is to support the pattern matching options which are used in `git tag -l` and `git branch -l` where we can match patterns like `git tag -l foo*` which w

[PATCH v10 04/13] utf8: add function to align a string into given strbuf

2015-08-09 Thread Karthik Nayak
Add strbuf_utf8_align() which will align a given string into a strbuf as per given align_type and width. If the width is greater than the string length then no alignment is performed. Helped-by: Eric Sunshine Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak

[PATCH v10 05/13] ref-filter: implement an `align` atom

2015-08-09 Thread Karthik Nayak
ment. Add documentation and tests for the same. Mentored-by: Christian Couder Mentored-by: Matthieu Moy Signed-off-by: Karthik Nayak --- Documentation/git-for-each-ref.txt | 9 + ref-filter.c | 72 +++--- ref-filter.h

<    3   4   5   6   7   8   9   10   11   12   >