File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -738,6 +738,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
738
738
struct tree_desc trees [2 ];
739
739
struct tree * tree ;
740
740
struct unpack_trees_options topts ;
741
+ const struct object_id * old_commit_oid ;
741
742
742
743
memset (& topts , 0 , sizeof (topts ));
743
744
topts .head_idx = -1 ;
@@ -765,9 +766,15 @@ static int merge_working_tree(const struct checkout_opts *opts,
765
766
& new_branch_info -> commit -> object .oid :
766
767
& new_branch_info -> oid , NULL );
767
768
topts .preserve_ignored = !opts -> overwrite_ignore ;
768
- tree = parse_tree_indirect (old_branch_info -> commit ?
769
- & old_branch_info -> commit -> object .oid :
770
- the_hash_algo -> empty_tree );
769
+
770
+ old_commit_oid = old_branch_info -> commit ?
771
+ & old_branch_info -> commit -> object .oid :
772
+ the_hash_algo -> empty_tree ;
773
+ tree = parse_tree_indirect (old_commit_oid );
774
+ if (!tree )
775
+ die (_ ("unable to parse commit %s" ),
776
+ oid_to_hex (old_commit_oid ));
777
+
771
778
init_tree_desc (& trees [0 ], tree -> buffer , tree -> size );
772
779
parse_tree (new_tree );
773
780
tree = new_tree ;
Original file line number Diff line number Diff line change @@ -700,6 +700,8 @@ static int checkout(int submodule_progress, int filter_submodules)
700
700
init_checkout_metadata (& opts .meta , head , & oid , NULL );
701
701
702
702
tree = parse_tree_indirect (& oid );
703
+ if (!tree )
704
+ die (_ ("unable to parse commit %s" ), oid_to_hex (& oid ));
703
705
parse_tree (tree );
704
706
init_tree_desc (& t , tree -> buffer , tree -> size );
705
707
if (unpack_trees (1 , & t , & opts ) < 0 )
You can’t perform that action at this time.
0 commit comments