This file is indexed.

/usr/lib/guilt/guilt-repair is in guilt 0.36-0.2ubuntu2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2008-2013
#

DO_NOT_CHECK_STATUS_FILE_FORMAT=1

USAGE="--full | --status"
if [ -z "$GUILT_VERSION" ]; then
	echo "Invoking `basename "$0"` directly is no longer supported." >&2
	exit 1
fi

safety_abort()
{
	die "Please read the man page first. (you need to specify repair mode to proceed)."
}

#
# Check whether status file needs fixing/upgrading. If not, just return,
# otherwise proceed to rewrite the status file and set up proper refs
#
repair_status()
{
	_disp "Checking status file format..."
	if ! grep "^[0-9a-f]\{40\}:" "$applied" > /dev/null ; then
		disp "ok; no upgrade necessary."
		return 0
	fi
	disp "old; about to upgrade."

	# we got an old format status file

	printf "" > "$applied.new"

	cat "$applied" | while read line ; do
		hash=`echo "$line" | cut -d: -f1`
		pname=`echo "$line" | cut -d: -f2-`

		npname=`echo "$pname" | sed -e 's/ /-/g'`
		[ "$pname" != "$npname" -a -e "$npname" ] && die "Patch name collision"

		git update-ref "refs/patches/$branch/$npname" "$hash"
		echo "$npname" >> "$applied.new"

		if [ "$pname" != "$npname" ]; then
			series_rename_patch "$pname" "$npname"

			mv "$GUILT_DIR/$branch/$pname" "$GUILT_DIR/$branch/$npname"
		fi
	done

	# replace the status file
	mv "$applied" "$applied~"
	mv "$applied.new" "$applied"

	disp "Upgrade complete."

	return 0
}

#
# Pop all patches - forcefully.
#
repair_pushed()
{
	if [ -s "$applied" ]; then
		# there were some patches applied
		newrev=`git rev-parse refs/patches/$branch/$(head_n 1 < "$applied")^`
	else
		# no patches were applied, but let's do all the work anyway
		newrev="$oldrev"
	fi

	disp "Current  HEAD commit $oldrev"
	disp "New      HEAD commit $newrev"

	disp "About to forcefully pop all patches..."
	_disp "Are you sure you want to proceed? [y/N] "
	read n
	if [ "$n" != "y" ] && [ "$n" != "Y" ]; then
		die "Aborting..."
	fi

	# blow away any commits
	git reset --hard "$newrev" > /dev/null
	if [ "`git symbolic-ref HEAD`" = "refs/heads/$GUILT_PREFIX$branch" ] && ! $old_style_prefix
	then
		git symbolic-ref HEAD refs/heads/$branch
		git update-ref -d refs/heads/$GUILT_PREFIX$branch
	fi

	# blow away the applied stack
	remove_patch_refs < "$applied"
	printf "" > "$applied"

	disp "Patches should be popped."
	return 0
}

_main() {

[ $# -ne 1 ] && safety_abort

case "$1" in
	--full)
		repair="full"
		;;
	--status)
		repair="status"
		;;
	--autotag)
		echo "Autotagging is no longer supported" >&2
		;;
	*)
		usage
		;;
esac

oldrev=`git show-ref -s "refs/heads/\`git_branch\`"`

case "$repair" in
	full)
		repair_status
		repair_pushed
		;;
	status)
		repair_status
		;;
	*)
		die "Internal error"
		;;
esac

disp "Repair complete."
exit 0

}