From 03a7f388dafaee0aa084144efe7a8f9c151e5221 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Wed, 2 May 2018 00:26:08 +0000 Subject: Update shell scripts to compute empty tree object ID 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 Signed-off-by: Junio C Hamano --- git-filter-branch.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'git-filter-branch.sh') 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) + warn () { echo "$*" >&2 } @@ -46,7 +48,7 @@ git_commit_non_empty_tree() { if test $# = 3 && test "$1" = $(git rev-parse "$3^{tree}"); then map "$3" - elif test $# = 1 && test "$1" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904; then + elif test $# = 1 && test "$1" = $EMPTY_TREE; then : else git commit-tree "$@" -- cgit v1.2.3