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

Re: [PATCH 1/3] t9350: point out that refs are not updated correctly

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Oct 25, 2012, 05:50 UTC
Message-ID
<CAMP44s3kBxzJbyoxPqWbRMWmpX9sNPGjdRy_KrTeRoVmGC-+Hg@mail.gmail.com>
In-Reply-To
<CAGdFq_gg3gPvCADje9ibz8xHgPOLF+=79EqksVzG2JeTOfHocw@mail.gmail.com>
On Thu, Oct 25, 2012 at 7:39 AM, Sverre Rabbelier <srabbelier@gmail.com> wrote:
Show 20 quoted lines
> On Wed, Oct 24, 2012 at 10:28 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> The testcase is imho correct and does not need changing.  So yes, I
>> don't want your help changing it.  I don't suspect you will be using
>> "git fast-export $(git rev-parse master)..master".  It is safe and
>> good to add additional testcases documenting the syntax that you do
>> use, as an independent topic.
>
> To re-iterate Dscho's point, the reason for this testcase is that if
> you do this:
> $ git checkout master
> $ git branch next
> $ git push hg://example.com master
> $ git push hg://example.com next
>
> With the current design, next will not be present on the remote. This
> is caused by the fact that git looks at "fast-export ^master next",
> sees that it's empty, and decides not to export anything. This patch
> series solves that, by having "fast-export ^master next" emit a "from
> :42\nreset next" (or something like that, assuming :42 is where master
> is currently at).

Only if the remote helper is using marks, and this particular patch is adding a test-case without any use of marks at all.

IOW; this test is testing something completely different, which happens to fix the original issue, but this is not the only way to fix, and in IMO certainly not the best.

As I showed in my script above:

$ git checkout master $ git branch next $ git push hg://example.com master $ git push hg://example.com next

This works just fine. Go ahead, apply my patch, and run it, the second branch gets updated.

It will fail this test, but that's because the test is not testing what it should: that *when using marks* the second branch exported is ignored.

This test does that:

--- cat > expected << EOF reset refs/heads/master from ##mark##

EOF
test_expect_failure 'refs are updated even if no commits need to be exported' '
        cp tmp-marks /tmp
        git fast-export --import-marks=tmp-marks \
                --export-marks=tmp-marks master | true &&
        git fast-export --import-marks=tmp-marks \
                --export-marks=tmp-marks master > actual &&
        mark=$(grep $(git rev-parse master) tmp-marks | cut -f 1 -d " ")
        sed -i -e "s/##mark##/$mark/" expected &&
        test_cmp expected actual
'
---
-- 
Felipe Contreras
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 15 of 42 in “fast-export fixes”
  1. 0/3 fast-export fixesSverre Rabbelier, Nov 5, 2011
  2. 1/3 t9350: point out that refs are not updated correctlySverre Rabbelier, Nov 5, 2011
  3. Jonathan NiederNov 6, 2011
  4. Sverre RabbelierNov 6, 2011
  5. Jonathan NiederNov 7, 2011
  6. Felipe ContrerasOct 24, 2012
  7. Jonathan NiederOct 24, 2012
  8. Felipe ContrerasOct 24, 2012
  9. Jonathan NiederOct 24, 2012
  10. Felipe ContrerasOct 25, 2012
  11. Jonathan NiederOct 25, 2012
  12. Felipe ContrerasOct 25, 2012
  13. Jonathan NiederOct 25, 2012
  14. Sverre RabbelierOct 25, 2012
  15. Felipe ContrerasOct 25, 2012
  16. Sverre RabbelierOct 25, 2012
  17. Felipe ContrerasOct 25, 2012
  18. Sverre RabbelierOct 25, 2012
  19. Jonathan NiederOct 25, 2012
  20. Sverre RabbelierOct 25, 2012
  21. Jonathan NiederOct 25, 2012
  22. Sverre RabbelierOct 25, 2012
  23. Felipe ContrerasOct 25, 2012
  24. Felipe ContrerasOct 25, 2012
  25. Jonathan NiederOct 25, 2012
  26. Felipe ContrerasOct 25, 2012
  27. Jonathan NiederOct 25, 2012
  28. Felipe ContrerasOct 25, 2012
  29. Johannes SchindelinOct 24, 2012
  30. Felipe ContrerasOct 25, 2012
  31. 2/3 fast-export: do not refer to non-existing marksSverre Rabbelier, Nov 5, 2011
  32. Jonathan NiederNov 6, 2011
  33. Sverre RabbelierNov 6, 2011
  34. Johannes SchindelinJan 29, 2019
  35. 3/3 fast-export: output reset command for commandline revsSverre Rabbelier, Nov 5, 2011
  36. Jonathan NiederNov 6, 2011
  37. Sverre RabbelierNov 6, 2011
  38. Jonathan NiederNov 7, 2011
  39. Junio C HamanoNov 7, 2011
  40. Junio C HamanoNov 7, 2011
  41. Thomas RastNov 30, 2011
  42. Felipe ContrerasOct 24, 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.