On Tue, May 01, 2018 at 12:42:57PM +0200, Duy Nguyen wrote: > On Mon, Apr 23, 2018 at 11:39:49PM +0000, brian m. carlson wrote: > > Several of our shell scripts hard-code the object ID of the empty tree. > > To avoid any problems when changing hashes, compute this value on > > startup of the script. For performance, store the value in a variable > > and reuse it throughout the life of the script. > > > > Signed-off-by: brian m. carlson > > --- > > git-filter-branch.sh | 4 +++- > > git-rebase--interactive.sh | 4 +++- > > templates/hooks--pre-commit.sample | 2 +- > > 3 files changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/git-filter-branch.sh b/git-filter-branch.sh > > index 64f21547c1..ccceaf19a7 100755 > > --- a/git-filter-branch.sh > > +++ b/git-filter-branch.sh > > @@ -11,6 +11,8 @@ > > # The following functions will also be available in the commit filter: > > > > functions=$(cat << \EOF > > +EMPTY_TREE=$(git hash-object -t tree /dev/null) > > All scripts (except those example hooks) must source > git-sh-setup. Should we define this in there instead? I think at this point, I'm okay with special-casing these two uses, but I would generally say that if we gain any more we should move it there. There's a trade-off between the benefits of reuse here and the fact that we're forking a process, which incurs a cost, especially on Windows. I'm open to hearing other opinions, of course. -- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204