diff options
author | Russell Belfer <rb@github.com> | 2013-06-20 23:16:06 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-06-20 23:16:06 +0400 |
commit | 22b6b82f2c0d95ce7a433394a6c0574a5714cf4c (patch) | |
tree | 432b4d109e004ed816127b9d22e2b8e706da75b0 /src/status.c | |
parent | cf300bb9e50c65e4140f7e204243b34f2898fa95 (diff) |
Add status flags to force output sort order
Files in status will, be default, be sorted according to the case
insensitivity of the filesystem that we're running on. However,
in some cases, this is not desirable. Even on case insensitive
file systems, 'git status' at the command line will generally use
a case sensitive sort (like 'ls'). Some GUIs prefer to display a
list of file case insensitively even on case-sensitive platforms.
This adds two new flags: GIT_STATUS_OPT_SORT_CASE_SENSITIVELY
and GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY that will override the
default sort order of the status output and give the user control.
This includes tests for exercising these new options and makes
the examples/status.c program emulate core Git and always use a
case sensitive sort.
Diffstat (limited to 'src/status.c')
-rw-r--r-- | src/status.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/status.c b/src/status.c index 375100a89..e520c1017 100644 --- a/src/status.c +++ b/src/status.c @@ -335,8 +335,16 @@ int git_status_list_new( status->head2idx, status->idx2wd, status_collect, status)) < 0) goto done; - if ((flags & GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX) != 0 || - (flags & GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR) != 0) + if (flags & GIT_STATUS_OPT_SORT_CASE_SENSITIVELY) + git_vector_set_cmp(&status->paired, status_entry_cmp); + if (flags & GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY) + git_vector_set_cmp(&status->paired, status_entry_icmp); + + if ((flags & + (GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX | + GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR | + GIT_STATUS_OPT_SORT_CASE_SENSITIVELY | + GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY)) != 0) git_vector_sort(&status->paired); done: |