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

[PATCH 10/19] 'prune' command to clear out stale .gittrees info

From
Paul Campbell <pcampbell@kemitix.net>
Date
Mar 9, 2013, 19:27 UTC
Message-ID
<CALeLG_=fr1WxO3ckpxsSh-LX3oSMJLQU-za2PEF6BR7sschPfA@mail.gmail.com>
>From 1aaa55ff64b3b4d9325568b3bb863748f20c80f3 Mon Sep 17 00:00:00 2001
From: Paul Campbell <pcampbell@kemitix.net>
Date: Sat, 9 Mar 2013 18:33:33 +0000
Subject: [PATCH 10/19] 'prune' command to clear out stale .gittrees info
Conflicts:
	git-subtree.sh
Original-Author: Nate Jones <nate@endot.org>
Conflicts-resolved-by: Paul Campbell <pcampbell@kemitix.net>
---
 contrib/subtree/git-subtree.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 7d08064..0c41383 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -105,12 +105,12 @@ done
 command="$1"
 shift
 case "$command" in
-	add|merge|pull|from-submodule|pull-all|push-all) default= ;;
+    add|merge|pull|from-submodule|pull-all|push-all|prune) default= ;;
 	*) die "Unknown command '$command'" ;;
     split|push|diff|list) default="--default HEAD" ;;
 esac

-if [ -z "$prefix" -a "$command" != "pull-all" -a "$command" !=
"push-all" -a "$command" != "list" ]; then
+if [ -z "$prefix" -a "$command" != "pull-all" -a "$command" !=
"push-all" -a "$command" != "list" -a "$command" != "prune" ]; then
 	die "You must provide the --prefix option."
 fi

@@ -839,6 +839,17 @@ cmd_list()
   subtree_list
 }

+cmd_prune()
+{
+    git config -f .gittrees -l | grep subtree | grep path | grep -o
'=.*' | grep -o '[^=].*' |
+    while read path; do
+        if [ ! -e "$path" ]; then
+            echo "pruning $path"
+            git config -f .gittrees --remove-section subtree.$path
+        fi
+    done
+}
+
 cmd_pull-all()
 {
     git config -f .gittrees -l | grep subtree | grep path | grep -o
'=.*' | grep -o '[^=].*' |
-- 
1.8.2.rc1


-- 
Paul [W] Campbell
Message 1 of 1 in “'prune' command to clear out stale .gittrees info”
  1. 10/19 'prune' command to clear out stale .gittrees infoPaul Campbell, Mar 9, 2013

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.