From: Patrick Steinhardt Date: Mon, 12 May 2025 09:19:58 +0000 (+0200) Subject: contrib: remove "git-resurrect.sh" X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb9a9297d708827151442cba4d9f39eeede245a4;p=thirdparty%2Fgit.git contrib: remove "git-resurrect.sh" The "git-resurrect.sh" script can be used to find traces of a branch tip in the reflog and resurrect that branch. Despite a couple of global cleanups, the script hasn't seen any activity since it was introduced in e1ff064e1bf (contrib git-resurrect: find traces of a branch name and resurrect it, 2009-02-04). Furthermore, the tool does not work with the "reftable" backend at all as it directly reads ".git/logs/HEAD". As reflogs are stored as part of the individual tables though that file wouldn't exist in a "reftable"- enabled repository. Last but not least, the tool doesn't even work unless it is explicitly invoked via `git resurrect` as it sources "git-sh-setup". As none of our build systems know to install this script, users thus have to go out of their way to really make it work, which is highly unlikely. Another source that indicates that this tool can be removed is a question for how to restore deleted branches on StackOverflow [1]. The top-voted answer uses git-reflog(1) directly and has received more than 3000 votes to date. While "git-resurrect.sh" is also mentioned, it only got 16 upvotes, and comments mention the above caveat that users have to do some manual setup to make it work. It's thus rather clear that the tool doesn't have a lot or even any users. Remove it. [1]: https://stackoverflow.com/questions/3640764/can-i-recover-a-branch-after-its-deletion-in-git Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh deleted file mode 100755 index d843df3afd..0000000000 --- a/contrib/git-resurrect.sh +++ /dev/null @@ -1,181 +0,0 @@ -#!/bin/sh - -USAGE="[-a] [-r] [-m] [-t] [-n] [-b ] " -LONG_USAGE="git-resurrect attempts to find traces of a branch tip -called , and tries to resurrect it. Currently, the reflog is -searched for checkout messages, and with -r also merge messages. With --m and -t, the history of all refs is scanned for Merge into -other/Merge into (respectively) commit subjects, which -is rather slow but allows you to resurrect other people's topic -branches." - -OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= -OPTIONS_SPEC="\ -git resurrect $USAGE --- -b,branch= save branch as instead of -a,all same as -l -r -m -t -k,keep-going full rev-list scan (instead of first match) -l,reflog scan reflog for checkouts (enabled by default) -r,reflog-merges scan for merges recorded in reflog -m,merges scan for merges into other branches (slow) -t,merge-targets scan for merges of other branches into -n,dry-run don't recreate the branch" - -. git-sh-setup - -search_reflog () { - sed -ne 's~^\([^ ]*\) .* checkout: moving from '"$1"' .*~\1~p' \ - < "$GIT_DIR"/logs/HEAD -} - -search_reflog_merges () { - git rev-parse $( - sed -ne 's~^[^ ]* \([^ ]*\) .* merge '"$1"':.*~\1^2~p' \ - < "$GIT_DIR"/logs/HEAD - ) -} - -oid_pattern=$(git hash-object --stdin /dev/null; then - printf "** Restoring $new_name to " - git --no-pager log -1 --pretty=tformat:"%h %s" $newest - git branch $new_name $newest -else - printf "Most recent: " - git --no-pager log -1 --pretty=tformat:"%h %s" $newest - echo "** $new_name already exists, doing nothing" -fi