Skip to content

Commit 956f1df

Browse files
committed
Add git-ls-conflicts
Signed-off-by: Joe Block <jpb@unixorn.net>
1 parent d015dac commit 956f1df

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

bin/git-ls-conflicts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
#
3+
# List files with conflicts
4+
#
5+
# Copyright 2022, Joe Block <jpb@unixorn.net>
6+
7+
set -o pipefail
8+
if [[ -n "$DEBUG" ]]; then
9+
set -x
10+
fi
11+
12+
BASENAME=$(basename "${0}")
13+
14+
function debug() {
15+
if [[ -n "$DEBUG" ]]; then
16+
echo "$@"
17+
fi
18+
}
19+
20+
function fail() {
21+
printf '%s\n' "$1" >&2 ## Send message to stderr. Exclude >&2 if you don't want it that way.
22+
exit "${2-1}" ## Return a code specified by $2 or 1 by default.
23+
}
24+
25+
function usage() {
26+
echo "Usage:"
27+
echo
28+
echo " ${BASENAME}"
29+
echo
30+
echo "List files with merge conflicts"
31+
}
32+
33+
if [[ $# -eq 1 ]]; then
34+
if [ "$1" == '-h' ] || [ "$1" == '--help' ] ; then
35+
usage
36+
exit 0
37+
fi
38+
fi
39+
40+
if [[ $# -ne 0 ]]; then
41+
usage
42+
exit 0
43+
fi
44+
45+
exec git diff --name-only --diff-filter=U

0 commit comments

Comments
 (0)