yd: Use yt-dlp instead of youtube-dl
[sunny256-utils.git] / ga-fixnew
blob11f2a076e639cfda8d52d6b255fae0b14ddfd11d
1 #!/usr/bin/env bash
3 #=======================================================================
4 # ga-fixnew
5 # File ID: 1fc79a40-015b-11e5-a869-f13c8f9a2603
7 # Fix broken symlinks for new files from the last month (can be
8 # overridden) in git-annex. Useful when moving lots of files around and
9 # committing with --no-verify (or disabling the automatic symlink fixing
10 # in .git/hooks/pre-commit) to properly record file moves in Git.
12 # Author: Øyvind A. Holm <sunny@sunbase.org>
13 # License: GNU General Public License version 2 or later.
14 #=======================================================================
16 progname=ga-fixnew
17 VERSION=0.3.0
19 ARGS="$(getopt -o "\
23 " -l "\
24 help,\
25 quiet,\
26 verbose,\
27 version,\
28 " -n "$progname" -- "$@")"
29 test "$?" = "0" || exit 1
30 eval set -- "$ARGS"
32 opt_help=0
33 opt_quiet=0
34 opt_verbose=0
35 while :; do
36 case "$1" in
37 -h|--help) opt_help=1; shift ;;
38 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
39 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
40 --version) echo $progname $VERSION; exit 0 ;;
41 --) shift; break ;;
42 *) echo $progname: Internal error >&2; exit 1 ;;
43 esac
44 done
45 opt_verbose=$(($opt_verbose - $opt_quiet))
47 if test "$opt_help" = "1"; then
48 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
49 cat <<END
51 Fix broken symlinks for new files from the last month (can be
52 overridden) in git-annex. Useful when moving lots of files around and
53 committing with --no-verify (or disabling the automatic symlink fixing
54 in .git/hooks/pre-commit) to properly record file moves in Git.
56 Arguments and options after " -- " are delivered to git-allfiles(1)
57 which delivers them further to "git log".
59 Usage: $progname [options] [ -- options_to_git-allfiles ]
61 Options:
63 -h, --help
64 Show this help.
65 -q, --quiet
66 Be more quiet. Can be repeated to increase silence.
67 -v, --verbose
68 Increase level of verbosity. Can be repeated.
69 --version
70 Print version information.
72 END
73 exit 0
76 msg() {
77 echo
78 echo ==== $progname: $*
81 toplevel="$(git rev-parse --show-toplevel)"
82 cd "$toplevel" || {
83 echo $progname: $toplevel: Cannot chdir to top of repo >&2
84 exit 1
87 git wait-until-clean -u
89 msg ga fix
90 git allfiles --since=1.month "$@" |
91 strip-nonexisting |
92 xargs -d \\n --no-run-if-empty ga fix