git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Smith <paul@mad-scientist.net>
To: Arnaud Bertrand <xda@abalgo.com>
Cc: git@vger.kernel.org
Subject: Re: Feature request: add a metadata in the commit: the "commited in branch" information
Date: Mon, 30 Dec 2019 10:15:56 -0500	[thread overview]
Message-ID: <85e17e0628e05279d1dbbe62b877caa90a43ec38.camel@mad-scientist.net> (raw)
In-Reply-To: <CAEW0o+gtya5tm6Wb474Srmb2j4E9ocm9p75=aZWjTASbApsb1A@mail.gmail.com>

On Mon, 2019-12-30 at 12:59 +0100, Arnaud Bertrand wrote:
> > Why does it need to be the branch name?  You can add your own extra
> > metadata to the git description.
> 
> That's typically my problem.  It is not possible "by default", I mean
> - It is only possible if the developer configure something
> - or if there is an upper layer that guarantee this
> By default, there is no hook embedded with the clone. So, as far as I
> know (and I hope I'm wrong!), you have to use upper layer tools or to
> change environment variables to activate this feature.

In general I have found that trying to mandate what users do in their own
repositories on their own systems is a losing proposition.

Instead, we put requirements on what content is pushed to the central
repository.  Because the central repository is managed by the SCM admin
team we always know only properly-constructed commits can appear there,
without having to assume that every individual developer's local
environment has been set up in a specific way.

This can be done with hooks in the central repository: there are Git hooks
that are run before any push is accepted, which can cause the push to be
rejected, and hooks that are run after a push is accepted, which can be
used for triggering other operations.

So if you have a requirement about contents of Git commit message format,
for example, you can enforce that via these hooks.  If someone attempts to
push commits to the central repository and the commit message has an
incorrect format then the push is rejected and they'll have to fix it
before they can proceed to push.

In the environments I've been associated with we don't care about branch
names; instead everything is based on bug tracker identifiers.  Every
commit needs to be associated with a valid bug ID (added to the commit
message) and the pre-push hook verifies this and rejects the commit if not.
Then after the push is accepted, post-push hooks will update the bug
tracker with information about the push (SHA, software version, etc.)  This
ensures that development and management can use the bug tracker as their
primary planning tool to know what has been accomplished and what is left
to accomplish.  Since the commit message is persisted through cherry-picks, 
etc. it allows us to know which bugs were fixed in which different patch
release branches as well.


      reply	other threads:[~2019-12-30 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23 12:56 Feature request: add a metadata in the commit: the "commited in branch" information Arnaud Bertrand
2019-12-29 23:17 ` Junio C Hamano
2019-12-29 23:53   ` Arnaud Bertrand
2019-12-30  4:15     ` Theodore Y. Ts'o
2019-12-30 11:59       ` Arnaud Bertrand
2019-12-30 15:15         ` Paul Smith [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85e17e0628e05279d1dbbe62b877caa90a43ec38.camel@mad-scientist.net \
    --to=paul@mad-scientist.net \
    --cc=git@vger.kernel.org \
    --cc=xda@abalgo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).