Skip to content
Snippets Groups Projects
Select Git revision
  • v1.0rc3
  • passt default
  • master
  • pu
  • todo
  • next
  • maint
  • v2.8.0-rc1
  • v2.8.0-rc0
  • v2.7.2
  • v2.7.1
  • v2.7.0
  • v2.6.5
  • v2.7.0-rc3
  • v2.7.0-rc2
  • v2.7.0-rc1
  • v2.7.0-rc0
  • v2.6.4
  • v2.6.3
  • v2.6.2
  • v2.6.1
  • v2.3.10
  • v2.5.4
  • v2.4.10
  • v2.6.0
  • v2.6.0-rc3
  • v2.5.3
27 results

git-lost-found.sh

Blame
  • user avatar
    Junio C Hamano authored
    Because we use "lost-found" as the directory name to hold
    dangling object names, it is confusing to call the command
    git-lost+found, although it makes sense and is even cute ;-).
    
    Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
    0086e2c8
    History
    git-lost-found.sh 420 B
    #!/bin/sh
    
    . git-sh-setup || die "Not a git archive."
    
    laf="$GIT_DIR/lost-found"
    rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
    
    git fsck-objects |
    while read dangling type sha1
    do
    	case "$dangling" in
    	dangling)
    		if git-rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null
    		then
    			dir="$laf/commit"
    			git-show-branch "$sha1"
    		else
    			dir="$laf/other"
    		fi
    		echo "$sha1" >"$dir/$sha1"
    		;;
    	esac
    done