bin/git-bre

Tue, 21 Jun 2016 15:14:34 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Tue, 21 Jun 2016 15:14:34 -0400
changeset 338
296f4b036ae3
child 342
41f152d6ab1b
permissions
-rwxr-xr-x

move git-bre into a real command with better filename safety

338
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 #!/bin/sh
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 set -eu
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 # git-bre: "branch edit", run $EDITOR with a list of all files touched in this
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 # branch compared to upstream. Any args are passed to the editor, before the
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 # file list.
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 CHANGED=$(
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 git diff --name-only @{u}.. | while read file
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 do
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 echo \'$file\'
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 done
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 )
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14
296f4b036ae3 move git-bre into a real command with better filename safety
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 eval "exec $EDITOR $@ ${CHANGED:?[No files to edit]}"

mercurial