mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	build(vim-patch.sh): use sed -E for portable regexp (#24734)
Also always use -e for consistency.
This commit is contained in:
		@@ -174,17 +174,17 @@ assign_commit_details() {
 | 
			
		||||
 | 
			
		||||
  vim_commit_url="https://github.com/vim/vim/commit/${vim_commit}"
 | 
			
		||||
  vim_message="$(git -C "${VIM_SOURCE_DIR}" log -1 --pretty='format:%B' "${vim_commit}" \
 | 
			
		||||
      | sed -e 's/\(#[0-9]\{1,\}\)/vim\/vim\1/g')"
 | 
			
		||||
      | sed -Ee 's/(#[0-9]{1,})/vim\/vim\1/g')"
 | 
			
		||||
  local vim_coauthor0
 | 
			
		||||
  vim_coauthor0="$(git -C "${VIM_SOURCE_DIR}" log -1 --pretty='format:Co-authored-by: %an <%ae>' "${vim_commit}")"
 | 
			
		||||
  # Extract co-authors from the commit message.
 | 
			
		||||
  vim_coauthors="$(echo "${vim_message}" | (grep -E '^Co-authored-by: ' || true) | (grep -Fxv "${vim_coauthor0}" || true))"
 | 
			
		||||
  vim_coauthors="$(echo "${vim_coauthor0}"; echo "${vim_coauthors}")"
 | 
			
		||||
  # Remove Co-authored-by and Signed-off-by lines from the commit message.
 | 
			
		||||
  vim_message="$(echo "${vim_message}" | sed -e '/^\(Co-authored\|Signed-off\)-by: /d')"
 | 
			
		||||
  vim_message="$(echo "${vim_message}" | grep -Ev '^(Co-authored|Signed-off)-by: ')"
 | 
			
		||||
  if [[ ${munge_commit_line} == "true" ]]; then
 | 
			
		||||
    # Remove first line of commit message.
 | 
			
		||||
    vim_message="$(echo "${vim_message}" | sed -e '1s/^patch /vim-patch:/')"
 | 
			
		||||
    vim_message="$(echo "${vim_message}" | sed -Ee '1s/^patch /vim-patch:/')"
 | 
			
		||||
  fi
 | 
			
		||||
  patch_file="vim-${vim_version}.patch"
 | 
			
		||||
}
 | 
			
		||||
@@ -233,71 +233,71 @@ preprocess_patch() {
 | 
			
		||||
 | 
			
		||||
  # Remove some *.po files. #5622
 | 
			
		||||
  local na_po='sjiscorr\.c\|ja\.sjis\.po\|ko\.po\|pl\.cp1250\.po\|pl\.po\|ru\.cp1251\.po\|uk\.cp1251\.po\|zh_CN\.cp936\.po\|zh_CN\.po\|zh_TW\.po'
 | 
			
		||||
  2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\<\%('${na_po}'\)\>@norm! d/\v(^diff)|%$
 | 
			
		||||
  2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\<\%('${na_po}'\)\>@norm! d/\v(^diff)|%$
 | 
			
		||||
' +w +q "$file"
 | 
			
		||||
 | 
			
		||||
  # Remove vimrc_example.vim
 | 
			
		||||
  local na_vimrcexample='vimrc_example\.vim'
 | 
			
		||||
  local na_vimrcexample='vimrc_example\.vim'
 | 
			
		||||
  2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/\<\%('${na_vimrcexample}'\)\>@norm! d/\v(^diff)|%$
 | 
			
		||||
' +w +q "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename src/testdir/ paths to test/old/testdir/
 | 
			
		||||
  # Rename src/testdir/ paths to test/old/testdir/
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab])\/src\/testdir/\1\/test\/old\/testdir/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename src/ paths to src/nvim/
 | 
			
		||||
  # Rename src/ paths to src/nvim/
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src)/\1\/nvim/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename evalfunc.c to eval/funcs.c
 | 
			
		||||
  # Rename evalfunc.c to eval/funcs.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/evalfunc\.c/\1\/eval\/funcs.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename evalvars.c to eval/vars.c
 | 
			
		||||
  # Rename evalvars.c to eval/vars.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/evalvars\.c/\1\/eval\/vars.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename userfunc.c to eval/userfunc.c
 | 
			
		||||
  # Rename userfunc.c to eval/userfunc.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/userfunc\.c/\1\/eval\/userfunc.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename evalbuffer.c to eval/buffer.c
 | 
			
		||||
  # Rename evalbuffer.c to eval/buffer.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/evalbuffer\.c/\1\/eval\/buffer.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename evalwindow.c to eval/window.c
 | 
			
		||||
  # Rename evalwindow.c to eval/window.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/evalwindow\.c/\1\/eval\/window.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename map.c to mapping.c
 | 
			
		||||
  # Rename map.c to mapping.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/map\.c/\1\/mapping.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename profiler.c to profile.c
 | 
			
		||||
  # Rename profiler.c to profile.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/profiler\.c/\1\/profile.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename scriptfile.c to runtime.c
 | 
			
		||||
  # Rename scriptfile.c to runtime.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/scriptfile\.c/\1\/runtime.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename session.c to ex_session.c
 | 
			
		||||
  # Rename session.c to ex_session.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/session\.c/\1\/ex_session.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename highlight.c to highlight_group.c
 | 
			
		||||
  # Rename highlight.c to highlight_group.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/highlight\.c/\1\/highlight_group.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename locale.c to os/lang.c
 | 
			
		||||
  # Rename locale.c to os/lang.c
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/locale\.c/\1\/os\/lang.c/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename keymap.h to keycodes.h
 | 
			
		||||
  # Rename keymap.h to keycodes.h
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/src\/nvim)\/keymap\.h/\1\/keycodes.h/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
  # Rename terminal.txt to nvim_terminal_emulator.txt
 | 
			
		||||
  # Rename terminal.txt to nvim_terminal_emulator.txt
 | 
			
		||||
  LC_ALL=C sed -Ee 's/( [ab]\/runtime\/doc)\/terminal\.txt/\1\/nvim_terminal_emulator.txt/g' \
 | 
			
		||||
    "$file" > "$file".tmp && mv "$file".tmp "$file"
 | 
			
		||||
 | 
			
		||||
@@ -536,7 +536,7 @@ list_vimpatch_tokens() {
 | 
			
		||||
# Gets all Vim commits since the "start" commit.
 | 
			
		||||
list_vim_commits() { (
 | 
			
		||||
  cd "${VIM_SOURCE_DIR}" && git log --reverse v8.1.0000..HEAD "$@"
 | 
			
		||||
) }
 | 
			
		||||
) }
 | 
			
		||||
 | 
			
		||||
# Prints all (sorted) "vim-patch:xxx" tokens found in the Nvim git log.
 | 
			
		||||
list_vimpatch_tokens() {
 | 
			
		||||
@@ -544,7 +544,7 @@ list_vimpatch_tokens() {
 | 
			
		||||
  git -C "${NVIM_SOURCE_DIR}" log -E --grep='vim-patch:[^ ,{]{7,}' \
 | 
			
		||||
    | grep -oE 'vim-patch:[^ ,{:]{7,}' \
 | 
			
		||||
    | sort \
 | 
			
		||||
    | uniq \
 | 
			
		||||
    | uniq \
 | 
			
		||||
    | sed -nEe 's/^(vim-patch:([0-9]+\.[^ ]+|[0-9a-z]{7,7})).*/\1/p'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -669,7 +669,7 @@ show_vimpatches() {
 | 
			
		||||
    fi
 | 
			
		||||
  done < <(list_vim_commits "${git_log_args[@]}")
 | 
			
		||||
  set -u
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Prints a human-formatted list of Vim commits, with instructional messages.
 | 
			
		||||
# Passes "$@" onto list_missing_vimpatches (args for git-log).
 | 
			
		||||
@@ -763,7 +763,7 @@ review_commit() {
 | 
			
		||||
  printf ' - %s\n' "${missing_unique[@]}"
 | 
			
		||||
  return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
review_commit() {
 | 
			
		||||
  local nvim_commit_url="${1}"
 | 
			
		||||
  local nvim_patch_url="${nvim_commit_url}.patch"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user