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

[StGIT PATCH 4/5] Fix bash completion after the DAG appliedness patch

From
Karl Hasselström <kha@treskal.com>
Date
Aug 7, 2007, 02:48 UTC
Message-ID
<20070807024801.11373.85323.stgit@yoghurt>
In-Reply-To
<20070807024508.11373.62875.stgit@yoghurt>

The bash tab completion used the "applied", "unapplied" and "current" files to generate completions. Since these don't exist anymore, use stg applied/unapplied/series to obtain the same info. It's a bit slower, but not terribly much so.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 contrib/stgit-completion.bash |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/contrib/stgit-completion.bash b/contrib/stgit-completion.bash
index a843db4..842f0b1 100644
--- a/contrib/stgit-completion.bash
+++ b/contrib/stgit-completion.bash
@@ -70,15 +70,13 @@ _current_branch ()
 # List of all applied patches.
 _applied_patches ()
 {
-    local g=$(_gitdir)
-    [ "$g" ] && cat "$g/patches/$(_current_branch)/applied"
+    stg applied 2> /dev/null
 }
 
 # List of all unapplied patches.
 _unapplied_patches ()
 {
-    local g=$(_gitdir)
-    [ "$g" ] && cat "$g/patches/$(_current_branch)/unapplied"
+    stg unapplied 2> /dev/null
 }
 
 # List of all applied patches.
@@ -91,18 +89,13 @@ _hidden_patches ()
 # List of all patches.
 _all_patches ()
 {
-    local b=$(_current_branch)
-    local g=$(_gitdir)
-    [ "$g" ] && cat "$g/patches/$b/applied" "$g/patches/$b/unapplied"
+    stg series --noprefix 2> /dev/null
 }
 
 # List of all patches except the current patch.
 _all_other_patches ()
 {
-    local b=$(_current_branch)
-    local g=$(_gitdir)
-    [ "$g" ] && cat "$g/patches/$b/applied" "$g/patches/$b/unapplied" \
-        | grep -v "^$(cat $g/patches/$b/current 2> /dev/null)$"
+    stg series 2> /dev/null | grep -v '^>' | cut -f 2 -d ' '
 }
 
 _all_branches ()
Previous: Karl HasselströmNext: Karl Hasselström
Message 5 of 6 in “Compute patch appliedness using the commit DAG”
  1. 0/5 Compute patch appliedness using the commit DAGKarl Hasselström, Aug 7, 2007
  2. 1/5 Make use of the get_patch() utility functionKarl Hasselström, Aug 7, 2007
  3. 2/5 Compute patch appliedness from commit DAGKarl Hasselström, Aug 7, 2007
  4. 3/5 Test the new DAG appliedness machineryKarl Hasselström, Aug 7, 2007
  5. 4/5 Fix bash completion after the DAG appliedness patchKarl Hasselström, Aug 7, 2007
  6. 5/5 Speed up the appliedness testKarl Hasselström, Aug 7, 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.