From b721eec54ba6499014541f4796b7cde282596b08 Mon Sep 17 00:00:00 2001 From: Daniel Bauten <10648448+DanielBauten@users.noreply.github.com> Date: Thu, 27 Aug 2020 11:37:18 +0200 Subject: [PATCH 1/2] create subrepo branch at pulled commit, if there are no relevant local commits --- lib/git-subrepo | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/git-subrepo b/lib/git-subrepo index 38655703..c1705d8b 100755 --- a/lib/git-subrepo +++ b/lib/git-subrepo @@ -785,7 +785,12 @@ subrepo:branch() { fi done - o "Create branch '$branch' for this new commit set $prev_commit." + if [[ -z "$prev_commit" ]]; then # i.e. there are no new reachable commits + o "Create branch '$branch' for subrepo commit $subrepo_commit." + prev_commit="$subrepo_commit" + else + o "Create branch '$branch' for this new commit set $prev_commit." + fi RUN git branch "$branch" "$prev_commit" else o "No parent setting, use the subdir content." From 8fb6be3fb1500ab845081fc26ecdb950e9c0438c Mon Sep 17 00:00:00 2001 From: Daniel Bauten <10648448+DanielBauten@users.noreply.github.com> Date: Thu, 27 Aug 2020 13:27:23 +0200 Subject: [PATCH 2/2] avoid unnecessary long filter range, if there aren't any relevant new commits --- lib/git-subrepo | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/git-subrepo b/lib/git-subrepo index c1705d8b..b1e61544 100755 --- a/lib/git-subrepo +++ b/lib/git-subrepo @@ -788,6 +788,7 @@ subrepo:branch() { if [[ -z "$prev_commit" ]]; then # i.e. there are no new reachable commits o "Create branch '$branch' for subrepo commit $subrepo_commit." prev_commit="$subrepo_commit" + first_gitrepo_commit="$subrepo_commit" # force neutralization of $filter to avoid unnecessary large range (see below) else o "Create branch '$branch' for this new commit set $prev_commit." fi