Skip to content

Commit 99b7b18

Browse files
committed
Rename some variables
1 parent 0b5d43e commit 99b7b18

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

git-fmt-diff

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,10 @@ detect_filetype () (
275275

276276
git_changes_formatted () (
277277
tempdir="$1"
278-
cur="$2"
279-
old="$3"
280-
cur_fmt="$4"
281-
old_fmt="$5"
278+
b="$2"
279+
a="$3"
280+
b_fmt="$4"
281+
a_fmt="$5"
282282

283283
merge () { git merge-file -p "$@"; }
284284
diff_fmt="$tempdir"/diff_fmt
@@ -287,39 +287,39 @@ git_changes_formatted () (
287287
rm_list__push "$temp"
288288
rm_list__push "$diff_fmt"
289289

290-
if git diff -s "$cur_fmt" "$old_fmt"; then
291-
merge --our "$cur" "$old" "$cur_fmt" > "$temp"
292-
merge "$cur" "$temp" "$cur_fmt" > "$diff_fmt"
290+
if git diff -s "$b_fmt" "$a_fmt"; then
291+
merge --our "$b" "$a" "$b_fmt" > "$temp"
292+
merge "$b" "$temp" "$b_fmt" > "$diff_fmt"
293293
echo "$diff_fmt"
294294
return
295295
fi
296296

297-
merge --their "$old" "$old_fmt" "$cur_fmt" > "$diff_fmt"
297+
merge --their "$a" "$a_fmt" "$b_fmt" > "$diff_fmt"
298298

299-
merge --our "$diff_fmt" "$old" "$cur" > "$temp"
299+
merge --our "$diff_fmt" "$a" "$b" > "$temp"
300300
if ! git diff -s "$diff_fmt" "$temp"; then
301-
merge --their "$cur" "$diff_fmt" "$cur_fmt" > "$temp"
302-
merge --their "$cur" "$temp" "$cur_fmt" > "$diff_fmt"
301+
merge --their "$b" "$diff_fmt" "$b_fmt" > "$temp"
302+
merge --their "$b" "$temp" "$b_fmt" > "$diff_fmt"
303303
fi
304304

305-
merge --our "$old" "$old_fmt" "$cur" > "$temp"
305+
merge --our "$a" "$a_fmt" "$b" > "$temp"
306306
if ! git diff -s "$diff_fmt" "$temp"; then
307307
echo "$diff_fmt"
308308
fi
309309
)
310310

311311
git_diff () (
312-
cur="$1"
313-
new="$2"
312+
b="$1"
313+
diff_fmt="$2"
314314
filename="$3"
315315

316316
[ "$gf_use_color" = 1 ] && color="--color" || color=
317317

318318
# shellcheck disable=SC2086
319-
git diff $color "$cur" "$new" | \
319+
git diff $color "$b" "$diff_fmt" | \
320320
sed \
321-
-e "s/$(sed_esc -p "a$cur")/$(sed_esc -s "a/$filename")/g" \
322-
-e "s/$(sed_esc -p "b$new")/$(sed_esc -s "b/$filename")/g"
321+
-e "s/$(sed_esc -p "a$b")/$(sed_esc -s "a/$filename")/g" \
322+
-e "s/$(sed_esc -p "b$diff_fmt")/$(sed_esc -s "b/$filename")/g"
323323
)
324324

325325
git_retrieve_file_from_sha () (
@@ -359,17 +359,17 @@ list_files () (
359359
process_file () (
360360
sha1="$1"
361361
sha2="$2"
362-
old_name="$3"
363-
cur_name="${4:-$old_name}"
362+
a_name="$3"
363+
b_name="${4:-$a_name}"
364364

365-
debug "--- PROCESSING: $cur_name ---"
365+
debug "--- PROCESSING: $b_name ---"
366366
debug "args = " "$@"
367367

368-
case "$(git_conf_get "$cur_name" ignore)" in
368+
case "$(git_conf_get "$b_name" ignore)" in
369369
true|1) return ;;
370370
esac
371371

372-
formatter="$(git_conf_get "$cur_name" formatter)"
372+
formatter="$(git_conf_get "$b_name" formatter)"
373373
debug "formatter = $formatter"
374374

375375
if [ -z "$formatter" ]; then
@@ -384,35 +384,35 @@ process_file () (
384384
tempdir="$(mktemp -d)"
385385
rm_list__push "$tempdir"
386386

387-
debug "$cur_name => $tempdir"
387+
debug "$b_name => $tempdir"
388388

389-
cur="$tempdir"/cur
390-
old="$tempdir"/old
391-
cur_fmt="$tempdir"/cur_fmt
392-
old_fmt="$tempdir"/old_fmt
389+
b="$tempdir"/b
390+
a="$tempdir"/a
391+
b_fmt="$tempdir"/b_fmt
392+
a_fmt="$tempdir"/a_fmt
393393

394-
git_retrieve_file_from_sha "$sha1" "" > "$old"
395-
git_retrieve_file_from_sha "$sha2" "$cur_name" > "$cur"
396-
rm_list__push "$old" "$cur"
394+
git_retrieve_file_from_sha "$sha1" "" > "$a"
395+
git_retrieve_file_from_sha "$sha2" "$b_name" > "$b"
396+
rm_list__push "$a" "$b"
397397

398-
if [ ! -s "$cur" ]; then
399-
warn "couldn't retrieve ${obj2:+$obj2:}$cur_name"
398+
if [ ! -s "$b" ]; then
399+
warn "couldn't retrieve ${obj2:+$obj2:}$b_name"
400400
fi
401401

402-
sh -c "$formatter" < "$cur" > "$cur_fmt" 2> /dev/null
403-
rm_list__push "$cur_fmt"
402+
sh -c "$formatter" < "$b" > "$b_fmt" 2> /dev/null
403+
rm_list__push "$b_fmt"
404404

405-
if ! git diff -s "$cur" "$cur_fmt"; then
406-
sh -c "$formatter" < "$old" > "$old_fmt" 2> /dev/null
407-
rm_list__push "$old_fmt"
405+
if ! git diff -s "$b" "$b_fmt"; then
406+
sh -c "$formatter" < "$a" > "$a_fmt" 2> /dev/null
407+
rm_list__push "$a_fmt"
408408

409409
diff_fmt="$(git_changes_formatted \
410410
"$tempdir" \
411-
"$cur" "$old" "$cur_fmt" "$old_fmt" \
411+
"$b" "$a" "$b_fmt" "$a_fmt" \
412412
)"
413413

414414
if [ -n "$diff_fmt" ]; then
415-
git_diff "$cur" "$diff_fmt" "$cur_name"
415+
git_diff "$b" "$diff_fmt" "$b_name"
416416
fi
417417
fi
418418
)

0 commit comments

Comments
 (0)