git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Drop some dashes from built-in invocations in scripts

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 5, 2017, 22:41 UTC
Message-ID
<xmqqlgmxskm6.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170805064905.5948-1-mforney@mforney.org>
Michael Forney <mforney@mforney.org> writes:
Show 8 quoted lines
> This way, they still work even if the built-in symlinks aren't
> installed.
>
> Signed-off-by: Michael Forney <mforney@mforney.org>
> ---
> It looks like there was an effort to do this a number of years ago (through
> `make remove-dashes`). These are just a few I noticed were still left in the
> .sh scripts.
Thanks for working on this.  

Have you made sure that all of these scripts, before calling 'git-foo' in the current code, update their PATH so that these found in the bog standard place (i.e. GIT_EXEC_PATH)?

The reason I ask is because we can rest assured these changes will be a no-regression improvement if you did so. I do not offhand think of a reason why these scripts wouldn't be doing so, but it never hurts to make sure.

Show 99 quoted lines
>
>  git-merge-octopus.sh  | 2 +-
>  git-merge-one-file.sh | 8 ++++----
>  git-merge-resolve.sh  | 2 +-
>  git-stash.sh          | 2 +-
>  git-submodule.sh      | 6 +++---
>  5 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/git-merge-octopus.sh b/git-merge-octopus.sh
> index bcf0d92ec..6c390d6c2 100755
> --- a/git-merge-octopus.sh
> +++ b/git-merge-octopus.sh
> @@ -100,7 +100,7 @@ do
>  	if test $? -ne 0
>  	then
>  		gettextln "Simple merge did not work, trying automatic merge."
> -		git-merge-index -o git-merge-one-file -a ||
> +		git merge-index -o git-merge-one-file -a ||
>  		OCTOPUS_FAILURE=1
>  		next=$(git write-tree 2>/dev/null)
>  	fi
> diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
> index 424b034e3..9879c5939 100755
> --- a/git-merge-one-file.sh
> +++ b/git-merge-one-file.sh
> @@ -115,16 +115,16 @@ case "${1:-.}${2:-.}${3:-.}" in
>  		;;
>  	esac
>  
> -	src1=$(git-unpack-file $2)
> -	src2=$(git-unpack-file $3)
> +	src1=$(git unpack-file $2)
> +	src2=$(git unpack-file $3)
>  	case "$1" in
>  	'')
>  		echo "Added $4 in both, but differently."
> -		orig=$(git-unpack-file e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
> +		orig=$(git unpack-file e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
>  		;;
>  	*)
>  		echo "Auto-merging $4"
> -		orig=$(git-unpack-file $1)
> +		orig=$(git unpack-file $1)
>  		;;
>  	esac
>  
> diff --git a/git-merge-resolve.sh b/git-merge-resolve.sh
> index c9da747fc..343fe7bcc 100755
> --- a/git-merge-resolve.sh
> +++ b/git-merge-resolve.sh
> @@ -45,7 +45,7 @@ then
>  	exit 0
>  else
>  	echo "Simple merge failed, trying Automatic merge."
> -	if git-merge-index -o git-merge-one-file -a
> +	if git merge-index -o git-merge-one-file -a
>  	then
>  		exit 0
>  	else
> diff --git a/git-stash.sh b/git-stash.sh
> index 9b6c2da7b..9aa09c3a3 100755
> --- a/git-stash.sh
> +++ b/git-stash.sh
> @@ -573,7 +573,7 @@ apply_stash () {
>  
>  	if test -n "$u_tree"
>  	then
> -		GIT_INDEX_FILE="$TMPindex" git-read-tree "$u_tree" &&
> +		GIT_INDEX_FILE="$TMPindex" git read-tree "$u_tree" &&
>  		GIT_INDEX_FILE="$TMPindex" git checkout-index --all &&
>  		rm -f "$TMPindex" ||
>  		die "$(gettext "Could not restore untracked files from stash entry")"
> diff --git a/git-submodule.sh b/git-submodule.sh
> index e131760ee..ffa2d6648 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -864,7 +864,7 @@ cmd_summary() {
>  				test $status != A && test $ignore_config = all && continue
>  			fi
>  			# Also show added or modified modules which are checked out
> -			GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
> +			GIT_DIR="$sm_path/.git" git rev-parse --git-dir >/dev/null 2>&1 &&
>  			printf '%s\n' "$sm_path"
>  		done
>  	)
> @@ -898,11 +898,11 @@ cmd_summary() {
>  		missing_dst=
>  
>  		test $mod_src = 160000 &&
> -		! GIT_DIR="$name/.git" git-rev-parse -q --verify $sha1_src^0 >/dev/null &&
> +		! GIT_DIR="$name/.git" git rev-parse -q --verify $sha1_src^0 >/dev/null &&
>  		missing_src=t
>  
>  		test $mod_dst = 160000 &&
> -		! GIT_DIR="$name/.git" git-rev-parse -q --verify $sha1_dst^0 >/dev/null &&
> +		! GIT_DIR="$name/.git" git rev-parse -q --verify $sha1_dst^0 >/dev/null &&
>  		missing_dst=t
>  
>  		display_name=$(git submodule--helper relative-path "$name" "$wt_prefix")
Previous: Johannes SchindelinNext: Michael Forney
Message 3 of 16 in “Drop some dashes from built-in invocations in scripts”
  1. Drop some dashes from built-in invocations in scriptsMichael Forney, Aug 5, 2017
  2. Johannes SchindelinAug 5, 2017
  3. Junio C HamanoAug 5, 2017
  4. Michael ForneyAug 5, 2017
  5. Junio C HamanoAug 5, 2017
  6. Michael ForneyAug 6, 2017
  7. Junio C HamanoAug 7, 2017
  8. Johannes SchindelinAug 5, 2017
  9. Junio C HamanoAug 7, 2017
  10. Junio C HamanoAug 7, 2017
  11. Michael ForneyAug 7, 2017
  12. Junio C HamanoAug 7, 2017
  13. Johannes SchindelinAug 7, 2017
  14. Junio C HamanoAug 7, 2017
  15. Johannes SchindelinAug 7, 2017
  16. Junio C HamanoAug 7, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.