Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-05-02 03:26:09 +0300
committerJunio C Hamano <gitster@pobox.com>2018-05-02 07:59:53 +0300
commit23ec4c51d53f6976bdb54e92487d378f9abd1ed3 (patch)
treeb6b6ba840472ca79382bc9b9ef13276369bff87b /git-add--interactive.perl
parent03a7f388dafaee0aa084144efe7a8f9c151e5221 (diff)
add--interactive: compute the empty tree value
The interactive add script hard-codes the object ID of the empty tree. To avoid any problems when changing hashes, compute this value when used and cache it for any future uses. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl11
1 files changed, 9 insertions, 2 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index c1f52e457f..36f38ced90 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -205,8 +205,15 @@ my $status_head = sprintf($status_fmt, __('staged'), __('unstaged'), __('path'))
}
}
-sub get_empty_tree {
- return '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
+{
+ my $empty_tree;
+ sub get_empty_tree {
+ return $empty_tree if defined $empty_tree;
+
+ $empty_tree = run_cmd_pipe(qw(git hash-object -t tree /dev/null));
+ chomp $empty_tree;
+ return $empty_tree;
+ }
}
sub get_diff_reference {