summaryrefslogtreecommitdiff
path: root/t/t5516-fetch-push.sh
AgeCommit message (Collapse)AuthorFilesLines
2013-04-18Merge branch 'jc/push-2.0-default-to-simple' (early part)Libravatar Junio C Hamano1-5/+7
Adjust our tests for upcoming migration of the default value for the "push.default" configuration variable to "simple" from "mixed". * 'jc/push-2.0-default-to-simple' (early part): t5570: do not assume the "matching" push is the default t5551: do not assume the "matching" push is the default t5550: do not assume the "matching" push is the default t9401: do not assume the "matching" push is the default t9400: do not assume the "matching" push is the default t7406: do not assume the "matching" push is the default t5531: do not assume the "matching" push is the default t5519: do not assume the "matching" push is the default t5517: do not assume the "matching" push is the default t5516: do not assume the "matching" push is the default t5505: do not assume the "matching" push is the default t5404: do not assume the "matching" push is the default
2013-04-07Merge branch 'rr/triangle'Libravatar Junio C Hamano1-138/+184
Support "pull from one place, push to another place" workflow better by introducing remote.pushdefault (overrides the "origin" thing) and branch.*.pushremote (overrides the branch.*.remote). * rr/triangle: remote.c: introduce branch.<name>.pushremote remote.c: introduce remote.pushdefault remote.c: introduce a way to have different remotes for fetch/push t5516 (fetch-push): drop implicit arguments from helper functions t5516 (fetch-push): update test description remote.c: simplify a bit of code using git_config_string()
2013-04-03Merge branch 'jc/t5516-pushInsteadOf-vs-pushURL'Libravatar Junio C Hamano1-3/+3
Update a test to match the documented interaction between pushURL and pushInsteadOf. * jc/t5516-pushInsteadOf-vs-pushURL: t5516: test interaction between pushURL and pushInsteadOf correctly
2013-04-02remote.c: introduce branch.<name>.pushremoteLibravatar Ramkumar Ramachandra1-0/+15
This new configuration variable overrides `remote.pushdefault` and `branch.<name>.remote` for pushes. When you pull from one place (e.g. your upstream) and push to another place (e.g. your own publishing repository), you would want to set `remote.pushdefault` to specify the remote to push to for all branches, and use this option to override it for a specific branch. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-02remote.c: introduce remote.pushdefaultLibravatar Ramkumar Ramachandra1-0/+12
This new configuration variable defines the default remote to push to, and overrides `branch.<name>.remote` for all branches. It is useful in the typical triangular-workflow setup, where the remote you're fetching from is different from the remote you're pushing to. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-02t5516 (fetch-push): drop implicit arguments from helper functionsLibravatar Jeff King1-137/+145
Many of the tests in t5516 look like: mk_empty && git push testrepo ... && check_push_result $commit heads/master It's reasonably easy to see what is being tested, with the exception that "testrepo" is a magic global name (it is implicitly used in the helpers, but we have to name it explicitly when calling git directly). Let's make it explicit when call the helpers, too. This is slightly more typing, but makes the test snippets read more naturally. It also makes it easy for future tests to use an alternate or multiple repositories, without a proliferation of helper functions. [rr: fixed sloppy quoting] Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-02t5516 (fetch-push): update test descriptionLibravatar Ramkumar Ramachandra1-1/+12
The file was originally created in bcdb34f (Test wildcard push/fetch, 2007-06-08), and only contained tests that exercised wildcard functionality at the time. In subsequent commits, many other tests unrelated to wildcards were added but the test description was never updated. Fix this. Helped-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-01Merge branch 'jn/push-tests'Libravatar Junio C Hamano1-91/+65
Update t5516 with style fixes. * jn/push-tests: push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi' push test: simplify check of push result push test: use test_config when appropriate
2013-03-28t5516: test interaction between pushURL and pushInsteadOf correctlyLibravatar Junio C Hamano1-3/+3
1c2eafb89bca (Add url.<base>.pushInsteadOf: URL rewriting for push only, 2009-09-07) wants to make sure that a push destination read from URL is not rewritten by pushInsteadOf because an explicit pushURL exists; for that, a pushInsteadOf rewrite rule for the value of remote.r.URL is set to a non-existent is set up. We would also want to make sure that pushInsteadOf rewrite rule is not applied to the location read from pushURL. This way, we will make sure that - "testrepo/" (pushURL) gets updated; - the push does not try to update "trash2/" (the result of applying pushInsteadOf to pushURL); - the push does not try to update "trash3/" (the result of applying pushInsteadOf to URL). Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-25Merge branch 'jc/push-follow-tag'Libravatar Junio C Hamano1-0/+73
The new "--follow-tags" option tells "git push" to push relevant annotated tags when pushing branches out. * jc/push-follow-tag: push: --follow-tags commit.c: use clear_commit_marks_many() in in_merge_bases_many() commit.c: add in_merge_bases_many() commit.c: add clear_commit_marks_many()
2013-03-21Merge branch 'jc/fetch-raw-sha1'Libravatar Junio C Hamano1-0/+34
Allows requests to fetch objects at any tip of refs (including hidden ones). It seems that there may be use cases even outside Gerrit (e.g. $gmane/215701). * jc/fetch-raw-sha1: fetch: fetch objects by their exact SHA-1 object names upload-pack: optionally allow fetching from the tips of hidden refs fetch: use struct ref to represent refs to be fetched parse_fetch_refspec(): clarify the codeflow a bit
2013-03-19push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi'Libravatar Jonathan Nieder1-11/+4
When it is unclear which command from a test has failed, usual practice these days is to debug by running the test again with "sh -x" instead of relying on debugging 'echo' statements. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-19push test: simplify check of push resultLibravatar Jonathan Nieder1-63/+51
This test checks each ref with code like the following: r=$(git show-ref -s --verify refs/$ref) && test "z$r" = "z$the_first_commit" Afterward it counts refs: test 1 = $(git for-each-ref refs/remotes/origin | wc -l) Simpler to test the number and values of relevant refs in for-each-ref output at the same time using test_cmp. This makes the test more readable and provides more helpful "./t5516-push-push.sh -v" output when the test fails. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-19push test: use test_config when appropriateLibravatar Jonathan Nieder1-17/+10
Configuration from test_config does not last beyond the end of the current test assertion, making each test easier to think about in isolation. This changes the meaning of some of the tests. For example, currently "push with insteadOf" passes even if the line setting "url.$TRASH.pushInsteadOf" is dropped because an url.$TRASH.insteadOf setting leaks in from a previous test. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-05push: --follow-tagsLibravatar Junio C Hamano1-0/+73
The new option "--follow-tags" tells "git push" to push annotated tags that are missing from the other side and that can be reached by the history that is otherwise pushed out. For example, if you are using the "simple", "current", or "upstream" push, you would ordinarily push the history leading to the commit at your current HEAD and nothing else. With this option, you would also push all annotated tags that can be reached from that commit to the other side. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-17Merge branch 'jc/hidden-refs'Libravatar Junio C Hamano1-0/+27
Allow the server side to redact the refs/ namespace it shows to the client. Will merge to 'master'. * jc/hidden-refs: upload/receive-pack: allow hiding ref hierarchies upload-pack: simplify request validation upload-pack: share more code
2013-02-07fetch: fetch objects by their exact SHA-1 object namesLibravatar Junio C Hamano1-0/+34
Teach "git fetch" to accept an exact SHA-1 object name the user may obtain out of band on the LHS of a pathspec, and send it on a "want" message when the server side advertises the allow-tip-sha1-in-want capability. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-07upload/receive-pack: allow hiding ref hierarchiesLibravatar Junio C Hamano1-0/+27
A repository may have refs that are only used for its internal bookkeeping purposes that should not be exposed to the others that come over the network. Teach upload-pack to omit some refs from its initial advertisement by paying attention to the uploadpack.hiderefs multi-valued configuration variable. Do the same to receive-pack via the receive.hiderefs variable. As a convenient short-hand, allow using transfer.hiderefs to set the value to both of these variables. Any ref that is under the hierarchies listed on the value of these variable is excluded from responses to requests made by "ls-remote", "fetch", etc. (for upload-pack) and "push" (for receive-pack). Because these hidden refs do not count as OUR_REF, an attempt to fetch objects at the tip of them will be rejected, and because these refs do not get advertised, "git push :" will not see local branches that have the same name as them as "matching" ones to be sent. An attempt to update/delete these hidden refs with an explicit refspec, e.g. "git push origin :refs/hidden/22", is rejected. This is not a new restriction. To the pusher, it would appear that there is no such ref, so its push request will conclude with "Now that I sent you all the data, it is time for you to update the refs. I saw that the ref did not exist when I started pushing, and I want the result to point at this commit". The receiving end will apply the compare-and-swap rule to this request and rejects the push with "Well, your update request conflicts with somebody else; I see there is such a ref.", which is the right thing to do. Otherwise a push to a hidden ref will always be "the last one wins", which is not a good default. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-16push: fix "refs/tags/ hierarchy cannot be updated without --force"Libravatar Junio C Hamano1-21/+0
When pushing to update a branch with a commit that is not a descendant of the commit at the tip, a wrong message "already exists" was given, instead of the correct "non-fast-forward", if we do not have the object sitting in the destination repository at the tip of the ref we are updating. The primary cause of the bug is that the check in a new helper function is_forwardable() assumed both old and new objects are available and can be checked, which is not always the case. The way the caller uses the result of this function is also wrong. If the helper says "we do not want to let this push go through", the caller unconditionally translates it into "we blocked it because the destination already exists", which is not true at all in this case. Fix this by doing these three things: * Remove unnecessary not_forwardable from "struct ref"; it is only used inside set_ref_status_for_push(); * Make "refs/tags/" the only hierarchy that cannot be replaced without --force; * Remove the misguided attempt to force that everything that updates an existing ref has to be a commit outside "refs/tags/" hierarchy. The policy last one tried to implement may later be resurrected and extended to ensure fast-forwardness (defined as "not losing objects", extending from the traditional "not losing commits from the resulting history") when objects that are not commit are involved (e.g. an annotated tag in hierarchies outside refs/tags), but such a logic belongs to "is this a fast-forward?" check that is done by ref_newer(); is_forwardable(), which is now removed, was not the right place to do so. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-04t5516: do not assume the "matching" push is the defaultLibravatar Junio C Hamano1-5/+5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-02push: require force for annotated tagsLibravatar Chris Rorvick1-0/+21
Do not allow fast-forwarding of references that point to a tag object. Updating from a tag is potentially destructive since it would likely leave the tag dangling. Disallowing updates to a tag also makes sense semantically and is consistent with the behavior of lightweight tags. Signed-off-by: Chris Rorvick <chris@rorvick.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-02push: require force for refs under refs/tags/Libravatar Chris Rorvick1-1/+22
References are allowed to update from one commit-ish to another if the former is an ancestor of the latter. This behavior is oriented to branches which are expected to move with commits. Tag references are expected to be static in a repository, though, thus an update to something under refs/tags/ should be rejected unless the update is forced. Signed-off-by: Chris Rorvick <chris@rorvick.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-22push: add '--prune' optionLibravatar Felipe Contreras1-0/+16
When pushing groups of refs to a remote, there is no simple way to remove old refs that still exist at the remote that is no longer updated from us. This will allow us to remove such refs from the remote. With this change, running this command $ git push --prune remote refs/heads/*:refs/remotes/laptop/* removes refs/remotes/laptop/foo from the remote if we do not have branch "foo" locally anymore. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-30receive-pack: don't pass non-existent refs to post-{receive,update} hooksLibravatar Pang Yan Han1-0/+197
When a push specifies deletion of non-existent refs, the post post-receive and post-update hooks receive them as input/arguments. For instance, for the following push, where refs/heads/nonexistent is a ref which does not exist on the remote side: git push origin :refs/heads/nonexistent the post-receive hook receives from standard input: <null-sha1> SP <null-sha1> SP refs/heads/nonexistent and the post-update hook receives as arguments: refs/heads/nonexistent which does not make sense since it is a no-op. Teach receive-pack not to pass non-existent refs to the post-receive and post-update hooks. If the push only attempts to delete non-existent refs, these hooks are not even called. The update and pre-receive hooks are still notified about attempted deletion of non-existent refs to give them a chance to inspect the situation and act on it. [jc: mild fix-ups to avoid introducing an extra list; also added fixes to some tests] Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-16Fix typo: existant->existentLibravatar Dmitry Ivankov1-5/+5
refs.c had a error message "Trying to write ref with nonexistant object". And no tests relied on the wrong spelling. Also typo was present in some test scripts internals, these tests still pass. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09tests: add missing &&Libravatar Jonathan Nieder1-4/+4
Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain. Commands intended to fail should be marked with !, test_must_fail, or test_might_fail. The examples in this patch do not require that. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-21Merge branch 'js/maint-receive-pack-symref-alias'Libravatar Junio C Hamano1-23/+95
* js/maint-receive-pack-symref-alias: t5516-fetch-push.sh: style cleanup receive-pack: detect aliased updates which can occur with symrefs receive-pack: switch global variable 'commands' to a parameter Conflicts: t/t5516-fetch-push.sh
2010-05-20start_command: close cmd->err descriptor when fork/spawn failsLibravatar bert Dvornik1-1/+1
Fix the problem where the cmd->err passed into start_command wasn't being properly closed when certain types of errors occurr. (Compare the affected code with the clean shutdown code later in the function.) On Windows, this problem would be triggered if mingw_spawnvpe() failed, which would happen if the command to be executed was malformed (e.g. a text file that didn't start with a #! line). If cmd->err was a pipe, the failure to close it could result in a hang while the other side was waiting (forever) for either input or pipe close, e.g. while trying to shove the output into the side band. On msysGit, this problem was causing a hang in t5516-fetch-push. [J6t: With a slight adjustment of the test case, the hang is also observed on Linux.] Signed-off-by: bert Dvornik <dvornik+git@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19t5516-fetch-push.sh: style cleanupLibravatar Jay Soffian1-23/+46
Cleanup t5516-fetch-push.sh to use prevailing test script style Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19receive-pack: detect aliased updates which can occur with symrefsLibravatar Jay Soffian1-0/+49
When pushing to a remote repo the sending side filters out aliased updates (e.g., foo:baz bar:baz). However, it is not possible for the sender to know if two refs are aliased on the receiving side via symrefs. Here is one such scenario: $ git init origin $ (cd origin && touch file && git add file && git commit -a -m intial) $ git clone --bare origin origin.git $ rm -rf origin $ git clone origin.git client $ git clone --mirror client backup.git && $ (cd backup.git && git remote set-head origin --auto) $ (cd client && git remote add --mirror backup ../backup.git && echo change1 > file && git commit -a -m change1 && git push origin && git push backup ) The push to backup fails with: Counting objects: 5, done. Writing objects: 100% (3/3), 244 bytes, done. Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. error: Ref refs/remotes/origin/master is at ef3... but expected 262... remote: error: failed to lock refs/remotes/origin/master To ../backup.git 262cd57..ef307ff master -> master 262cd57..ef307ff origin/HEAD -> origin/HEAD ! [remote rejected] origin/master -> origin/master (failed to lock) error: failed to push some refs to '../backup.git' The reason is that refs/remotes/origin/HEAD is a symref to refs/remotes/origin/master, but it is not possible for the sending side to unambiguously know this. This commit fixes the issue by having receive-pack ignore any update to a symref whose target is being identically updated. If a symref and its target are being updated inconsistently, then the update for both fails with an error message ("refusing inconsistent update...") to help diagnose the situation. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-11t5516: Use test_cmp when appropriateLibravatar Junio C Hamano1-3/+3
Consistently using test_cmp would make debugging test scripts far easier, as output from them run under "-v" option becomes readable. Besides, some platforms' "diff" implementations lack "-q" option. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-28git-push: add tests for git push --porcelainLibravatar Larry D'Anna1-0/+50
Verify that the output format is correct for successful, rejected, and flagrantly erroneous pushes. Signed-off-by: Larry D'Anna <larry@elder-gods.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-10Merge branch 'jk/push-to-delete'Libravatar Junio C Hamano1-0/+26
* jk/push-to-delete: builtin-push: add --delete as syntactic sugar for :foo
2009-12-30builtin-push: add --delete as syntactic sugar for :fooLibravatar Jan Krüger1-0/+26
Refspecs without a source side have been reported as confusing by many. As an alternative, this adds support for commands like: git push origin --delete somebranch git push origin --delete tag sometag Specifically, --delete will prepend a colon to all colon-less refspecs given on the command line, and will refuse to accept refspecs with colons to prevent undue confusion. Signed-off-by: Jan Krüger <jk@jk.gs> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-26Merge branch 'jc/1.7.0-push-safety'Libravatar Junio C Hamano1-0/+1
* jc/1.7.0-push-safety: Refuse deleting the current branch via push Refuse updating the current branch in a non-bare repository via push
2009-09-08Add url.<base>.pushInsteadOf: URL rewriting for push onlyLibravatar Josh Triplett1-0/+47
This configuration option allows systematically rewriting fetch-only URLs to push-capable URLs when used with push. For instance: [url "ssh://example.org/"] pushInsteadOf = "git://example.org/" This will allow clones of "git://example.org/path/to/repo" to subsequently push to "ssh://example.org/path/to/repo", without manually configuring pushurl for that remote. Includes documentation for the new option, bash completion updates, and test cases (both that pushInsteadOf applies to push, that it does not apply to fetch, and that it is ignored when pushURL is already defined). Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-29Refuse updating the current branch in a non-bare repository via pushLibravatar Junio C Hamano1-0/+1
This makes git-push refuse pushing into a non-bare repository to update the current branch by default. To help people who are used to be able to do this (and later "reset --hard" it in some other way), an error message is issued when this refusal is triggered, instructing how to resurrect the old behaviour. Hosting sites that do not give the users direct access to customize their repositories (e.g. repo.or.cz, gitorious, github etc.) may further want to explicitly set the configuration variable to "refuse" for their customers' repositories. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-09t5516: Check pushurl config settingLibravatar Michael J Gruber1-0/+13
Check whether the new remote.${remotename}.pushurl setting is obeyed and whether it overrides remote.${remotename}.url. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-03receive-pack: explain what to do when push updates the current branchLibravatar Junio C Hamano1-3/+3
This makes "git push" issue a more detailed instruction when a user pushes into the current branch of a non-bare repository without having an explicit configuration set to receive.denycurrentbranch. In such a case, it will also tell the user that the default will change to refusal in a future version of git. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-12Merge branch 'mk/maint-cg-push'Libravatar Junio C Hamano1-0/+50
* mk/maint-cg-push: git push: Interpret $GIT_DIR/branches in a Cogito compatible way Conflicts: t/t5516-fetch-push.sh
2008-11-11git push: Interpret $GIT_DIR/branches in a Cogito compatible wayLibravatar Martin Koegler1-0/+50
Current git versions ignore everything after # (called <head> in the following) when pushing. Older versions (before cf818348f1ab57), interpret #<head> as part of the URL, which make git bail out. As branches origin from Cogito, it is the best to correct this by using the behaviour of cg-push, that is to push HEAD to remote refs/heads/<head>. Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-09receive-pack: detect push to current branch of non-bare repoLibravatar Jeff King1-0/+37
Pushing into the currently checked out branch of a non-bare repository can be dangerous; the HEAD then loses sync with the index and working tree, and it looks in the receiving repo as if the pushed changes have been reverted in the index (since they were never there in the first place). This patch adds a safety valve that checks for this condition and either generates a warning or denies the update. We trigger the check only on a non-bare repository, since a bare repo does not have a working tree (and in fact, pushing to the HEAD branch is a common workflow for publishing repositories). The behavior is configurable via receive.denyCurrentBranch, defaulting to "warn" so as not to break existing setups (though it may, after a deprecation period, switch to "refuse" by default). For users who know what they are doing and want to silence the warning (e.g., because they have a post-receive hook that reconciles the HEAD and working tree), they can turn off the warning by setting it to false or "ignore". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-09t5516: refactor oddball testsLibravatar Jeff King1-29/+21
t5516 sets up some utility functions for starting each test with a clean slate. However, there were a few tests added that do not use these functions, but instead make their own repositories. Let's bring these in line with the rest of the tests. Not only do we reduce the number of lines, but these tests will benefit from any further enhancements to the utility scripts. The conversion is pretty straightforward. Most of the tests created a parent/child clone relationship, for which we now use 'testrepo' as the parent. One test looked in testrepo, but relied on previous tests to have set it up; it now sets up testrepo explicitly, which makes it a bit more robust to changes in the script, as well. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-05push: fix local refs update if already up-to-dateLibravatar Clemens Buchacher1-0/+31
git push normally updates local refs only after a successful push. If the remote already has the updates -- pushed indirectly through another repository, for example -- we forget to update local tracking refs. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13t/: Use "test_must_fail git" instead of "! git"Libravatar Stephan Beyer1-4/+4
This patch changes every occurrence of "! git" -- with the meaning that a git call has to gracefully fail -- into "test_must_fail git". This is useful to - make sure the test does not fail because of a signal, e.g. SIGSEGV, and - advertise the use of "test_must_fail" for new tests. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-03Fix t5516 on cygwin: it does not like double slashes at the beginning of a pathLibravatar Alex Riesen1-1/+1
The double slashes "//" result from url./$TRASH/. expansion and the current directory, which even in cygwin contains "/" as first character. In cygwin such strings have special meaning: UNC path. Accessing an UNC path built for test purpose usually fails. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-23Merge branch 'pb/push'Libravatar Junio C Hamano1-0/+41
* pb/push: add special "matching refs" refspec
2008-05-05Fix tests breaking when checkout path contains shell metacharactersLibravatar Bryan Donlan1-3/+3
This fixes the remainder of the issues where the test script itself is at fault for failing when the git checkout path contains whitespace or other shell metacharacters. The majority of git svn tests used the idiom test_expect_success "title" "test script using $svnrepo" These were changed to have the test script in single-quotes: test_expect_success "title" 'test script using "$svnrepo"' which unfortunately makes the patch appear larger than it really is. One consequence of this change is that in the verbose test output the value of $svnrepo (and in some cases other variables, too) is no longer expanded, i.e. previously we saw * expecting success: test script using /path/to/git/t/trash/svnrepo but now it is: * expecting success: test script using "$svnrepo" Signed-off-by: Bryan Donlan <bdonlan@fushizen.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-04add special "matching refs" refspecLibravatar Paolo Bonzini1-0/+41
This patch provides a way to specify "push matching heads" using a special refspec ":". This is useful because it allows "push = +:" as a way to specify that matching refs will be pushed but, in addition, forced updates will be allowed, which was not possible before. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-24push: allow unqualified dest refspecs to DWIMLibravatar Jeff King1-0/+40
Previously, a push like: git push remote src:dst would go through the following steps: 1. check for an unambiguous 'dst' on the remote; if it exists, then push to that ref 2. otherwise, check if 'dst' begins with 'refs/'; if it does, create a new ref 3. otherwise, complain because we don't know where in the refs hierarchy to put 'dst' However, in some cases, we can guess about the ref type of 'dst' based on the ref type of 'src'. Specifically, before complaining we now check: 2.5. if 'src' resolves to a ref starting with refs/heads or refs/tags, then prepend that to 'dst' So now this creates a new branch on the remote, whereas it previously failed with an error message: git push master:newbranch Note that, by design, we limit this DWIM behavior only to source refs which resolve exactly (including symrefs which resolve to existing refs). We still complain on a partial destination refspec if the source is a raw sha1, or a ref expression such as 'master~10'. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>