Skip to main content

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

Thanks for the clarification. It does not seem exactly well suited for what I want to achieve. Are there any more opinions?

Thanks,
Markus

> -----Ursprüngliche Nachricht-----
> Von: egit-dev-bounces@xxxxxxxxxxx [mailto:egit-dev-bounces@xxxxxxxxxxx] Im Auftrag von Laurent Goubet
> Gesendet: Montag, 9. März 2015 15:34
> An: egit-dev@xxxxxxxxxxx
> Betreff: Re: [egit-dev] Commit Validation
>
> Hi,
>
> On 09/03/2015 13:19, Duft Markus wrote:
> > Another thing that's really unclear (in general with hooks & IDE) for me is the amount of hooks called. I think on the CLI, it
> makes sense to bail out as soon as the first hook fails. In the IDE I'd rather like to have a list of results which tells me /all/ the
> things i've done wrong. Is it OK to call all hooks all the time?
> I can't speak much for the rest, but for hooks in the CLI (and how they
> are implemented in JGit, since we've reproduced the same behavior) :
> there is only one hook of a given type at a time : you can have both
> pre-commit and commit-msg on your repo, but you can only have one of
> each. They are called in order, and the first that fails (and can abort
> the operation) does so.
>
> - pre-commit can abort a commit. If it fails, no more hooks are called
> since the commit itself is aborted
> - commit-msg will abort the commit as well, but pre-commit and
> prepare-commit-msg will have been run first (and both of them can have
> aborted the commit operation as a whole before commit-msg is called)
> - post-commit is called after the commit has been made, and can thus
> obviously not abort the commit. It's return value is insignificant.
> - ...
>
> see also the official documentation on the matter
> (http://git-scm.com/docs/githooks).
>
> Regards
>
> Laurent
>
> >
> > Cheers,
> > Markus
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: Halstrick, Christian [mailto:christian.halstrick@xxxxxxx]
> >> Gesendet: Montag, 9. März 2015 11:38
> >> An: Andrey Loskutov; Duft Markus
> >> Cc: EGit developer discussion (egit-dev@xxxxxxxxxxx)
> >> Betreff: RE: [egit-dev] Commit Validation
> >>
> >> I also think that we should try to use hooks for this purpose. Validating commits is a very common use case for hooks
> and
> >> many people write scripted hooks to achieve that. As Andrey also mentioned let's not invent another way to achieve
> that.
> >> On the other hand I understand why you want to avoid scripting. But since we already have a way how we call external
> >> scripts it should be not so hard to call Java instead.  See [1], [2]. Having a subclass of GitHook which calls Java instead of
> >> external processes in doRun() should be easy, or? Just as a proof of concept one could start trying this. But of course
> more
> >> work is coming then (how to register, to to deploy hooks to installed IDEs (you have your own build of E/JGit, right?). But
> I
> >> guess it's less work than creating a new thing like validators separate from hooks.
> >>
> >> [1] https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java#L178
> >> [2] https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java#L147-L157
> >>
> > 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

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