completion: add git status

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thomas Braun committed Jun 10, 2016 at 12:12 UTC 634d2344e608c218e8163fe0b14e50ec1a62066a
1 file changed +50
contrib/completion/git-completion.bash
+50
@@ -1825,6 +1825,56 @@ _git_stage ()
1825 _git_add
1826 }
1827
1828 +_git_status ()
1829 +{
1830 + local complete_opt
1831 + local untracked_state
1832 +
1833 + case "$cur" in
1834 + --ignore-submodules=*)
1835 + __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
1836 + return
1837 + ;;
1838 + --untracked-files=*)
1839 + __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
1840 + return
1841 + ;;
1842 + --column=*)
1843 + __gitcomp "
1844 + always never auto column row plain dense nodense
1845 + " "" "${cur##--column=}"
1846 + return
1847 + ;;
1848 + --*)
1849 + __gitcomp "
1850 + --short --branch --porcelain --long --verbose
1851 + --untracked-files= --ignore-submodules= --ignored
1852 + --column= --no-column
1853 + "
1854 + return
1855 + ;;
1856 + esac
1857 +
1858 + untracked_state="$(__git_get_option_value "-u" "--untracked-files=" \
1859 + "$__git_untracked_file_modes" "status.showUntrackedFiles")"
1860 +
1861 + case "$untracked_state" in
1862 + no)
1863 + # --ignored option does not matter
1864 + complete_opt=
1865 + ;;
1866 + all|normal|*)
1867 + complete_opt="--cached --directory --no-empty-directory --others"
1868 +
1869 + if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then
1870 + complete_opt="$complete_opt --ignored --exclude=*"
1871 + fi
1872 + ;;
1873 + esac
1874 +
1875 + __git_complete_index_file "$complete_opt"
1876 +}
1877 +
1878 __git_config_get_set_variables ()
1879 {
1880 local prevword word config_file= c=$cword