From: Junio C Hamano Date: Thu, 21 May 2009 01:59:09 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.6.4-rc0~151 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/065b0702f748b50e69d67609ace2632ce04b79a1?ds=inline;hp=-c Merge branch 'maint' * maint: grep: fix word-regexp colouring completion: use git rev-parse to detect bare repos Cope better with a _lot_ of packs for-each-ref: fix segfault in copy_email --- 065b0702f748b50e69d67609ace2632ce04b79a1 diff --combined contrib/completion/git-completion.bash index ba13c4948c,f44152c433..0c8bb536c8 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -132,7 -132,7 +132,7 @@@ __git_ps1 ( local c if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then - if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then + if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then c="BARE:" else b="GIT_DIR!" @@@ -1334,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]}" @@@ -1394,8 -1365,7 +1394,8 @@@ __gitcomp "$(__git_merge_strategies)" return ;; - color.branch|color.diff|color.interactive|color.status|color.ui) + color.branch|color.diff|color.interactive|\ + color.showbranch|color.status|color.ui) __gitcomp "always never auto" return ;; @@@ -1430,10 -1400,6 +1430,10 @@@ __gitcomp "$__git_send_email_suppresscc_options" return ;; + --get|--get-all|--unset|--unset-all) + __gitcomp "$(__git_config_get_set_variables)" + return + ;; *.*) COMPREPLY=() return @@@ -1544,7 -1510,6 +1544,7 @@@ color.interactive.help color.interactive.prompt color.pager + color.showbranch color.status color.status.added color.status.changed @@@ -1856,7 -1821,6 +1856,7 @@@ _git_show_branch ( __gitcomp " --all --remotes --topo-order --current --more= --list --independent --merge-base --no-name + --color --no-color --sha1-name --sparse --topics --reflog " return diff --combined sha1_file.c index e5dec8d3c8,bd5edd8e65..e73cd4fc0b --- a/sha1_file.c +++ b/sha1_file.c @@@ -720,6 -720,8 +720,8 @@@ static int open_packed_git_1(struct pac return error("packfile %s index unavailable", p->pack_name); p->pack_fd = open(p->pack_name, O_RDONLY); + while (p->pack_fd < 0 && errno == EMFILE && unuse_one_window(p, -1)) + p->pack_fd = open(p->pack_name, O_RDONLY); if (p->pack_fd < 0 || fstat(p->pack_fd, &st)) return -1; @@@ -937,6 -939,8 +939,8 @@@ static void prepare_packed_git_one(cha sprintf(path, "%s/pack", objdir); len = strlen(path); dir = opendir(path); + while (!dir && errno == EMFILE && unuse_one_window(packed_git, -1)) + dir = opendir(path); if (!dir) { if (errno != ENOENT) error("unable to open object pack directory: %s: %s", @@@ -2247,7 -2251,7 +2251,7 @@@ int move_temp_to_file(const char *tmpfi goto out; ret = errno; } - unlink(tmpfile); + unlink_or_warn(tmpfile); if (ret) { if (ret != EEXIST) { return error("unable to write sha1 filename %s: %s\n", filename, strerror(ret)); @@@ -2339,6 -2343,8 +2343,8 @@@ static int write_loose_object(const uns filename = sha1_file_name(sha1); fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename); + while (fd < 0 && errno == EMFILE && unuse_one_window(packed_git, -1)) + fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename); if (fd < 0) { if (errno == EACCES) return error("insufficient permission for adding an object to repository database %s\n", get_object_directory());