Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-26 Thread chen bin
Hi, Luke, Running the hook after applying changes to P4 shadow repo might not be a good idea. When the hook is running *before* the changes are applied, I'm 100% sure it's *only* my code's problem if the hook fails. One reason we need this hook is sometimes developer is over confident when applyi

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-26 Thread Eric Sunshine
On Thu, Jul 26, 2018 at 12:49 PM Junio C Hamano wrote: > Chen Bin writes: > > + git p4 submit --dry-run >out && grep "Would apply" out || > > echo "Abort submit" > > What is this last "|| echo I always succeed" about? > > Do you want to make sure "git p4 submit" exit with non-zero ex

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-26 Thread Luke Diamand
On 26 July 2018 at 10:21, Eric Sunshine wrote: > On Wed, Jul 25, 2018 at 10:08 PM chen bin wrote: >> The hook does not receive any information or input from git. The >> original requirement >> comes from my colleague. He want to run unit test automatically before >> submitting code >> to remote r

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-26 Thread Junio C Hamano
Chen Bin writes: > +Hook for submit > +~~~ > +Hook `p4-pre-submit` is executed if it exists and is executable. Just a lang nit, but "git grep pre-commit" shows me lines like Documentation/git-commit.txt: This option bypasses the pre-commit and commit-msg hooks. to tell me that

[PATCH 1/1] add hook pre-p4-submit

2018-07-26 Thread Chen Bin
Hook pre-p4-submit is executed before git-p4 actually submits code. If the hook exits with non-zero value, submit process will abort. Signed-off-by: Chen Bin --- Documentation/git-p4.txt | 12 Documentation/githooks.txt | 7 +++ git-p4.py | 21 +++

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-26 Thread Eric Sunshine
On Wed, Jul 25, 2018 at 10:08 PM chen bin wrote: > The hook does not receive any information or input from git. The > original requirement > comes from my colleague. He want to run unit test automatically before > submitting code > to remote repository. Or else CI server will send the blame mail t

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-25 Thread chen bin
Thanks for the review. The hook does not receive any information or input from git. The original requirement comes from my colleague. He want to run unit test automatically before submitting code to remote repository. Or else CI server will send the blame mail to the manager. The hook actually st

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-25 Thread Junio C Hamano
Eric Sunshine writes: > Bikeshedding: Should this be named 'p4-pre-submit'? That way, if > git-p4 ever grows additional hooks, they can all be grouped under the > "p4-" prefix. An excellent suggestion. > Does the hook receive any arguments? Does it receive anything on its > standard input? Thos

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-25 Thread Eric Sunshine
On Wed, Jul 25, 2018 at 9:45 AM Chen Bin wrote: > Hook pre-p4-submit is executed before git-p4 actually submits code. > If the hook exits with non-zero value, submit process will abort. Bikeshedding: Should this be named 'p4-pre-submit'? That way, if git-p4 ever grows additional hooks, they can a

[PATCH 1/1] add hook pre-p4-submit

2018-07-25 Thread Chen Bin
Hook pre-p4-submit is executed before git-p4 actually submits code. If the hook exits with non-zero value, submit process will abort. Signed-off-by: Chen Bin --- Documentation/git-p4.txt | 7 +++ Documentation/githooks.txt | 7 +++ git-p4.py | 18 +-

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-25 Thread chen bin
Thanks for you review. I will update documentation asap. On Wed, Jul 25, 2018 at 7:14 PM, Ævar Arnfjörð Bjarmason wrote: > > On Wed, Jul 25 2018, Luke Diamand wrote: > >> On 23 July 2018 at 12:27, Chen Bin wrote: >>> Hook pre-p4-submit is executed before git-p4 actually submits code. >>> If the

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-25 Thread Ævar Arnfjörð Bjarmason
On Wed, Jul 25 2018, Luke Diamand wrote: > On 23 July 2018 at 12:27, Chen Bin wrote: >> Hook pre-p4-submit is executed before git-p4 actually submits code. >> If the hook exits with non-zero value, submit process will abort. > > > Looks good to me - could you add some documentation please > (Do

Re: [PATCH 1/1] add hook pre-p4-submit

2018-07-25 Thread Luke Diamand
On 23 July 2018 at 12:27, Chen Bin wrote: > Hook pre-p4-submit is executed before git-p4 actually submits code. > If the hook exits with non-zero value, submit process will abort. Looks good to me - could you add some documentation please (Documentation/git-p4.txt). Thanks! Luke > > Signed-of

[PATCH 1/1] add hook pre-p4-submit

2018-07-23 Thread Chen Bin
Hook pre-p4-submit is executed before git-p4 actually submits code. If the hook exits with non-zero value, submit process will abort. Signed-off-by: Chen Bin --- git-p4.py | 6 ++ t/t9800-git-p4-basic.sh | 22 ++ 2 files changed, 28 insertions(+) diff --gi