[PATCH RFC aiaiai 09/11] aiaiai: add git-find-base utility for finding base commit from mbox
dedekind1 at gmail.com
Mon Mar 31 01:46:35 PDT 2014
On Thu, 2014-03-27 at 11:40 -0700, Jacob Keller wrote:
> This patch adds a helper utility for git, git-find-base which works by
> checking the index information provided by git-diff's output. It works
> by parsing the mbox for diff lines, and extracting the index line. This
> is the shortblob of the file in git's database that this patch
> originally applied to.
> The general flow of this perl tool is:
> 1) Extract all the files and base blob indexes that the patch modifies,
> using a regular expression.
> 2) Run git log with all arguments directly passed through
> 3) For each commit returned by git log, check the ls-tree output for the
> modified file. If any of them fail to match, then this patch cannot
> apply cleanly to the commit.
> 4) print the sha1sum of the first commit which passes the check blobs
> This tool can be used to automatically determine if a commit can be
> applied cleanly to a branch, and even detect which commit it should be
> applied to. Various options passed to the log can change how much
> detection it does.
> If a patch series is applied, it will check each modification of a file,
> and ensure that it could apply in sequence generating the final result.
> This allows finding the first commit at which a series will apply. If a
> series is not self-consistent, then git-find-base will fail to supply
> the base commit, and may output errors regarding the nature of the
> The primary intention for this tool will be an example hook for aiaiai
> which automatically detects which project a patch was originally based
Would it please be possible to add '-h'/'--help' option which would
print something like the commit message explaining the purpose and use
of this script. Or at least put this kind of expanded comment to the
script. This way people won't have to dig git logs to grasp the general
More information about the aiaiai