From 10ec613441545b3dcc23960582b94fc0fa31bb2b Mon Sep 17 00:00:00 2001
From: Eric Amodio <eamodio@gmail.com>
Date: Mon, 28 Dec 2020 13:36:54 -0500
Subject: [PATCH] Fixes #1294 - removes (if) syntax

---
 CHANGELOG.md                 |  6 ++++++
 src/git/parsers/tagParser.ts | 12 +++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c58b44..e19e444 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
 
+## [Unreleased]
+
+### Fixed
+
+- Fixes [#1294](https://github.com/eamodio/vscode-gitlens/issues/1294) - Error when open commits list
+
 ## [11.1.0] - 2020-12-23
 
 ### Added
diff --git a/src/git/parsers/tagParser.ts b/src/git/parsers/tagParser.ts
index 4bf603e..88e62ef 100644
--- a/src/git/parsers/tagParser.ts
+++ b/src/git/parsers/tagParser.ts
@@ -2,7 +2,7 @@
 import { GitTag } from '../git';
 import { debug } from '../../system';
 
-const tagRegex = /^<n>(.+)<r>(.*)<d>(.*)<ad>(.*)<s>(.*)$/gm;
+const tagRegex = /^<n>(.+)<\*r>(.*)<r>(.*)<d>(.*)<ad>(.*)<s>(.*)$/gm;
 
 // Using %x00 codes because some shells seem to try to expand things if not
 const lb = '%3c'; // `%${'<'.charCodeAt(0).toString(16)}`;
@@ -11,7 +11,8 @@ const rb = '%3e'; // `%${'>'.charCodeAt(0).toString(16)}`;
 export class GitTagParser {
 	static defaultFormat = [
 		`${lb}n${rb}%(refname)`, // tag name
-		`${lb}r${rb}%(if)%(*objectname)%(then)%(*objectname)%(else)%(objectname)%(end)`, // ref
+		`${lb}*r${rb}%(*objectname)`, // ref
+		`${lb}r${rb}%(objectname)`, // ref
 		`${lb}d${rb}%(creatordate:iso8601)`, // created date
 		`${lb}ad${rb}%(authordate:iso8601)`, // author date
 		`${lb}s${rb}%(subject)`, // message
@@ -24,7 +25,8 @@ export class GitTagParser {
 		const tags: GitTag[] = [];
 
 		let name;
-		let ref;
+		let ref1;
+		let ref2;
 		let date;
 		let commitDate;
 		let message;
@@ -34,7 +36,7 @@ export class GitTagParser {
 			match = tagRegex.exec(data);
 			if (match == null) break;
 
-			[, name, ref, date, commitDate, message] = match;
+			[, name, ref1, ref2, date, commitDate, message] = match;
 
 			// Strip off refs/tags/
 			name = name.substr(10);
@@ -44,7 +46,7 @@ export class GitTagParser {
 					repoPath,
 					name,
 					// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
-					` ${ref}`.substr(1),
+					` ${ref1 || ref2}`.substr(1),
 					// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
 					` ${message}`.substr(1),
 					new Date(date),