Re: [PATCH v2 04/10] ref-filter: add support to sort by version
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jul 9, 2015, 13:29 UTC
- Message-ID
- <vpqfv4x792z.fsf@anie.imag.fr>
- In-Reply-To
- <1436437671-25600-4-git-send-email-karthik.188@gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
> Add support to sort by version using the "v:refname" and > "version:refname" option. This is achieved by using the > 'version_cmp()' function as the comparing function for qsort.
You should elaborate on why you need this. Given the context, I can guess that you will need this to implement tag, but for example I first wondered why you needed both version: and v:, but I guess it comes from the fact that 'git tag --sort' can take version:refname or v:refname.
I think this deserves a test and documentation in for-each-ref.txt.
As-is, the code is a bit hard to understand. I first saw you were allowing
git for-each-ref --format '%(version:refname)'
(which you are, but only as a side effect), and then understood that this was also allowing
git for-each-ref --sort version:refname
A test would have shown me this immediately. Some hints in the commit message would clearly have helped too.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/