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

Re: [PATCH] git-p4.py: Make submit working on bare repository

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 21, 2016, 07:36 UTC
Message-ID
<xmqqbn7aa522.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<87fuwnd4u7.fsf@freja.aidecoe.name>
Amadeusz Żołnowski <aidecoe@aidecoe.name> writes:
Show 27 quoted lines
> To submit changes from master branch to Perforce, new commits should be
> based on a remote branch p4/master:
>
> (1)
>                   E'---F' master
>                  /
>     A---B---C---D p4/master
>
> Commits from A to D map to Perforce changelists. These commits include
> additional metadata in commit message which most important is changelist
> number.
>
> On submit git-p4 prepares changelists for commits E'-F' and submits
> these to Perforce repository. After this operation it syncs back remote
> branch p4/master. This is the common part for both bare and non-bare
> repository.
>
> (2)
>                   E'---F' master
>                  /
>     A---B---C---D---E---F p4/master
>
> In non-bare repository git rebase is performed and it results in
> following state:
>
> (3)
>     A---B---C---D---E---F p4/master, master

That is because you would want your further work to be built on top of F, not F'.

> In bare repository this operation cannot be performed, so it remains in
> state (2).
And that is what made me wonder.
> With special care state (2) can be transformed to state (3) with manual
> update of refs/heads/master with refs/remotes/p4/master.
What do you mean by transforming with special care?  Do you mean running
    $ git update-ref master remotes/p4/master

or does it involve something else? Is it a fairly involved procedure, I wonder if it makes sense to just silently allowing submit without rebasing, and without telling the user how to clean it up.

And if it is really is the matter of update-ref, wouldn't that procedure apply equally well to a submit made from a non-bare repository?

Show 7 quoted lines
> I understand that implementing rebase for bare repository is unsafe and
> it wouldn't be appreciated. Therefore we have to resort to such a
> barbarity and git-p4 submit shouldn't attempt to perform a rebase
> operation itself. Especially because it performs other operations before
> and we end up in the intermediate state (2) anyway.
>
> Is this explanation satisfactory?

Not quite yet. It is better than no explanation, but it does not quite convince me (a non-git-p4 user) that it makes sense to allow submitting in a bare repository in the first place.

This is not an informed objection; I want to first understand why doing this is safe and does not hurt the end users.

Previous: Amadeusz ŻołnowskiNext: Amadeusz Żołnowski
Message 9 of 20 in “git-p4.py: Don't try to rebase on submit from bare repository”
  1. git-p4.py: Don't try to rebase on submit from bare repositoryAmadeusz Żołnowski, Feb 17, 2016
  2. Luke DiamandFeb 19, 2016
  3. Junio C HamanoFeb 19, 2016
  4. git-p4.py: Don't try to rebase on submit from bare repositoryAmadeusz Żołnowski, Feb 19, 2016
  5. Eric SunshineFeb 19, 2016
  6. git-p4.py: Make submit working on bare repositoryAmadeusz Żołnowski, Feb 19, 2016
  7. Junio C HamanoFeb 19, 2016
  8. Amadeusz ŻołnowskiFeb 20, 2016
  9. Junio C HamanoFeb 21, 2016
  10. Amadeusz ŻołnowskiFeb 22, 2016
  11. Junio C HamanoFeb 23, 2016
  12. Luke DiamandFeb 23, 2016
  13. Amadeusz ŻołnowskiFeb 23, 2016
  14. Luke DiamandFeb 28, 2016
  15. Amadeusz ŻołnowskiFeb 28, 2016
  16. Luke DiamandFeb 29, 2016
  17. Junio C HamanoApr 12, 2016
  18. Amadeusz ŻołnowskiApr 13, 2016
  19. Junio C HamanoApr 13, 2016
  20. Amadeusz ŻołnowskiJun 7, 2016

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.