Fix reading pubspecs from git (#3670)

diff --git a/lib/src/source/git.dart b/lib/src/source/git.dart
index ffee07d..d4015b3 100644
--- a/lib/src/source/git.dart
+++ b/lib/src/source/git.dart
@@ -248,13 +248,15 @@
 
     late List<String> lines;
     try {
+      // TODO(sigurdm): We should have a `git.run` alternative that gives back
+      // a stream of stdout instead of the lines.
       lines = await git
           .run(['show', '$revision:$pathInCache'], workingDir: repoPath);
     } on git.GitException catch (_) {
       fail('Could not find a file named "$pathInCache" in '
           '${GitDescription.prettyUri(description.url)} $revision.');
     }
-    return lines.join();
+    return lines.join('\n');
   }
 
   @override
diff --git a/test/get/git/check_out_test.dart b/test/get/git/check_out_test.dart
index ada5461..6c3025e 100644
--- a/test/get/git/check_out_test.dart
+++ b/test/get/git/check_out_test.dart
@@ -43,6 +43,25 @@
     expect(packageSpec('foo'), isNotNull);
   }, skip: true);
 
+  test('checks out a package from Git using non-json YAML', () async {
+    ensureGit();
+
+    await d.git('foo.git', [
+      d.libDir('foo'),
+      d.file('pubspec.yaml', '''
+name: foo
+environment:
+  sdk: ^0.1.2
+'''),
+    ]).create();
+
+    await d.appDir({
+      'foo': {'git': '../foo.git'}
+    }).create();
+
+    await pubGet();
+  });
+
   test(
       'checks out a package from Git with a name that is not a valid '
       'file name in the url', () async {