git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Dun Peal <dunpealer@gmail.com>
To: Git ML <git@vger.kernel.org>
Subject: Correctly detecting modified paths in merge commits?
Date: Thu, 16 Dec 2010 10:54:11 -0600	[thread overview]
Message-ID: <AANLkTimsHZ543B7XWS6taa0w2Vc4huznx3UMs4Ejg3af@mail.gmail.com> (raw)

Hi.

We wrote a post-receive hook that alerts users (via email) when
specific paths are modified by their peers. The implementation is
pretty simple: whenever a new commit is made, we ask git for the full
list of files modified by that commit:

  git diff --name-only <COMMIT HASH>^!

This works well for regular commits, but breaks for merge commits.

For example, suppose we have the following basic merge scenario:

  B
 / \
A   D
 \ /
  C

Root A was branched to B and C, then merged into commit D.

Problem is, the diff for D^! will include all the changes introduced by C.

One obvious solution is to simply ignore merge commits, by parsing
`git cat-file commit D` and discarding all commits with parent count >
1. But merge commits may actually contain legitimate modified files if
there were any conflict resolutions.

So what's the best solution for this problem, oh wise Git wizards?

Thanks, D.

             reply	other threads:[~2010-12-16 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 16:54 Dun Peal [this message]
2010-12-16 18:33 ` Correctly detecting modified paths in merge commits? Jakub Narebski

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=AANLkTimsHZ543B7XWS6taa0w2Vc4huznx3UMs4Ejg3af@mail.gmail.com \
    --to=dunpealer@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).