git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add contrib/stg-gitk: helper script to run gitk

From
Yann Dirson <ydirson@altern.org>
Date
Jan 8, 2007, 22:12 UTC
Message-ID
<20070108220918.18329.30083.stgit@gandelf.nowhere.earth>
Signed-off-by: Yann Dirson <ydirson@altern.org>
---

Here is a small helper script implementing the display of current/named/all stgit stacks (or standard branches) in gitk. As noted earlier, that does not allow to see new refs by requesting an update from gitk, but it will still be useful to me at least :)

 contrib/stg-gitk |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/contrib/stg-gitk b/contrib/stg-gitk
new file mode 100755
index 0000000..8d4ae43
--- /dev/null
+++ b/contrib/stg-gitk
@@ -0,0 +1,59 @@
+#!/bin/sh
+set -e
+
+# stg-gitk - helper script to graphically display an StGIT stack
+
+# Allows quick synchronization of a cvs mirror branch (does not try to
+# reconstruct patchsets, creates "jumbo" commits), and commits stgit
+# patches to CVS.
+
+# LIMITATIONS:
+# - asking gitk to "update" won't detect any new ref
+# - no support for spaces in branch names
+
+# Copyright (c) 2007 Yann Dirson <ydirson@altern.org>
+# Subject to the GNU GPL, version 2.
+
+usage()
+{
+    echo "Usage: $(basename $0) [<branches>|--all]"
+    exit 1
+}
+
+allbranches=0
+case "$1" in
+--all) allbranches=1; shift ;;
+--*) usage ;;
+*) break ;;
+esac
+
+if [ $allbranches = 1 ] && [ "$#" -gt 0 ]; then
+    usage
+fi
+
+GIT_DIR=$(git-rev-parse --git-dir)
+GIT_DIR_SPKIPLEN=$(printf "$GIT_DIR/X" | wc -c)
+
+refdirs=''
+if [ $allbranches = 1 ]; then
+    refdirs="$GIT_DIR/refs"
+else
+    if [ "$#" = 0 ]; then
+	set -- "$(stg branch)"
+    fi
+
+    for b in "$@"; do
+	if [ -e "$GIT_DIR/refs/patches/$b" ]; then
+	    # StGIT branch: show all patches
+	    refdirs="$refdirs $GIT_DIR/refs/patches/$b"
+	elif [ -e "$GIT_DIR/refs/heads/$b" ]; then
+	    # other GIT branch
+	    refdirs="$refdirs $GIT_DIR/refs/heads/$b"
+	else
+	    echo >&2 "ERROR: no such branch '$b'"
+	    usage
+	fi
+    done
+fi
+
+gitk $(find $refdirs -type f -not -name '*.log' | cut -c${GIT_DIR_SPKIPLEN}- )
Next: Catalin Marinas
Message 1 of 9 in “Add contrib/stg-gitk: helper script to run gitk”
  1. Add contrib/stg-gitk: helper script to run gitkYann Dirson, Jan 8, 2007
  2. Catalin MarinasJan 9, 2007
  3. Yann DirsonJan 9, 2007
  4. BazJan 10, 2007
  5. Yann DirsonJan 10, 2007
  6. Catalin MarinasJan 10, 2007
  7. Catalin MarinasJan 10, 2007
  8. Yann DirsonJan 12, 2007
  9. Catalin MarinasJan 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.