Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [egit-dev] Commit Validation

Hooks are CLI based programs, so they are usually scripts.

If you mean "Java hooks" you most likely mean "Java hooks *in IDE*", and this clearly limits the use of this to the IDE only. All CLI users aren't going to see anything. A simple "git commit -a; git push" will break any of your validation rules in IDE... For my organisation this would be a clear "showstopper".

The question is: can you use scripts for your validation? The task would be to interpret the script errors in the IDE in a "nice" way.
Why do you need Java for this validation? BTW if you are using Java 8 you can try to use "javascript -> Java" bridge and write your shell scripts in javascript with full Java API power [1].

Regarding hooks: see for example current pending reviews: 
https://git.eclipse.org/r/43044
https://git.eclipse.org/r/35791

Also please check bugzilla for "hooks" in jgit/egit projects.

[1] http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/

Kind regards,
Andrey Loskutov

http://google.com/+AndreyLoskutov


> Gesendet: Montag, 09. März 2015 um 08:19 Uhr
> Von: "Duft Markus" <Markus.Duft@xxxxxxxxxxxxxxxx>
> An: "Andrey Loskutov" <loskutov@xxxxxx>
> Cc: "EGit developer discussion (egit-dev@xxxxxxxxxxx)" <egit-dev@xxxxxxxxxxx>
> Betreff: AW: AW: [egit-dev] Commit Validation
>
> Are pre-commit hooks java code-able, or is it scripts? I definitely need something I can code with java... If it is, i'd definitely look into them - can you give me a starting point?
> 
> Cheers,
> Markus
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Andrey Loskutov [mailto:loskutov@xxxxxx]
> > Gesendet: Montag, 9. März 2015 08:10
> > An: Duft Markus
> > Cc: EGit developer discussion (egit-dev@xxxxxxxxxxx)
> > Betreff: Re: AW: [egit-dev] Commit Validation
> >
> > Have you considered to use (and extend) pre-commit hooks, which are now available? This would be *my* preferred
> > solution.
> > They are often used exactly for that purpose you want to have your validators, but also work on the command line or with
> > any other UI.
> > What we "just" need is the "nice" representation of the commit warnings/errors in the UI.
> >
> > Kind regards,
> > Andrey Loskutov
> >
> > http://google.com/+AndreyLoskutov
> >
> >
> > > Gesendet: Montag, 09. März 2015 um 07:34 Uhr
> > > Von: "Duft Markus" <Markus.Duft@xxxxxxxxxxxxxxxx>
> > > An: "Andrey Loskutov" <loskutov@xxxxxx>, "EGit developer discussion (egit-dev@xxxxxxxxxxx)" <egit-dev@xxxxxxxxxxx>
> > > Betreff: AW: [egit-dev] Commit Validation
> > >
> > > Hey,
> > >
> > > Wow, fast ;) I'd put it between commit & push, ofc. Pre-commit would be too early, as there is no commit object yet -
> > Matthias and Christian where the opinion (IIRC) that it would be way better to have a commit object to validate, instead of
> > having to search for all things to validate.
> > >
> > > About the soft reset (why does it make you nervous?) - we could also make this an option in the validation result dialog.
> > >
> > > 1) The result dialog only pops up if there is a warning or error
> > > 2) Available options are "OK" and "Abort" (Soft reset). I'd put an EGit setting whether "OK" is allowed in case there are
> > errors.
> > > 3) In case of commit & push we could name the add a button to just prevent pushing and name them differently: "Abort
> > commit", "Keep commit, abort push", "OK" or so. Ideas?
> > >
> > > The actual reason for this whole thing is (for us) to be able to catch guideline violations early. Everybody here must add
> > either a request ID or a bug number to the commit message for example, there are some directories where only certain
> > files are allowed, etc.
> > >
> > > Thanks for the feedback.
> > >
> > > Cheers,
> > > Markus
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Andrey Loskutov [mailto:loskutov@xxxxxx]
> > > > Gesendet: Montag, 9. März 2015 07:22
> > > > An: Duft Markus; EGit developer discussion (egit-dev@xxxxxxxxxxx)
> > > > Betreff: Re: [egit-dev] Commit Validation
> > > >
> > > > What is about commit & push? The validation (and any amend) will be too late.
> > > > I'm wondering if this validation schould be added after/before the "pre-commit" hooks.
> > > > Also the planned commit/soft reset scenario in case of failed checks makes me nerveus.
> > > >
> > > > Am 9. März 2015 07:11:53 MEZ, schrieb Duft Markus <Markus.Duft@xxxxxxxxxxxxxxxx>:
> > > > >Hey,
> > > > >
> > > > >As discussed with some of you the last 2 years of EclipseCon Europe, I
> > > > >now FINALLY have time to start working on a "commit validation"
> > > > >feature. It should be rather simple: After a commit has been done (1),
> > > > >the commit object is passed to a set of registered validators. They may
> > > > >object or not, returning an IStatus. A dialog is presented to the user,
> > > > >showing him a list of validation warnings/errors. In case there are
> > > > >errors, the commit soft-reset, and the commit message get's prefilled
> > > > >with the commits message again.
> > > > >
> > > > >
> > > > >(1)    /After/ the commit because it is way easier to have a look at a
> > > > >commit object and its contents than having to check the whole
> > > > >worktree... we already discussed this @ EclipseCon :)
> > > > >
> > > > >Does that sound like a good idea?
> > > > >
> > > > >I'd need a suggestion on how to register validators in EGit - should I
> > > > >create an extension point, or is there a better EntryPoint (register on
> > > > >repository?).
> > > > >
> > > > >Thanks for any feedback.
> > > > >
> > > > >Cheers,
> > > > >Markus
> > > > >
> > > > >--
> > > > >Mit freundlichen Grüßen / Best regards
> > > > >
> > > > >Markus Duft | Software Architect
> > > > >SSI SCHÄFER | Salomon Automation GmbH | Friesachstraße 15 | 8114
> > > > >Friesach bei Graz | Austria
> > > > >Phone +43 3127 200-575 | Fax +43 3127 200-22
> > > > >markus.duft@xxxxxxxxxxxxxxxx<mailto:markus.duft@xxxxxxxxxxxxxxxx>
> > > > >Website<http://www.salomon.at/> |
> > > > >Blog<http://www.ssi-schaefer.de/blog/> |
> > > > >YouTube<http://www.youtube.com/user/lagerlogistik1> |
> > > > >Facebook<https://www.facebook.com/SSI.SCHAEFER.DE>
> > > > >
> > > > >Salomon Automation GmbH | Friesachstrasse 15 | 8114 Friesach bei Graz |
> > > > >Austria
> > > > >Registered Office: Friesach bei Graz | Commercial Register: 49324 K |
> > > > >VAT no. ATU28654300
> > > > >Commercial Court: Landesgericht für Zivilrechtssachen Graz
> > > > >
> > > > >
> > > > >------------------------------------------------------------------------
> > > > >
> > > > >_______________________________________________
> > > > >egit-dev mailing list
> > > > >egit-dev@xxxxxxxxxxx
> > > > >To change your delivery options, retrieve your password, or unsubscribe
> > > > >from this list, visit
> > > > >https://dev.eclipse.org/mailman/listinfo/egit-dev
> > > >
> > > > --
> > > > Kind regards,
> > > > Andrey Loskutov
> > > >
> > > > http://google.com/+AndreyLoskutov
> > > Salomon Automation GmbH | Friesachstrasse 15 | 8114 Friesach bei Graz | Austria
> > > Registered Office: Friesach bei Graz | Commercial Register: 49324 K | VAT no. ATU28654300
> > > Commercial Court: Landesgericht für Zivilrechtssachen Graz
> > >
> Salomon Automation GmbH | Friesachstrasse 15 | 8114 Friesach bei Graz | Austria
> Registered Office: Friesach bei Graz | Commercial Register: 49324 K | VAT no. ATU28654300
> Commercial Court: Landesgericht für Zivilrechtssachen Graz
>


Back to the top