OSDN Git Service

Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Wed, 9 Jul 2008 07:19:50 +0000 (00:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Jul 2008 07:19:50 +0000 (00:19 -0700)
* maint:
  Start preparing release notes for 1.5.6.3
  git-submodule - Fix bugs in adding an existing repo as a module
  bash: offer only paths after '--'
  Remove unnecessary pack-*.keep file after successful git-clone
  make deleting a missing ref more quiet

1  2 
builtin-clone.c
contrib/completion/git-completion.bash
refs.c

diff --combined builtin-clone.c
@@@ -18,7 -18,6 +18,7 @@@
  #include "transport.h"
  #include "strbuf.h"
  #include "dir.h"
 +#include "pack-refs.h"
  
  /*
   * Overall FIXMEs:
@@@ -322,11 -321,8 +322,11 @@@ static struct ref *write_remote_refs(co
        get_fetch_map(refs, tag_refspec, &tail, 0);
  
        for (r = local_refs; r; r = r->next)
 -              update_ref(reflog,
 -                         r->peer_ref->name, r->old_sha1, NULL, 0, DIE_ON_ERR);
 +              add_extra_ref(r->peer_ref->name, r->old_sha1, 0);
 +
 +      pack_refs(PACK_REFS_ALL);
 +      clear_extra_refs();
 +
        return local_refs;
  }
  
@@@ -341,6 -337,7 +341,7 @@@ int cmd_clone(int argc, const char **ar
        const struct ref *refs, *head_points_at, *remote_head, *mapped_refs;
        char branch_top[256], key[256], value[256];
        struct strbuf reflog_msg;
+       struct transport *transport = NULL;
  
        struct refspec refspec;
  
                refs = clone_local(path, git_dir);
        else {
                struct remote *remote = remote_get(argv[0]);
-               struct transport *transport =
-                       transport_get(remote, remote->url[0]);
+               transport = transport_get(remote, remote->url[0]);
  
                if (!transport->get_refs_list || !transport->fetch)
                        die("Don't know how to clone %s", transport->url);
                option_no_checkout = 1;
        }
  
+       if (transport)
+               transport_unlock_pack(transport);
        if (!option_no_checkout) {
                struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
                struct unpack_trees_options opts;
@@@ -451,6 -451,18 +451,18 @@@ __git_find_subcommand (
        done
  }
  
+ __git_has_doubledash ()
+ {
+       local c=1
+       while [ $c -lt $COMP_CWORD ]; do
+               if [ "--" = "${COMP_WORDS[c]}" ]; then
+                       return 0
+               fi
+               c=$((++c))
+       done
+       return 1
+ }
  __git_whitespacelist="nowarn warn error error-all strip"
  
  _git_am ()
@@@ -497,6 -509,8 +509,8 @@@ _git_apply (
  
  _git_add ()
  {
+       __git_has_doubledash && return
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
  
  _git_bisect ()
  {
 -      local subcommands="start bad good reset visualize replay log"
+       __git_has_doubledash && return
 +      local subcommands="start bad good skip reset visualize replay log run"
        local subcommand="$(__git_find_subcommand "$subcommands")"
        if [ -z "$subcommand" ]; then
                __gitcomp "$subcommands"
        fi
  
        case "$subcommand" in
 -      bad|good|reset)
 +      bad|good|reset|skip)
                __gitcomp "$(__git_refs)"
                ;;
        *)
@@@ -546,7 -562,7 +562,7 @@@ _git_branch (
        --*)
                __gitcomp "
                        --color --no-color --verbose --abbrev= --no-abbrev
 -                      --track --no-track
 +                      --track --no-track --contains --merged --no-merged
                        "
                ;;
        *)
@@@ -613,6 -629,8 +629,8 @@@ _git_cherry_pick (
  
  _git_commit ()
  {
+       __git_has_doubledash && return
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
@@@ -632,6 -650,8 +650,8 @@@ _git_describe (
  
  _git_diff ()
  {
+       __git_has_doubledash && return
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
@@@ -734,6 -754,8 +754,8 @@@ _git_ls_tree (
  
  _git_log ()
  {
+       __git_has_doubledash && return
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --pretty=*)
                        --not --all
                        --left-right --cherry-pick
                        --graph
 +                      --stat --numstat --shortstat
 +                      --decorate --diff-filter=
 +                      --color-words --walk-reflogs
                        "
                return
                ;;
@@@ -1041,6 -1060,7 +1063,6 @@@ _git_config (
                pull.octopus
                pull.twohead
                repack.useDeltaBaseOffset
 -              show.difftree
                showbranch.default
                tar.umask
                transfer.unpackLimit
                user.name
                user.email
                user.signingkey
 -              whatchanged.difftree
                branch. remote.
        "
  }
@@@ -1086,6 -1107,8 +1108,8 @@@ _git_remote (
  
  _git_reset ()
  {
+       __git_has_doubledash && return
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
  
  _git_shortlog ()
  {
+       __git_has_doubledash && return
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --*)
@@@ -1144,6 -1169,8 +1170,8 @@@ _git_stash (
  
  _git_submodule ()
  {
+       __git_has_doubledash && return
        local subcommands="add status init update"
        if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
                local cur="${COMP_WORDS[COMP_CWORD]}"
@@@ -1350,6 -1377,8 +1378,8 @@@ _git (
  
  _gitk ()
  {
+       __git_has_doubledash && return
        local cur="${COMP_WORDS[COMP_CWORD]}"
        local g="$(git rev-parse --git-dir 2>/dev/null)"
        local merge=""
diff --combined refs.c
--- 1/refs.c
--- 2/refs.c
+++ b/refs.c
@@@ -925,7 -925,7 +925,7 @@@ int delete_ref(const char *refname, con
                i = strlen(lock->lk->filename) - 5; /* .lock */
                lock->lk->filename[i] = 0;
                err = unlink(lock->lk->filename);
-               if (err) {
+               if (err && errno != ENOENT) {
                        ret = 1;
                        error("unlink(%s) failed: %s",
                              lock->lk->filename, strerror(errno));
@@@ -1412,10 -1412,6 +1412,10 @@@ int read_ref_at(const char *ref, unsign
        tz = strtoul(tz_c, NULL, 10);
        if (get_sha1_hex(logdata, sha1))
                die("Log %s is corrupt.", logfile);
 +      if (is_null_sha1(sha1)) {
 +              if (get_sha1_hex(logdata + 41, sha1))
 +                      die("Log %s is corrupt.", logfile);
 +      }
        if (msg)
                *msg = ref_msg(logdata, logend);
        munmap(log_mapped, mapsz);