Skip to content

Commit bb6139a

Browse files
committed
Fix #410 Push empty repositories with recent git versions
Git 2.21 (possibly earlier) changed the output of the error for empty repos from Couldn't to couldn't. Make the regex case insensitive.
1 parent 2a5c016 commit bb6139a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
dist: trusty
2-
sudo: false
3-
41
# Want 'bash' but 'c' works:
52
language: c
63

4+
matrix:
5+
include:
6+
- name: "Git 2.21 on Ubuntu Xenial"
7+
dist: xenial
8+
# === This will need to removed when Travis drops support ===
9+
- name: "Git 2.15.1 on Ubuntu Trusty"
10+
dist: trusty
11+
712
script:
813
# NOTE: we have to make sure we're on a branch (rather than on a detached HEAD) because tests rely on it.
914
- git checkout -b travis-ci-dummy-branch-name

lib/git-subrepo

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,9 @@ subrepo:push() {
581581
if ! OK; then
582582
# Check if we are pushing to a new upstream repo (or branch) and just
583583
# push the commit directly. This is common after a `git subrepo init`:
584-
local re="(^|"$'\n'")fatal: Couldn't find remote ref "
585-
if [[ $output =~ $re ]]; then
584+
# Force to case in
585+
local re="(^|"$'\n'")fatal: couldn't find remote ref "
586+
if [[ ${output,,} =~ $re ]]; then
586587
o "Pushing to new upstream: $subrepo_remote ($subrepo_branch)."
587588
new_upstream=true
588589
else

0 commit comments

Comments
 (0)