From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 751D61F4D7 for ; Wed, 8 Jun 2022 23:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233852AbiFHXxh (ORCPT ); Wed, 8 Jun 2022 19:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231240AbiFHXxf (ORCPT ); Wed, 8 Jun 2022 19:53:35 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A5A839E487 for ; Wed, 8 Jun 2022 16:55:26 -0700 (PDT) Received: (qmail 6375 invoked by uid 109); 8 Jun 2022 23:55:25 -0000 Received: from Unknown (HELO sigill.intra.peff.net) (10.0.0.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Wed, 08 Jun 2022 23:55:25 +0000 Authentication-Results: cloud.peff.net; auth=none Date: Wed, 8 Jun 2022 19:55:25 -0400 From: Jeff King To: "R. Diez" Cc: git@vger.kernel.org Subject: Re: How to watch files in a Git repository Message-ID: References: <68627d29-8ffd-2e22-46ca-c28c9e980177@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <68627d29-8ffd-2e22-46ca-c28c9e980177@gmail.com> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Jun 06, 2022 at 06:04:11PM +0200, R. Diez wrote: > If there is nothing of the sort, I could write my own script in Bash > or Perl. I can handle cron and sending e-mails, but I do not know much > about Git's internals. Could someone provide a few pointers about how > to code this? I would expect there is some command to list commits, > and all files touched by a particular commit. And there would be some > way to interface with Bash or Perl, which does not need parsing > complicated text output from Git. This sounds kind of like git-multimail: https://github.com/git-multimail/git-multimail That's usually triggered from a hook, I think, but it would not be hard to trigger it with arbitrary segments of history. You'd probably want to keep a "seen" ref of processed commits, and move from that, like: # assuming you just care about one branch on the remote, but this # concept can be extended to several branch=refs/remotes/origin/main seen=refs/heads/seen git fetch # I don't know what git-multimail expects, but this is similar to what # a server-side receive hook would show echo "$(git rev-parse $seen) $(git rev-parse $branch) $branch" | some-git-multimail-command # now move your pointer forward for next time git update-ref $seen $branch If multimail doesn't do what you want, then you can probably just script around: git rev-list $seen..$branch -- $paths_you_care_about | git diff-tree --stdin -r --name-only --format="Commit %h touched: " -- $paths_you_care_about depending how you want to format things. -Peff