git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] branch: add --unset-upstream option

From
Carlos Martín Nieto <cmn@elego.de>
Date
Aug 27, 2012, 17:30 UTC
Message-ID
<87a9xgnsxx.fsf@centaur.cmartin.tk>
In-Reply-To
<7vpq6h2tmk.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 30 quoted lines
> Carlos Martín Nieto <cmn@elego.de> writes:
>
>> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
>> index e9019ac..93e5d6e 100755
>> --- a/t/t3200-branch.sh
>> +++ b/t/t3200-branch.sh
>> @@ -383,6 +383,22 @@ test_expect_success 'use --set-upstream-to modify a particular branch' \
>>       test "$(git config branch.my13.remote)" = "." &&
>>       test "$(git config branch.my13.merge)" = "refs/heads/master"'
>>  
>> +test_expect_success 'test --unset-upstream on HEAD' \
>> +    'git branch my14
>> +     test_config branch.master.remote foo &&
>> +     test_config branch.master.merge foo &&
>> +     git branch --set-upstream-to my14 &&
>> +     git branch --unset-upstream &&
>> +     test_must_fail git config branch.master.remote &&
>> +     test_must_fail git config branch.master.merge'
>> +
>> +test_expect_success 'test --unset-upstream on a particular branch' \
>> +    'git branch my15
>> +     git branch --set-upstream-to master my14 &&
>> +     git branch --unset-upstream my14 &&
>> +     test_must_fail git config branch.my14.remote &&
>> +     test_must_fail git config branch.my14.merge'
>> +
>
> What should happen when you say "--unset-upstream" on a branch B
> that does not have B@{upstream}?  Should it fail?  Should it be
> silently ignored?  Is it undefined that we do not want to test?

I'd say it should be ignored, as the end result we want is for there to be no upstream information. What we do underneath is remove a couple of config options, wich doesn't fail if they didn't insist in the first place.

Would you like a test that makes sure two --unset-upstream in a row don't cause any errors?

   cmn
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 13 in “Improve branch UI for setting upstream information”
  1. 0/3 Improve branch UI for setting upstream informationCarlos Martín Nieto, Aug 20, 2012
  2. 1/3 branch: introduce --set-upstream-toCarlos Martín Nieto, Aug 20, 2012
  3. 2/3 branch: add --unset-upstream optionCarlos Martín Nieto, Aug 20, 2012
  4. Junio C HamanoAug 23, 2012
  5. Carlos Martín NietoAug 27, 2012
  6. Junio C HamanoAug 27, 2012
  7. Junio C HamanoAug 27, 2012
  8. Carlos Martín NietoAug 27, 2012
  9. 3/3 branch: suggest how to undo a --set-upstream when given one branchCarlos Martín Nieto, Aug 20, 2012
  10. Junio C HamanoAug 20, 2012
  11. Carlos Martín NietoAug 22, 2012
  12. 3/3 branch: deprecate --set-upstream and show help if we detect possible mistaken useCarlos Martín Nieto, Aug 23, 2012
  13. Junio C HamanoAug 23, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.