From: Junio C Hamano Date: Wed, 9 Jul 2008 07:19:50 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.6.0-rc0~101 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/bb293b831b9d0aade79c0acf5bf6091106e7d19b?ds=inline;hp=-c Merge branch 'maint' * 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 --- bb293b831b9d0aade79c0acf5bf6091106e7d19b diff --combined builtin-clone.c index 4a0f1ab8ac,7ee8275269..ec36209600 --- a/builtin-clone.c +++ b/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; @@@ -462,8 -459,7 +463,7 @@@ 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); @@@ -533,6 -529,9 +533,9 @@@ 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; diff --combined contrib/completion/git-completion.bash index cc75ad7ccd,cff28a88af..27332ed8b1 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -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 --*) @@@ -511,7 -525,9 +525,9 @@@ _git_bisect () { + __git_has_doubledash && return + - local subcommands="start bad good reset visualize replay log" + local subcommands="start bad good skip reset visualize replay log run" local subcommand="$(__git_find_subcommand "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" @@@ -519,7 -535,7 +535,7 @@@ 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=*) @@@ -762,9 -784,6 +784,9 @@@ --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 @@@ -1049,6 -1069,7 +1071,6 @@@ 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 --*) @@@ -1098,6 -1121,8 +1122,8 @@@ _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 index 6c6e9e5e19,c9bcf148b0..39a3b23804 --- a/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);