Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion git-fixup
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ grok_diff='/^--- .*/p ;
# staged (U1 to diff is used to give some context for when adding items to
# lists etc) and looking up the previous commits touching those sections.
function fixup_candidates_lines () {
local saved_ifs="$IFS"
local IFS=$'\0'
local changed_files=($(git diff --cached --name-only -z | head -c-1))
IFS="$saved_ifs"

git diff --cached -U1 --no-prefix | sed -n "$grok_diff" | (
file=''
while read offs len; do
Expand All @@ -39,7 +44,9 @@ function fixup_candidates_lines () {
fi
fi
done
) | grep -v "^^" | cut -d' ' -f 1 | sed 's/^/L /g'
) | grep -v "^^" | cut -d' ' -f 1 \
| grep -v -f <(git rev-list -E --grep='^(fixup|squash)' $rev_range -- "${changed_files[@]}") \
| sed 's/^/L /g'
}

# Produce suggestion of commits by taking the latest commit to each file with
Expand Down