Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Sun, 17 May 2009 02:49:42 +0000 (19:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 17 May 2009 02:49:42 +0000 (19:49 -0700)
* maint:
test: checkout shouldn't say that HEAD has moved if it didn't
completion: enhance "current branch" display
completion: simplify "current branch" in __git_ps1()
completion: fix PS1 display during a merge on detached HEAD
builtin-checkout: Don't tell user that HEAD has moved before it has
pre-commit.sample: don't print incidental SHA1
tests: Add tests for missing format-patch long options
api-parse-options.txt: use 'func' instead of 'funct'
Turn on USE_ST_TIMESPEC for OpenBSD
ls-tree manpage: output of ls-tree is compatible with update-index
ls-tree manpage: use "unless" instead of "when ... is not"

1  2 
contrib/completion/git-completion.bash
index ad26b7c5aea0dbc0349d0b8bed19112b63fee994,dd6cd250e35cb695107d4a9f610752e09ec5bbb7..b6bcd5cc26eb2cb9cb08d1e9535c3c6e91e16644
@@@ -99,20 -99,32 +99,32 @@@ __git_ps1 (
                elif [ -d "$g/rebase-merge" ]; then
                        r="|REBASE-m"
                        b="$(cat "$g/rebase-merge/head-name")"
-               elif [ -f "$g/MERGE_HEAD" ]; then
-                       r="|MERGING"
-                       b="$(git symbolic-ref HEAD 2>/dev/null)"
                else
+                       if [ -f "$g/MERGE_HEAD" ]; then
+                               r="|MERGING"
+                       fi
                        if [ -f "$g/BISECT_LOG" ]; then
                                r="|BISECTING"
                        fi
-                       if ! b="$(git symbolic-ref HEAD 2>/dev/null)"; then
-                               if ! b="$(git describe --exact-match HEAD 2>/dev/null)"; then
-                                       if [ -r "$g/HEAD" ]; then
-                                               b="$(cut -c1-7 "$g/HEAD")..."
-                                       fi
-                               fi
-                       fi
+                       b="$(git symbolic-ref HEAD 2>/dev/null)" || {
+                               b="$(
+                               case "${GIT_PS1_DESCRIBE_STYLE-}" in
+                               (contains)
+                                       git describe --contains HEAD ;;
+                               (branch)
+                                       git describe --contains --all HEAD ;;
+                               (describe)
+                                       git describe HEAD ;;
+                               (* | default)
+                                       git describe --exact-match HEAD ;;
+                               esac 2>/dev/null)" ||
+                               b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
+                               b="unknown"
+                               b="($b)"
+                       }
                fi
  
                local w
@@@ -1322,35 -1334,6 +1334,35 @@@ _git_send_email (
        COMPREPLY=()
  }
  
 +__git_config_get_set_variables ()
 +{
 +      local prevword word config_file= c=$COMP_CWORD
 +      while [ $c -gt 1 ]; do
 +              word="${COMP_WORDS[c]}"
 +              case "$word" in
 +              --global|--system|--file=*)
 +                      config_file="$word"
 +                      break
 +                      ;;
 +              -f|--file)
 +                      config_file="$word $prevword"
 +                      break
 +                      ;;
 +              esac
 +              prevword=$word
 +              c=$((--c))
 +      done
 +
 +      for i in $(git --git-dir="$(__gitdir)" config $config_file --list \
 +                      2>/dev/null); do
 +              case "$i" in
 +              *.*)
 +                      echo "${i/=*/}"
 +                      ;;
 +              esac
 +      done
 +}
 +
  _git_config ()
  {
        local cur="${COMP_WORDS[COMP_CWORD]}"
                __gitcomp "$__git_send_email_suppresscc_options"
                return
                ;;
 +      --get|--get-all|--unset|--unset-all)
 +              __gitcomp "$(__git_config_get_set_variables)"
 +              return
 +              ;;
        *.*)
                COMPREPLY=()
                return