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
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Date
Feb 23, 2016, 20:56 UTC
Message-ID
<871t83cfi7.fsf@freja.aidecoe.name>
In-Reply-To
<CAE5ih7_vBMsi+zRZRTCaO56VrOYZUR0NQ0CSSE+Do48xkJ_BwA@mail.gmail.com>
Hi Luke,
Luke Diamand <luke@diamand.org> writes:
> I'm guessing that the reason for using a bare repo is so that changes
> can be pushed to it from several different git repos. This then saves
> doing the initial git-p4 clone multiple times.

I have created a Git repository acting as a bridge between Perforce and pure Git repos. Changes pushed to master branch on this bridge repo get submitted to Perforce repository (referenced via remote p4/master).

> If this had actually worked, I think the next thing I would want to do
> is to rebase one or more branches in the bare repo against p4/master.
> I don't think there's any way that git-p4 can work out which branches
> would be rebased, and nor should it.

It actually has all information needed. It submits commits from a given branch to a branch specified with --branch option (or default p4 remote). When submitting from a non-bare repo git-p4 has the same set of information: the current branch and a branch specified with --branch (or default p4 remote).

> I think the approach of using a submitFromBare config variable to
> force the user to make a choice feels a bit bogus, since they clearly
> *want* to submit from this bare repo, as otherwise they wouldn't have
> done "git-p4 submit" in the first place.
I agree, a good point.
Show 8 quoted lines
> It might make sense to have a command-line or config option
> ("--skip-rebase" ?) to tell "submit" to only do the submit part, and
> skip the rebase stage (and get the rebase stage to give a more useful
> error message on a bare repo when the option isn't used). That would
> then mean that git-p4 does not have to know if it's running in a bare
> repo or not, and the submit-without-rebase functionality is available
> to people doing other different things not involving bare repos (which
> we haven't though of yet) but still requiring submit without rebase.

While having additional --skip-rebase is a good idea, having git-p4 doing rebase would be more elegant for those who actually use GitP4 in bare repository. In message 87fuwnd4u7.fsf@freja.aidecoe.name I have described how state of branches changes during submit. It clearly shows that in case of a bare repository it ends up in undesired state.

To simplify things, why not just update ref during submit from bare repository? As you have pointed out, if user invokes submit in this context he/she actually wants to submit from bare repo and probably knows what he/she is doing - especially if he/she reads man page. (-:

Kind regards,
-- 
Amadeusz Żołnowski
Previous: Luke DiamandNext: Luke Diamand
Message 13 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.