+# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
+# insert_sorted_if_absent.
+insert_vc_ignore() {
+ vc_ignore_file="$1"
+ case $vc_ignore_file in
+ *.gitignore)
+ # A .gitignore entry that does not start with `/' applies recursively to
+ # subdirectories, so prepend `/' to every .gitignore entry.
+ pattern=`echo "$2" | sed s,^,/,`;;
+ *)
+ pattern="$2";;
+ esac
+ insert_sorted_if_absent "$vc_ignore_file" "$pattern"
+}
+