bin/git-bre

Sat, 25 Jun 2016 03:00:08 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Sat, 25 Jun 2016 03:00:08 -0400
changeset 344
8e4bb4e70b2f
parent 342
41f152d6ab1b
permissions
-rwxr-xr-x

use function-parameters contrib \o/

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
342
41f152d6ab1b fix newlines in CHANGED
Meredith Howard <mhoward@roomag.org>
parents: 338
diff changeset
11 printf "\'$file\' "
338
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