[Kde-scm-interest] [Kde-pim] Git and the needs of KDE PIM
thiago at kde.org
Fri Jan 15 09:18:46 CET 2010
Em Quinta-feira 14. Janeiro 2010, às 11.32.48, Josef Kufner escreveu:
> Patrick Ohly píše v Čt 14. 01. 2010 v 09:59 +0100:
> > On Tue, 2010-01-12 at 19:54 +0000, Stephen Kelly wrote:
> > > The "blocked" commits issue poses bigger problems I think. My knowledge
> > > of the internals of git is not strong, but I don't think it would be
> > > possible to identify commits to keep only in one branch and not merge
> > > with the rest.
> > What you could do is a "git merge --no-commit". Then look at all changes
> > that would be committed and revert those that are not wanted in the
> > branch that is getting merged into. Commit. The next "git merge" will
> > only merge changes made since the last merge, so this manual selection
> > only needs to be done once per patch.
> > Disclaimer: haven't tried this myself.
> I thing, it would be better to do merge without '--no-commit' and then
> revert those commits that are not wanted. So everyone will see in log
> what patches are not merged. Question is, if we wish to see that.
I don't think we want to have complex scripts that forbid certain commits in
certain branches. This will get very complex, very soon.
For Qt, we have one pre-receive script that makes sure the initial Qt commit
back in 1994 doesn't end up in the public repository. But that's one commit
for *all* public Qt repositories, for all branches. That's easy to maintain
(i.e., do nothing) and it's an easy script.
If we wanted this, the proper way of doing it is via git log.
# Check if the commit exists
if ! git cat-file -t $THE_COMMIT 2>/dev/null; then
out=`git log -n1 $currentbranch..$THE_COMMIT`
if [ -z "$out" ]; then
echo >&2 "You've merged $THE_COMMIT to branch $currentbranch."
echo >&2 "Sorry, I can't accept your push."
git cat-file will return with an error if the commit doesn't exist. If it
doesn't exist, it can't be part of any branch.
git log A..B lists the commits between A and B. The -n1 option makes it show
at most one commit. So we know that it will print either zero or one commits.
If B is an ancestor of A, then A..B is an empty output and that's what we
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-scm-interest/attachments/20100115/8570d87b/attachment.sig
More information about the Kde-scm-interest