From f23d1f76273a59b030ea1028016e6a9fc9679d2c Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 3 Mar 2008 20:30:16 +0100 Subject: [PATCH 1/4] Fix random crashes in http_cleanup() For some reason, http_cleanup was running all active slots, which could lead in situations where a freed slot would be accessed in fill_active_slots. OTOH, we are cleaning up, which means the caller doesn't care about pending requests. Just forget about them instead or running them. Signed-off-by: Mike Hommey Signed-off-by: Junio C Hamano --- http.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/http.c b/http.c index 5925d07478..c7deccb6de 100644 --- a/http.c +++ b/http.c @@ -281,23 +281,15 @@ void http_init(void) void http_cleanup(void) { struct active_request_slot *slot = active_queue_head; -#ifdef USE_CURL_MULTI - char *wait_url; -#endif while (slot != NULL) { struct active_request_slot *next = slot->next; + if (slot->curl != NULL) { #ifdef USE_CURL_MULTI - if (slot->in_use) { - curl_easy_getinfo(slot->curl, - CURLINFO_EFFECTIVE_URL, - &wait_url); - fprintf(stderr, "Waiting for %s\n", wait_url); - run_active_slot(slot); - } + curl_multi_remove_handle(curlm, slot->curl); #endif - if (slot->curl != NULL) curl_easy_cleanup(slot->curl); + } free(slot); slot = next; } From e6d1f76ccf9de037c5479acdd9b6211e80145142 Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Mon, 3 Mar 2008 09:22:03 +0000 Subject: [PATCH 2/4] git-merge.sh: better handling of combined --squash,--no-ff,--no-commit options git-merge used to use either the --squash,--no-squash, --no-ff,--ff, --no-commit,--commit option, whichever came last in the command line. This lead to some un-intuitive behavior, having git merge --no-commit --no-ff actually commit the merge. Now git-merge respects --no-commit together with --no-ff, as well as other combinations of the options. However, this broke a selftest in t/t7600-merge.sh which expected to have --no-ff completely override the --squash option, so that git merge --squash --no-ff fast-forwards, and makes a merge commit; combining --squash with --no-ff doesn't really make sense though, and is now refused by git-merge. The test is adapted to test --no-ff without the preceding --squash, and another test is added to make sure the --squash --no-ff combination is refused. The unexpected behavior was reported by John Goerzen through http://bing.sdebian.org/468568 Signed-off-by: Gerrit Pape Signed-off-by: Junio C Hamano --- git-merge.sh | 17 +++++++++++------ t/t7600-merge.sh | 6 ++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/git-merge.sh b/git-merge.sh index 1c123a37e6..03cd39873a 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -37,6 +37,7 @@ use_strategies= allow_fast_forward=t allow_trivial_merge=t +squash= no_commit= dropsave() { rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \ @@ -152,17 +153,21 @@ parse_config () { --summary) show_diffstat=t ;; --squash) - allow_fast_forward=t squash=t no_commit=t ;; + test "$allow_fast_forward" = t || + die "You cannot combine --squash with --no-ff." + squash=t no_commit=t ;; --no-squash) - allow_fast_forward=t squash= no_commit= ;; + squash= no_commit= ;; --commit) - allow_fast_forward=t squash= no_commit= ;; + no_commit= ;; --no-commit) - allow_fast_forward=t squash= no_commit=t ;; + no_commit=t ;; --ff) - allow_fast_forward=t squash= no_commit= ;; + allow_fast_forward=t ;; --no-ff) - allow_fast_forward=false squash= no_commit= ;; + test "$squash" != t || + die "You cannot combine --squash with --no-ff." + allow_fast_forward=f ;; -s|--strategy) shift case " $all_strategies " in diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index 50c51c82fa..5d166280cb 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -419,6 +419,7 @@ test_debug 'gitk --all' test_expect_success 'merge c0 with c1 (no-ff)' ' git reset --hard c0 && + git config branch.master.mergeoptions "" && test_tick && git merge --no-ff c1 && verify_merge file result.1 && @@ -427,6 +428,11 @@ test_expect_success 'merge c0 with c1 (no-ff)' ' test_debug 'gitk --all' +test_expect_success 'combining --squash and --no-ff is refused' ' + test_must_fail git merge --squash --no-ff c1 && + test_must_fail git merge --no-ff --squash c1 +' + test_expect_success 'merge c0 with c1 (ff overrides no-ff)' ' git reset --hard c0 && git config branch.master.mergeoptions "--no-ff" && From 81646ad247955a8343b58f05f12157dacabe1e5e Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Mon, 3 Mar 2008 18:52:49 +0100 Subject: [PATCH 3/4] Fix incorrect wording in git-merge.txt. A merge is not necessarily with a remote branch, it can be with any commit. Thanks to Paolo Ciarrocchi for pointing out the problem, and to Nicolas Pitre for pointing out the fact that a merge is not necessarily with a branch head. Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- Documentation/git-merge.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 0c9ad7f2bb..c136b10692 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -68,7 +68,8 @@ HOW MERGE WORKS --------------- A merge is always between the current `HEAD` and one or more -remote branch heads, and the index file must exactly match the +commits (usually, branch head or tag), and the index file must +exactly match the tree of `HEAD` commit (i.e. the contents of the last commit) when it happens. In other words, `git-diff --cached HEAD` must report no changes. From 52dce39762fbec75b2d561e5dedb25b8e51f83eb Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 4 Mar 2008 01:00:36 -0500 Subject: [PATCH 4/4] Fix 'git remote show' regression on empty repository in 1.5.4 Back in 18f7c51c we switched git-ls-remote/git-peek-remote to use the transport backend, rather than do everything itself. As part of that switch we started to produce a non-zero exit status if no refs were received from the remote peer, which happens when the remote peer has no commits pushed to it yet. (E.g. "git --git-dir=foo.git init; git ls-remote foo.git") Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- builtin-ls-remote.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c index 6dd31d1dd6..720280e390 100644 --- a/builtin-ls-remote.c +++ b/builtin-ls-remote.c @@ -94,10 +94,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack); ref = transport_get_remote_refs(transport); - - if (!ref) - return 1; - for ( ; ref; ref = ref->next) { if (!check_ref_type(ref, flags)) continue;