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

Re: [BUG] git show <remote>: bad information: Local ref configured if push.default=tracking

From
SRSeth Robertson <in-gitvger@baka.org>
Date
Nov 13, 2010, 01:44 UTC
Message-ID
<201011130144.oAD1iBeK022905@no.baka.org>
In-Reply-To
<20101113010934.GA4017@burratino>
In message <20101113010934.GA4017@burratino>, Jonathan Nieder writes:
    On Fri, Nov 12, 2010 at 07:41:39PM -0500, Seth Robertson wrote:
    > Not having inspected the code, it certainly appears as if the "Local
    > branch configured" and "Local ref configured" information is only
    > accidentally correct, but since the normal configuration is the case
    > in which it is accurate, no-one noticed the problem.
    However, if you want the push-to-where-you-pull-from behavior,
    just add
	    [push]
		    default = tracking
    to your ~/.gitconfig.

I already had this turned on in my ~/.gitconfig. However, you bring up a good point, the output as shown would be correct if the default "matching" value was used. Thus I guess the bug summary needs to be:

git show <remote> produces inaccurate information about "Local ref configured" if git-config's push.default==tracking

    For your test example: rather than sample output, could you describe
    next to each command what you expect to happen and how that differs
    from what happens instead?  This would make it easier to find the
    lurking bugs.

In my example, I set up each remote identically and only varied the name of the branch. In all cases, you could push and pull changes using `git pull` and `git push`, meaning that they were properly configured tracking branches. Thus, I argue that they should produce information for "Local ref configured" in each case, and furthermore that the named refs should be appropriate for the mapping in question.

I'll annotate the output below with my desired behavior. Search for "^**" in the output below.

In other news, the last argument of the last command of the Test case prep should have been bar/foo_master instead of bar/master. This affects the "git remote show bar" subcase output, showing that the "Local branch configured" information is correct. The "Local ref configured" information remains incorrect/obscure. I updated the test case to include the push.default=tracking configuration.

					-Seth Robertson

---------------------------------------------------------------------- mkdir foo; cd foo; git init; echo A>A; git add A; git commit -m A; git checkout -b other; echo B>B; git add B; git commit -m B; git checkout master; git config push.default tracking

mkdir ../bar; cd ../bar; git init; git remote add foo ../foo; git fetch foo; git checkout --track -b foo_master foo/other git config push.default tracking

mkdir ../baz; cd ../baz; git init; git remote add foo ../foo; git fetch foo; git checkout --track -b master foo/master git config push.default tracking

mkdir ../biff; cd ../biff; git init; git remote add foo ../foo; git fetch foo; git checkout --track -b master foo/master; git remote add baz ../baz; git fetch baz; git checkout --track -b baz_master baz/master git remote add bar ../bar; git fetch bar; git checkout --track -b bar_master bar/foo_master git config push.default tracking ----------------------------------------------------------------------

cd ../bar; git remote show foo
 --------------------------------------------------
 * remote foo
   Fetch URL: ../foo
   Push  URL: ../foo
   HEAD branch: master
   Remote branches:
     master tracked
     other  tracked
   Local branch configured for 'git pull':
     foo_master merges with remote other
 --------------------------------------------------
** DESIRED ADDITION **
 --------------------------------------------------
   Local ref configured for 'git push':
     foo_master pushes to other (up to date)
 --------------------------------------------------
cd ../baz; git remote show foo
 --------------------------------------------------
 * remote foo
   Fetch URL: ../foo
   Push  URL: ../foo
   HEAD branch: master
   Remote branches:
     master tracked
     other  tracked
   Local branch configured for 'git pull':
     master merges with remote master
   Local ref configured for 'git push':
     master pushes to master (up to date)
 --------------------------------------------------
** OUTPUT CORRECT **
cd ../biff; git remote show foo
 --------------------------------------------------
 * remote foo
   Fetch URL: ../foo
   Push  URL: ../foo
   HEAD branch: master
   Remote branches:
     master tracked
     other  tracked
   Local branch configured for 'git pull':
     master merges with remote master
   Local ref configured for 'git push':
     master pushes to master (up to date)
 --------------------------------------------------
** OUTPUT CORRECT **
cd ../biff; git remote show baz
 --------------------------------------------------
 * remote baz
   Fetch URL: ../baz
   Push  URL: ../baz
   HEAD branch: master
   Remote branch:
     master tracked
   Local branch configured for 'git pull':
     baz_master merges with remote master
   Local ref configured for 'git push':
     master pushes to master (up to date)
 --------------------------------------------------
** CORRECTED LAST TWO LINES **
 --------------------------------------------------
   Local ref configured for 'git push':
     baz_master pushes to master (up to date)
 --------------------------------------------------
cd ../biff; git remote show bar
 --------------------------------------------------
 * remote bar
   Fetch URL: ../bar
   Push  URL: ../bar
   HEAD branch: foo_master
   Remote branch:
     foo_master tracked
   Local branch configured for 'git pull':
     bar_master merges with remote foo_master
 --------------------------------------------------
** DESIRED ADDITION **
 --------------------------------------------------
   Local ref configured for 'git push':
     bar_master pushes to foo_master (up to date)
 --------------------------------------------------
Previous: Jonathan NiederNext: Jonathan Nieder
Message 3 of 4 in “[BUG] git show <remote>: bad information: Local branch|ref configured”
  1. Seth RobertsonNov 13, 2010
  2. Jonathan NiederNov 13, 2010
  3. Seth RobertsonNov 13, 2010
  4. Jonathan NiederNov 13, 2010

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.