From 0b294c0abf00a9cf7468e0ea62722ae23b0816cc Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 8 Jul 2008 00:08:02 -0400 Subject: make deleting a missing ref more quiet If git attempts to delete a ref, but the unlink of the ref file fails, we print a message to stderr. This is usually a good thing, but if the error is ENOENT, then it indicates that the ref has _already_ been deleted. And since that's our goal, it doesn't make sense to complain to the user. This harmonizes the error reporting behavior for the unpacked and packed cases; the packed case already printed nothing on ENOENT, but the unpacked printed unconditionally. Additionally, send-pack would, when deleting the tracking ref corresponding to a remote delete, print "Failed to delete" on any failure. This can be a misleading message, since we actually _did_ delete at the remote side, but we failed to delete locally. Rather than make the message more precise, let's just eliminate it entirely; the delete_ref routine already takes care of printing out a much more specific message about what went wrong. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin-send-pack.c | 3 +-- refs.c | 2 +- t/t5404-tracking-branches.sh | 7 +++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/builtin-send-pack.c b/builtin-send-pack.c index d76260c09..a708d0af4 100644 --- a/builtin-send-pack.c +++ b/builtin-send-pack.c @@ -226,8 +226,7 @@ static void update_tracking_ref(struct remote *remote, struct ref *ref) if (args.verbose) fprintf(stderr, "updating local tracking ref '%s'\n", rs.dst); if (ref->deletion) { - if (delete_ref(rs.dst, NULL)) - error("Failed to delete"); + delete_ref(rs.dst, NULL); } else update_ref("update by push", rs.dst, ref->new_sha1, NULL, 0, 0); diff --git a/refs.c b/refs.c index 9e8e8581b..c9bcf148b 100644 --- a/refs.c +++ b/refs.c @@ -925,7 +925,7 @@ int delete_ref(const char *refname, const unsigned char *sha1) 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)); diff --git a/t/t5404-tracking-branches.sh b/t/t5404-tracking-branches.sh index 1493a92c0..64fe2615a 100755 --- a/t/t5404-tracking-branches.sh +++ b/t/t5404-tracking-branches.sh @@ -10,6 +10,7 @@ test_expect_success 'setup' ' git commit -m 1 && git branch b1 && git branch b2 && + git branch b3 && git clone . aa && git checkout b1 && echo b1 >>file && @@ -50,4 +51,10 @@ test_expect_success 'deleted branches have their tracking branches removed' ' test "$(git rev-parse origin/b1)" = "origin/b1" ' +test_expect_success 'already deleted tracking branches ignored' ' + git branch -d -r origin/b3 && + git push origin :b3 >output 2>&1 && + ! grep error output +' + test_done -- cgit v1.2.1 From 1db4a75c8d18d8827ac710e87219b349558d9196 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 8 Jul 2008 04:46:06 +0000 Subject: Remove unnecessary pack-*.keep file after successful git-clone Once a clone is successful we no longer need to hold onto the .keep file created by the transport. Delete the file so we can later repack the complete repository. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- builtin-clone.c | 7 +++++-- t/t5601-clone.sh | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/builtin-clone.c b/builtin-clone.c index 7bcc664e4..7ee827526 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -337,6 +337,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix) 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; @@ -458,8 +459,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix) 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); @@ -529,6 +529,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix) 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 --git a/t/t5601-clone.sh b/t/t5601-clone.sh index b642fb260..d785b3df7 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -17,14 +17,32 @@ test_expect_success setup ' ' -test_expect_success 'clone with excess parameters' ' +test_expect_success 'clone with excess parameters (1)' ' + rm -fr dst && + test_must_fail git clone -n src dst junk + +' + +test_expect_success 'clone with excess parameters (2)' ' + + rm -fr dst && test_must_fail git clone -n "file://$(pwd)/src" dst junk ' +test_expect_success 'clone does not keep pack' ' + + rm -fr dst && + git clone -n "file://$(pwd)/src" dst && + ! test -f dst/file && + ! (echo dst/.git/objects/pack/pack-* | grep "\.keep") + +' + test_expect_success 'clone checks out files' ' + rm -fr dst && git clone src dst && test -f dst/file -- cgit v1.2.1 From d773c6314d5660266313772b3fd8a466c3dbc559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Tue, 8 Jul 2008 18:56:14 +0200 Subject: bash: offer only paths after '--' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many git commands use '--' to separate subcommands, options, and refs from paths. However, the programmable completion for several of these commands does not respect the '--', and offer subcommands, options, or refs after a '--', although only paths are permitted. e.g. 'git bisect -- ' offers subcommands, 'git log -- --' offers options and 'git log -- git' offers all gitgui tags. The completion for the following commands share this wrong behaviour: am add bisect commit diff log reset shortlog submodule gitk. To avoid this, we check the presence of a '--' on the command line first and let the shell do filename completion, if one is found. Signed-off-by: SZEDER Gábor Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 0eb8df020..cff28a88a 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -451,6 +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 @@ _git_apply () _git_add () { + __git_has_doubledash && return + local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) @@ -511,6 +525,8 @@ _git_add () _git_bisect () { + __git_has_doubledash && return + local subcommands="start bad good reset visualize replay log" local subcommand="$(__git_find_subcommand "$subcommands")" if [ -z "$subcommand" ]; then @@ -613,6 +629,8 @@ _git_cherry_pick () _git_commit () { + __git_has_doubledash && return + local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) @@ -632,6 +650,8 @@ _git_describe () _git_diff () { + __git_has_doubledash && return + local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) @@ -734,6 +754,8 @@ _git_ls_tree () _git_log () { + __git_has_doubledash && return + local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --pretty=*) @@ -1085,6 +1107,8 @@ _git_remote () _git_reset () { + __git_has_doubledash && return + local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) @@ -1097,6 +1121,8 @@ _git_reset () _git_shortlog () { + __git_has_doubledash && return + local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) @@ -1143,6 +1169,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]}" @@ -1349,6 +1377,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="" -- cgit v1.2.1 From e9656473342e050494c8ea8416fdfdcf52fd1c93 Mon Sep 17 00:00:00 2001 From: Mark Levedahl Date: Mon, 7 Jul 2008 22:36:40 -0400 Subject: git-submodule - Fix bugs in adding an existing repo as a module git-submodule add would trip if path to the submodule included a space, or if its .git was a gitdir: link to a GIT_DIR kept elsewhere. Fix both. Signed-off-by: Mark Levedahl Signed-off-by: Junio C Hamano --- git-submodule.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 3eb78cc72..099a7d756 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -167,8 +167,7 @@ cmd_add() # perhaps the path exists and is already a git repo, else clone it if test -e "$path" then - if test -d "$path/.git" && - test "$(unset GIT_DIR; cd $path; git rev-parse --git-dir)" = ".git" + if test -d "$path"/.git -o -f "$path"/.git then echo "Adding existing repo at '$path' to the index" else -- cgit v1.2.1 From e09c4e753c337d914f4eb7a05cb5e8bbfc362489 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 8 Jul 2008 23:57:14 -0700 Subject: Start preparing release notes for 1.5.6.3 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.5.6.3.txt | 42 ++++++++++++++++++++++++++++++++++++++ RelNotes | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Documentation/RelNotes-1.5.6.3.txt diff --git a/Documentation/RelNotes-1.5.6.3.txt b/Documentation/RelNotes-1.5.6.3.txt new file mode 100644 index 000000000..dd0559b64 --- /dev/null +++ b/Documentation/RelNotes-1.5.6.3.txt @@ -0,0 +1,42 @@ +GIT v1.5.6.3 Release Notes +========================== + +Fixes since v1.5.6.2 +-------------------- + +* Setting GIT_TRACE will report spawning of external process via run_command(). + +* Bash completion script did not notice '--' marker on the command + line and tried the relatively slow "ref completion" even when + completing arguments after one. + +* Registering a non-empty blob racily and then truncating the working + tree file for it confused "racy-git avoidance" logic into thinking + that the path is now unchanged. + +* "git clone" had a leftover debugging fprintf(). + +* "git clone -q" was not quiet enough as it used to and gave object count + and progress reports. + +* "git clone" marked downloaded packfile with .keep; this could be a + good thing if the remote side is well packed but otherwise not, + especially for a project that is not really big. + +* The section that describes attributes related to git-archive were placed + in a wrong place in the gitattributes(5) manual page. + +* When "git push" tries to remove a remote ref, and corresponding + tracking ref is missing, we used to report error (i.e. failure to + remove something that does not exist). + +* "git mailinfo" (hence "git am") did not handle commit log messages in a + MIME multipart mail correctly. + +Contains other various documentation fixes. + +-- +exec >/var/tmp/1 +O=v1.5.6.2-23-ge965647 +echo O=$(git describe maint) +git shortlog --no-merges $O..maint diff --git a/RelNotes b/RelNotes index 007216001..a2b8043c8 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes-1.5.6.2.txt \ No newline at end of file +Documentation/RelNotes-1.5.6.3.txt \ No newline at end of file -- cgit v1.2.1