All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] git-p4.py: Don't try to rebase on submit from bare repository
@ 2016-02-17 22:46 Amadeusz Żołnowski
  2016-02-19  9:47 ` Luke Diamand
  0 siblings, 1 reply; 20+ messages in thread
From: Amadeusz Żołnowski @ 2016-02-17 22:46 UTC (permalink / raw)
  To: git; +Cc: aidecoe

git-p4 can be successfully used from bare repository (which acts as a
bridge between Perforce repository and pure Git repositories). On submit
git-p4 performs unconditional rebase. Do rebase only on non-bare
repositories.
---
 git-p4.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index c33dece..e00cd02 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
                 sync.branch = self.branch
             sync.run([])
 
-            rebase = P4Rebase()
-            rebase.rebase()
+            if not gitConfigBool("core.bare"):
+                rebase = P4Rebase()
+                rebase.rebase()
 
         else:
             if len(applied) == 0:
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Don't try to rebase on submit from bare repository
  2016-02-17 22:46 [PATCH] git-p4.py: Don't try to rebase on submit from bare repository Amadeusz Żołnowski
@ 2016-02-19  9:47 ` Luke Diamand
  2016-02-19 17:21   ` Junio C Hamano
  0 siblings, 1 reply; 20+ messages in thread
From: Luke Diamand @ 2016-02-19  9:47 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: Git Users

On 17 February 2016 at 22:46, Amadeusz Żołnowski <aidecoe@aidecoe.name> wrote:
> git-p4 can be successfully used from bare repository (which acts as a
> bridge between Perforce repository and pure Git repositories). On submit
> git-p4 performs unconditional rebase. Do rebase only on non-bare
> repositories.

This looks obviously sensible and good to me, ack.

Thanks!
Luke



> ---
>  git-p4.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index c33dece..e00cd02 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
>                  sync.branch = self.branch
>              sync.run([])
>
> -            rebase = P4Rebase()
> -            rebase.rebase()
> +            if not gitConfigBool("core.bare"):
> +                rebase = P4Rebase()
> +                rebase.rebase()
>
>          else:
>              if len(applied) == 0:
> --
> 2.7.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Don't try to rebase on submit from bare repository
  2016-02-19  9:47 ` Luke Diamand
@ 2016-02-19 17:21   ` Junio C Hamano
  2016-02-19 18:27     ` Amadeusz Żołnowski
  0 siblings, 1 reply; 20+ messages in thread
From: Junio C Hamano @ 2016-02-19 17:21 UTC (permalink / raw)
  To: Luke Diamand; +Cc: Amadeusz Żołnowski, Git Users

Luke Diamand <luke@diamand.org> writes:

> On 17 February 2016 at 22:46, Amadeusz Żołnowski <aidecoe@aidecoe.name> wrote:
>> git-p4 can be successfully used from bare repository (which acts as a
>> bridge between Perforce repository and pure Git repositories). On submit
>> git-p4 performs unconditional rebase. Do rebase only on non-bare
>> repositories.
>
> This looks obviously sensible and good to me, ack.
>
> Thanks!
> Luke

Luke, thanks for a prompt feedback.

Amadeusz, can you sign off your patch (cf. Documentation/SubmittingPatches)?



>
>
>
>> ---
>>  git-p4.py | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/git-p4.py b/git-p4.py
>> index c33dece..e00cd02 100755
>> --- a/git-p4.py
>> +++ b/git-p4.py
>> @@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
>>                  sync.branch = self.branch
>>              sync.run([])
>>
>> -            rebase = P4Rebase()
>> -            rebase.rebase()
>> +            if not gitConfigBool("core.bare"):
>> +                rebase = P4Rebase()
>> +                rebase.rebase()
>>
>>          else:
>>              if len(applied) == 0:
>> --
>> 2.7.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] git-p4.py: Don't try to rebase on submit from bare repository
  2016-02-19 17:21   ` Junio C Hamano
@ 2016-02-19 18:27     ` Amadeusz Żołnowski
  2016-02-19 18:40       ` Eric Sunshine
  0 siblings, 1 reply; 20+ messages in thread
From: Amadeusz Żołnowski @ 2016-02-19 18:27 UTC (permalink / raw)
  To: git; +Cc: gitster, aidecoe

git-p4 can be successfully used from bare repository (which acts as a
bridge between Perforce repository and pure Git repositories). On submit
git-p4 performs unconditional rebase. Do rebase only on non-bare
repositories.

Signed-off-by: Amadeusz Żołnowski <aidecoe@aidecoe.name>
---
 git-p4.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index c33dece..e00cd02 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
                 sync.branch = self.branch
             sync.run([])
 
-            rebase = P4Rebase()
-            rebase.rebase()
+            if not gitConfigBool("core.bare"):
+                rebase = P4Rebase()
+                rebase.rebase()
 
         else:
             if len(applied) == 0:
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Don't try to rebase on submit from bare repository
  2016-02-19 18:27     ` Amadeusz Żołnowski
@ 2016-02-19 18:40       ` Eric Sunshine
  2016-02-19 21:57         ` [PATCH] git-p4.py: Make submit working on " Amadeusz Żołnowski
  0 siblings, 1 reply; 20+ messages in thread
From: Eric Sunshine @ 2016-02-19 18:40 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: Git List, Junio C Hamano

On Fri, Feb 19, 2016 at 1:27 PM, Amadeusz Żołnowski
<aidecoe@aidecoe.name> wrote:
> git-p4 can be successfully used from bare repository (which acts as a
> bridge between Perforce repository and pure Git repositories). On submit
> git-p4 performs unconditional rebase. Do rebase only on non-bare
> repositories.

As a person who does not use Perforce, it is not obvious to me from
the commit message why this change is beneficial or even what the
consequences are. Will Perforce users understand this change given
only the explanation above? If not, perhaps it would be helpful to
expand the commit message to explain more thoroughly the impact of
this change and why it is a good idea.

Thanks.

> Signed-off-by: Amadeusz Żołnowski <aidecoe@aidecoe.name>
> ---
>  git-p4.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index c33dece..e00cd02 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
>                  sync.branch = self.branch
>              sync.run([])
>
> -            rebase = P4Rebase()
> -            rebase.rebase()
> +            if not gitConfigBool("core.bare"):
> +                rebase = P4Rebase()
> +                rebase.rebase()
>
>          else:
>              if len(applied) == 0:
> --
> 2.7.0

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-19 18:40       ` Eric Sunshine
@ 2016-02-19 21:57         ` Amadeusz Żołnowski
  2016-02-19 22:44           ` Junio C Hamano
  0 siblings, 1 reply; 20+ messages in thread
From: Amadeusz Żołnowski @ 2016-02-19 21:57 UTC (permalink / raw)
  To: git; +Cc: gitster, aidecoe

git-p4 can be successfully used from bare repository (which may act as a
bridge between Perforce repository and pure Git repositories). After
submitting changelist to Perforce, git-p4 performs unconditional rebase
which obviously fails.

Perform rebase only on non-bare repositories, so submit command can be
successful on bare repository.

Signed-off-by: Amadeusz Żołnowski <aidecoe@aidecoe.name>
---
 git-p4.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index c33dece..e00cd02 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
                 sync.branch = self.branch
             sync.run([])
 
-            rebase = P4Rebase()
-            rebase.rebase()
+            if not gitConfigBool("core.bare"):
+                rebase = P4Rebase()
+                rebase.rebase()
 
         else:
             if len(applied) == 0:
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-19 21:57         ` [PATCH] git-p4.py: Make submit working on " Amadeusz Żołnowski
@ 2016-02-19 22:44           ` Junio C Hamano
  2016-02-20 11:00             ` Amadeusz Żołnowski
  0 siblings, 1 reply; 20+ messages in thread
From: Junio C Hamano @ 2016-02-19 22:44 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: git, Luke Diamand

Amadeusz Żołnowski <aidecoe@aidecoe.name> writes:

> git-p4 can be successfully used from bare repository (which may act as a
> bridge between Perforce repository and pure Git repositories). After
> submitting changelist to Perforce, git-p4 performs unconditional rebase
> which obviously fails.
>
> Perform rebase only on non-bare repositories, so submit command can be
> successful on bare repository.

It is obvious that an attempt to run rebase would fail in a bare
repository, and skipping it would obviously make it not fail.

I think that part is well understood.

What is unclear is what the ramification of _not_ rebasing after
submitting is.

In other words, why do we have to rebase after submitting when we
are in a non-bare repository?  There must be a reason behind it,
i.e. "If we do not rebase, then the repository would be in a state
where future operations like X and Y do not work correctly because
of Z".

And why does that same reason Z not apply when we submit from a bare
repository?

A possible explanation might be that X and Y are operations that
happen only in a non-bare repository that we do not have to worry
about happening in a bare repository after we finish submitting.

But these X, Y and Z are left unexplained--that is what is unclear
in the original proposed log message, and it is still unclear in the
above update.

Thanks.



> Signed-off-by: Amadeusz Żołnowski <aidecoe@aidecoe.name>
> ---
>  git-p4.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index c33dece..e00cd02 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -2059,8 +2059,9 @@ class P4Submit(Command, P4UserMap):
>                  sync.branch = self.branch
>              sync.run([])
>  
> -            rebase = P4Rebase()
> -            rebase.rebase()
> +            if not gitConfigBool("core.bare"):
> +                rebase = P4Rebase()
> +                rebase.rebase()
>  
>          else:
>              if len(applied) == 0:

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-19 22:44           ` Junio C Hamano
@ 2016-02-20 11:00             ` Amadeusz Żołnowski
  2016-02-21  7:36               ` Junio C Hamano
  0 siblings, 1 reply; 20+ messages in thread
From: Amadeusz Żołnowski @ 2016-02-20 11:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Luke Diamand

[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]

Hi Junio,

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

In bare repository this operation cannot be performed, so it remains in
state (2).

With special care state (2) can be transformed to state (3) with manual
update of refs/heads/master with refs/remotes/p4/master.

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? If yes, I'll include it in patch
description.


Kind regards,

-- 
Amadeusz Żołnowski

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 950 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-20 11:00             ` Amadeusz Żołnowski
@ 2016-02-21  7:36               ` Junio C Hamano
  2016-02-22 18:50                 ` Amadeusz Żołnowski
  0 siblings, 1 reply; 20+ messages in thread
From: Junio C Hamano @ 2016-02-21  7:36 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: git, Luke Diamand

Amadeusz Żołnowski <aidecoe@aidecoe.name> writes:

> 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?

> 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.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-21  7:36               ` Junio C Hamano
@ 2016-02-22 18:50                 ` Amadeusz Żołnowski
  2016-02-23  6:59                   ` Junio C Hamano
  0 siblings, 1 reply; 20+ messages in thread
From: Amadeusz Żołnowski @ 2016-02-22 18:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Luke Diamand

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

Junio C Hamano <gitster@pobox.com> writes:
> I wonder if it makes sense to just silently allowing submit without
> rebasing, and without telling the user how to clean it up.

It is a good point. Maybe submit shouldn't be allowed by default at all
From bare repository. What do you think about following approach?  If
core.base is true, then if git-p4.submitFromBare is also true then
submit without performing proper rebase, but update master ref from
p4/master. If core.base is true, but git-p4.submitFromBare is false,
abort immediately. Submitting from bare repository would require aware
decision from a user.

Kind regards,

-- 
Amadeusz Żołnowski

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 950 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-22 18:50                 ` Amadeusz Żołnowski
@ 2016-02-23  6:59                   ` Junio C Hamano
  2016-02-23 12:05                     ` Luke Diamand
  0 siblings, 1 reply; 20+ messages in thread
From: Junio C Hamano @ 2016-02-23  6:59 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: git, Luke Diamand

Amadeusz Żołnowski <aidecoe@aidecoe.name> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>> I wonder if it makes sense to just silently allowing submit without
>> rebasing, and without telling the user how to clean it up.
>
> It is a good point. Maybe submit shouldn't be allowed by default at all
> From bare repository. What do you think about following approach?  If
> core.base is true, then if git-p4.submitFromBare is also true then
> submit without performing proper rebase, but update master ref from
> p4/master. If core.base is true, but git-p4.submitFromBare is false,
> abort immediately. Submitting from bare repository would require aware
> decision from a user.

(I think you meant "bare" where you wrote "base" in the above).

As a non user of git-p4, the above sounds a safe and sensible
approach, but I'd like to hear from Luke, who has been active in
this area and is far more expert than I am ;-)

Thanks.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-23  6:59                   ` Junio C Hamano
@ 2016-02-23 12:05                     ` Luke Diamand
  2016-02-23 20:56                       ` Amadeusz Żołnowski
  0 siblings, 1 reply; 20+ messages in thread
From: Luke Diamand @ 2016-02-23 12:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Amadeusz Żołnowski, Git Users

On 23 February 2016 at 06:59, Junio C Hamano <gitster@pobox.com> wrote:
> Amadeusz Żołnowski <aidecoe@aidecoe.name> writes:
>
>> Junio C Hamano <gitster@pobox.com> writes:
>>> I wonder if it makes sense to just silently allowing submit without
>>> rebasing, and without telling the user how to clean it up.
>>
>> It is a good point. Maybe submit shouldn't be allowed by default at all
>> From bare repository. What do you think about following approach?  If
>> core.base is true, then if git-p4.submitFromBare is also true then
>> submit without performing proper rebase, but update master ref from
>> p4/master. If core.base is true, but git-p4.submitFromBare is false,
>> abort immediately. Submitting from bare repository would require aware
>> decision from a user.
>
> (I think you meant "bare" where you wrote "base" in the above).
>
> As a non user of git-p4, the above sounds a safe and sensible
> approach, but I'd like to hear from Luke, who has been active in
> this area and is far more expert than I am ;-)

Sorry, I've been travelling so not been able to reply earlier. Jetlag
has now kicked-in, and 4am is the perfect time to reply to this!

I think it would help to understand why we're doing a git-p4 submit
from a bare repo in the first place.

The usual workflow is you have a normal repo and submit from that.

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.

As Amadeusz pointed out, the submit fails:

$ git p4 submit --git-dir=/path/to/bare/repo
...
...
fatal: This operation must be run in a work tree
Some files in your working directory are modified and different than
what is in your index. You can use git update-index <filename> to
bring the index up-to-date or stash away all your changes with git
stash.

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.

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.

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.

Luke

>
> Thanks.
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-23 12:05                     ` Luke Diamand
@ 2016-02-23 20:56                       ` Amadeusz Żołnowski
  2016-02-28  4:26                         ` Luke Diamand
  0 siblings, 1 reply; 20+ messages in thread
From: Amadeusz Żołnowski @ 2016-02-23 20:56 UTC (permalink / raw)
  To: Luke Diamand; +Cc: Junio C Hamano, Git Users

[-- Attachment #1: Type: text/plain, Size: 2585 bytes --]

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.


> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 950 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-23 20:56                       ` Amadeusz Żołnowski
@ 2016-02-28  4:26                         ` Luke Diamand
  2016-02-28 20:46                           ` Amadeusz Żołnowski
  0 siblings, 1 reply; 20+ messages in thread
From: Luke Diamand @ 2016-02-28  4:26 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: Junio C Hamano, Git Users

On 23 February 2016 at 20:56, Amadeusz Żołnowski <aidecoe@aidecoe.name> wrote:
>
> 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. (-:

Will it do something sensible if anything goes wrong?

I'm thinking about what happens if you submit and one of the commits
fails to go to P4 due to a merge conflict.

But I guess just doing an update-ref could be an OK thing to do.
Without actually trying it out for real though I can't be sure. It
might make sense to get some practical experience of how this works
out.

Luke

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-28  4:26                         ` Luke Diamand
@ 2016-02-28 20:46                           ` Amadeusz Żołnowski
  2016-02-29 15:29                             ` Luke Diamand
  0 siblings, 1 reply; 20+ messages in thread
From: Amadeusz Żołnowski @ 2016-02-28 20:46 UTC (permalink / raw)
  To: Luke Diamand; +Cc: Junio C Hamano, Git Users

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

Luke Diamand <luke@diamand.org> writes:

> On 23 February 2016 at 20:56, Amadeusz Żołnowski <aidecoe@aidecoe.name> wrote:
>>
>> 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. (-:
>
> Will it do something sensible if anything goes wrong?
>
> I'm thinking about what happens if you submit and one of the commits
> fails to go to P4 due to a merge conflict.

Handling failures in this case is a bit tricky, indeed.


> But I guess just doing an update-ref could be an OK thing to do.
> Without actually trying it out for real though I can't be sure. It
> might make sense to get some practical experience of how this works
> out.

True. For now I have these cases covered by wrapper scripts. The minimum
I need from git-p4 is just not to fail on git submit from bare
repository which is covered by patch I have submitted. If I get my
solution enough testing, I'd think of transforming it into patch for
git-p4.py as well.

-- 
Amadeusz Żołnowski

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 950 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-28 20:46                           ` Amadeusz Żołnowski
@ 2016-02-29 15:29                             ` Luke Diamand
  2016-04-12 23:25                               ` Junio C Hamano
  0 siblings, 1 reply; 20+ messages in thread
From: Luke Diamand @ 2016-02-29 15:29 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: Junio C Hamano, Git Users

On 28 February 2016 at 20:46, Amadeusz Żołnowski <aidecoe@aidecoe.name> wrote:

>
> True. For now I have these cases covered by wrapper scripts. The minimum
> I need from git-p4 is just not to fail on git submit from bare
> repository which is covered by patch I have submitted. If I get my
> solution enough testing, I'd think of transforming it into patch for
> git-p4.py as well.

Could you change the patch to add a command-line option to suppress
the rebase? I think this would be a bit more obvious: instead of
having some special magical behaviour kick-in on a bare repo, git-p4
just does what it's told on the command-line.

It means that if we find another situation where we don't want to
rebase, we don't have an ever-growing list of special-case
circumstances, which could become hard to make sense of in future.
Instead, the user (who hopefully knows better) just tells git-p4 what
to do.

Thanks!
Luke

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-02-29 15:29                             ` Luke Diamand
@ 2016-04-12 23:25                               ` Junio C Hamano
  2016-04-13 20:27                                 ` Amadeusz Żołnowski
  0 siblings, 1 reply; 20+ messages in thread
From: Junio C Hamano @ 2016-04-12 23:25 UTC (permalink / raw)
  To: Luke Diamand; +Cc: Amadeusz Żołnowski, Git Users

Luke Diamand <luke@diamand.org> writes:

> On 28 February 2016 at 20:46, Amadeusz Żołnowski <aidecoe@aidecoe.name> wrote:
>
>>
>> True. For now I have these cases covered by wrapper scripts. The minimum
>> I need from git-p4 is just not to fail on git submit from bare
>> repository which is covered by patch I have submitted. If I get my
>> solution enough testing, I'd think of transforming it into patch for
>> git-p4.py as well.
>
> Could you change the patch to add a command-line option to suppress
> the rebase? I think this would be a bit more obvious: instead of
> having some special magical behaviour kick-in on a bare repo, git-p4
> just does what it's told on the command-line.
>
> It means that if we find another situation where we don't want to
> rebase, we don't have an ever-growing list of special-case
> circumstances, which could become hard to make sense of in future.
> Instead, the user (who hopefully knows better) just tells git-p4 what
> to do.

Has anything happened to this topic after this?  I am wondering if I
should discard the topic az/p4-bare-no-rebase without prejudice.

Thanks.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-04-12 23:25                               ` Junio C Hamano
@ 2016-04-13 20:27                                 ` Amadeusz Żołnowski
  2016-04-13 21:47                                   ` Junio C Hamano
  0 siblings, 1 reply; 20+ messages in thread
From: Amadeusz Żołnowski @ 2016-04-13 20:27 UTC (permalink / raw)
  To: Junio C Hamano, Luke Diamand; +Cc: Git Users

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

Hi,

Junio C Hamano <gitster@pobox.com> writes:
> Has anything happened to this topic after this?  I am wondering if I
> should discard the topic az/p4-bare-no-rebase without prejudice.

Sorry, I haven't got time to take a loot at this, but I'll return to
that soon, OK? I'll prepare a patch with an option to skip rebase rather
than do it only for bare repos.

-- 
Amadeusz Żołnowski

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 950 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-04-13 20:27                                 ` Amadeusz Żołnowski
@ 2016-04-13 21:47                                   ` Junio C Hamano
  2016-06-07 20:32                                     ` Amadeusz Żołnowski
  0 siblings, 1 reply; 20+ messages in thread
From: Junio C Hamano @ 2016-04-13 21:47 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: Luke Diamand, Git Users

Amadeusz Żołnowski <aidecoe@aidecoe.name> writes:

>> Has anything happened to this topic after this?  I am wondering if I
>> should discard the topic az/p4-bare-no-rebase without prejudice.
>
> Sorry, I haven't got time to take a loot at this, but I'll return to
> that soon, OK? I'll prepare a patch with an option to skip rebase rather
> than do it only for bare repos.

No hurries.

With or without an option, I think the documentation needs to
clarify when it is safe to omit rebase and why.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] git-p4.py: Make submit working on bare repository
  2016-04-13 21:47                                   ` Junio C Hamano
@ 2016-06-07 20:32                                     ` Amadeusz Żołnowski
  0 siblings, 0 replies; 20+ messages in thread
From: Amadeusz Żołnowski @ 2016-06-07 20:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Luke Diamand, Git Users

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

Junio C Hamano <gitster@pobox.com> writes:

> Amadeusz Żołnowski <aidecoe@aidecoe.name> writes:
>
>>> Has anything happened to this topic after this?  I am wondering if I
>>> should discard the topic az/p4-bare-no-rebase without prejudice.

I think you can discard the topic, because we're moving away from
Perforce and while I have tested my original patch I haven't found time
to change it to --skip-rebase option as suggested and test it.

Thanks,
-- 
Amadeusz Żołnowski

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 950 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-06-07 21:02 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-17 22:46 [PATCH] git-p4.py: Don't try to rebase on submit from bare repository Amadeusz Żołnowski
2016-02-19  9:47 ` Luke Diamand
2016-02-19 17:21   ` Junio C Hamano
2016-02-19 18:27     ` Amadeusz Żołnowski
2016-02-19 18:40       ` Eric Sunshine
2016-02-19 21:57         ` [PATCH] git-p4.py: Make submit working on " Amadeusz Żołnowski
2016-02-19 22:44           ` Junio C Hamano
2016-02-20 11:00             ` Amadeusz Żołnowski
2016-02-21  7:36               ` Junio C Hamano
2016-02-22 18:50                 ` Amadeusz Żołnowski
2016-02-23  6:59                   ` Junio C Hamano
2016-02-23 12:05                     ` Luke Diamand
2016-02-23 20:56                       ` Amadeusz Żołnowski
2016-02-28  4:26                         ` Luke Diamand
2016-02-28 20:46                           ` Amadeusz Żołnowski
2016-02-29 15:29                             ` Luke Diamand
2016-04-12 23:25                               ` Junio C Hamano
2016-04-13 20:27                                 ` Amadeusz Żołnowski
2016-04-13 21:47                                   ` Junio C Hamano
2016-06-07 20:32                                     ` Amadeusz Żołnowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.