From 368ced078b6679255989d9c5dbc7b440e9191b2a Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 13 Jan 2018 15:07:38 -0800 Subject: [PATCH] tg-update.sh: include real branch in fullcmd The "tg status" command shows the initial full command that was interrupted when a "tg update" drops out for manual conflict resolution. However, if "tg update" was run with no arguments or with the shortcut "HEAD" or "@" the displayed command can be singularly unhelpful in determining what the original operation was trying to update. Correct this deficiency by munging the "$fullcmd" value to include the actual TopGit branch name that's being updated so that the "tg status" command will show it in the case when no arguments were given or a single "@" or "HEAD" argument was given. While this does not cover all possible cases, it covers the vast majority of them and represents a big improvement over just showing the default "tg update" or "tg update HEAD" as the invoking command in the "tg status" output. Signed-off-by: Kyle J. McKay --- tg-update.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tg-update.sh b/tg-update.sh index 2b14a7e..c71b80b 100644 --- a/tg-update.sh +++ b/tg-update.sh @@ -1,7 +1,7 @@ #!/bin/sh # TopGit - A different patch queue manager # Copyright (C) Petr Baudis 2008 -# Copyright (C) Kyle J. McKay 2015,2016,2017 +# Copyright (C) Kyle J. McKay 2015,2016,2017,2018 # All rights reserved. # GPLv2 @@ -385,6 +385,13 @@ if [ -z "$restored" ]; then done } clean_names $names + if [ "$namecnt" -eq 1 ]; then + case "$fullcmd" in *" @"|*" HEAD") + namecnt=0 + fullcmd="${fullcmd% *}" + esac + fi + [ "$namecnt" -ne 0 ] || fullcmd="$fullcmd $names" fi ensure_clean_tree fi -- 2.11.4.GIT