DORMANTno replies

[PATCH TopGit] tg-export.sh: support tag objects as parent

From: Andrey Borzenkov <hidden>
Date: 2016-06-15 22:50:48
Subsystem: the rest · Maintainer: Linus Torvalds

Currently tg-export fails with

Collapsing u/quota-pull
fatal: 2770ca86dec8b9cc36bf50127e5aff7f29557e3c is not a valid 'commit' object

Check for and resolve tag objects for parent.

Signed-off-by: Andrey Borzenkov <redacted>

---
 tg-export.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tg-export.sh b/tg-export.sh
index 486ec94..4574882 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -95,7 +95,8 @@ collapsed_commit()
 	>"$playground/^body"
 
 	# Determine parent
-	parent="$(cut -f 1 "$playground/$name^parents")"
+	parent="$(cut -f 1 "$playground/$name^parents" | \
+		while read p; do [ $(git cat-file -t $p 2> /dev/null) = tag ] && git cat-file tag $p | head -1 | cut -d' ' -f2 || echo $p; done)"
 	if [ "$(cat "$playground/$name^parents" | wc -l)" -gt 1 ]; then
 		# Produce a merge commit first
 		parent="$({
-- 
tg: (9aa66bc..) u/parent-tag (depends on: u/signed-off-by)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help