summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>2023-08-21 12:10:44 +0200
committerOswald Buddenhagen <oswald.buddenhagen@gmx.de>2024-01-09 16:34:32 +0000
commit5f81c08cbc8f633ad272e116abc0312222cae967 (patch)
tree46e40ab5843a5c639cfdaeec3a09e3bb85067e30
parent95ae632c17d587e919930b9876b3a5646370c639 (diff)
gpush/gpull: return ROOT early in get_1st_parent_tree()
this clarifies the code by not pretending that we may get a commit for it. Change-Id: I4d76b914774c5dae0b5c57720071faacca689aac Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r--bin/git_gpush.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/git_gpush.pm b/bin/git_gpush.pm
index f56ccce..24631ec 100644
--- a/bin/git_gpush.pm
+++ b/bin/git_gpush.pm
@@ -619,7 +619,8 @@ sub get_1st_parent_tree($)
# as this code aims at series which were not rebased, using the base
# commit itself will work just as well for the series' first commit.
my $parents = $$commit{parents};
- my $parent_id = @$parents ? $$parents[0] : 'ROOT';
+ return 'ROOT' if (!@$parents);
+ my $parent_id = $$parents[0];
my $parent = $commit_by_id{$parent_id};
return $parent ? $$parent{tree} : $parent_id;
}