Skip to contentSkip to conversation

completion: remove use of dashed git commands

PATCH In review Dan McGee 5 participants 11 messages Jun 15, 2016

lore
Share & tools
lore

Dan McGee

author
#0 lore raw

PATCH 1/1 completion: remove use of dashed git commands

---
 contrib/completion/git-completion.bash |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
contrib/completion/git-completion.bash +4 -4
index 4d81963..3f78630 100755
@@ -152,7 +152,7 @@ __git_heads ()
 		done
 		return
 	fi
-	for i in $(git-ls-remote "$1" 2>/dev/null); do
+	for i in $(git ls-remote "$1" 2>/dev/null); do
 		case "$is_hash,$i" in
 		y,*) is_hash=n ;;
 		n,*^{}) is_hash=y ;;
@@ -173,7 +173,7 @@ __git_tags ()
 		done
 		return
 	fi
-	for i in $(git-ls-remote "$1" 2>/dev/null); do
+	for i in $(git ls-remote "$1" 2>/dev/null); do
 		case "$is_hash,$i" in
 		y,*) is_hash=n ;;
 		n,*^{}) is_hash=y ;;
@@ -200,7 +200,7 @@ __git_refs ()
 		done
 		return
 	fi
-	for i in $(git-ls-remote "$dir" 2>/dev/null); do
+	for i in $(git ls-remote "$dir" 2>/dev/null); do
 		case "$is_hash,$i" in
 		y,*) is_hash=n ;;
 		n,*^{}) is_hash=y ;;
@@ -223,7 +223,7 @@ __git_refs2 ()
 __git_refs_remotes ()
 {
 	local cmd i is_hash=y
-	for i in $(git-ls-remote "$1" 2>/dev/null); do
+	for i in $(git ls-remote "$1" 2>/dev/null); do
 		case "$is_hash,$i" in
 		n,refs/heads/*)
 			is_hash=y
Signature · 1 line
1.5.5
author
#1 lore raw

PATCH 1/1 completion: allow 'git remote' subcommand completion

After typing 'git prune ', the subcommand options were not shown. Fix it.

---
 contrib/completion/git-completion.bash |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
contrib/completion/git-completion.bash +1 -0
index 3f78630..6012047 100755
@@ -1052,6 +1052,7 @@ _git_remote ()
 	local subcommands="add rm show prune update"
 	local subcommand="$(__git_find_subcommand "$subcommands")"
 	if [ -z "$subcommand" ]; then
+		__gitcomp "$subcommands"
 		return
 	fi
 
Signature · 1 line
1.5.5
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH] completion: allow 'git remote' subcommand completion

Quoted 1 line · Dan McGee

After typing 'git prune ', the subcommand options were not shown. Fix it.

That's not really what this change does. It fixes the subcommands for 'git remote ', which were broken without this __gitcomp call in this location.

but I'd like to see a more accurate commit message for this fix.

Quoted 20 lines
---
 contrib/completion/git-completion.bash |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
contrib/completion/git-completion.bash +1 -0
index 3f78630..6012047 100755
@@ -1052,6 +1052,7 @@ _git_remote ()
 	local subcommands="add rm show prune update"
 	local subcommand="$(__git_find_subcommand "$subcommands")"
 	if [ -z "$subcommand" ]; then
+		__gitcomp "$subcommands"
 		return
 	fi
 
Signature · 1 line
1.5.5
Signature · 1 line
Shawn.
author
#3 lore raw

PATCH 1/1 completion: allow 'git remote' subcommand completion

After typing 'git remote ', the subcommand options were not shown. Fix it by adding the missing __gitcomp call.

---

Resubmit per Shawn's comments- duh. I was just thinking backwards since remote has a prune subcommand.

 contrib/completion/git-completion.bash |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
contrib/completion/git-completion.bash +1 -0
index 3f78630..6012047 100755
@@ -1052,6 +1052,7 @@ _git_remote ()
 	local subcommands="add rm show prune update"
 	local subcommand="$(__git_find_subcommand "$subcommands")"
 	if [ -z "$subcommand" ]; then
+		__gitcomp "$subcommands"
 		return
 	fi
 
Signature · 1 line
1.5.5
Acked-by on v1 1/1
#4 lore raw
In reply to Dan McGee
Quoted 4 lines · Dan McGee
---
 contrib/completion/git-completion.bash |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Despite Dscho's remarks, this is a change that is harmless and should be happening before we officially remove the dashed forms from the user's path.

Quoted 43 lines
contrib/completion/git-completion.bash +4 -4
index 4d81963..3f78630 100755
@@ -152,7 +152,7 @@ __git_heads ()
 		done
 		return
 	fi
-	for i in $(git-ls-remote "$1" 2>/dev/null); do
+	for i in $(git ls-remote "$1" 2>/dev/null); do
 		case "$is_hash,$i" in
 		y,*) is_hash=n ;;
 		n,*^{}) is_hash=y ;;
@@ -173,7 +173,7 @@ __git_tags ()
 		done
 		return
 	fi
-	for i in $(git-ls-remote "$1" 2>/dev/null); do
+	for i in $(git ls-remote "$1" 2>/dev/null); do
 		case "$is_hash,$i" in
 		y,*) is_hash=n ;;
 		n,*^{}) is_hash=y ;;
@@ -200,7 +200,7 @@ __git_refs ()
 		done
 		return
 	fi
-	for i in $(git-ls-remote "$dir" 2>/dev/null); do
+	for i in $(git ls-remote "$dir" 2>/dev/null); do
 		case "$is_hash,$i" in
 		y,*) is_hash=n ;;
 		n,*^{}) is_hash=y ;;
@@ -223,7 +223,7 @@ __git_refs2 ()
 __git_refs_remotes ()
 {
 	local cmd i is_hash=y
-	for i in $(git-ls-remote "$1" 2>/dev/null); do
+	for i in $(git ls-remote "$1" 2>/dev/null); do
 		case "$is_hash,$i" in
 		n,refs/heads/*)
 			is_hash=y
Signature · 1 line
1.5.5
Signature · 1 line
Shawn.
#5 lore raw
In reply to Dan McGee

Hi,

Quoted 1 line · Dan McGee

[no commit message]

I would like to deprecate dashed form _officially_ first (as in ReleaseNotes), before doing something that could lead to quite some surprised users.

Ciao,
Dscho

author
#6 lore raw
Quoted 9 lines · Johannes Schindelin

Hi,

Quoted 1 line · Dan McGee

[no commit message]

I would like to deprecate dashed form _officially_ first (as in ReleaseNotes), before doing something that could lead to quite some surprised users.

Now you've confused me. From Documentation/RelNotes-1.5.4.txt, it seems fairly clear that dashed command forms are deprecated.

This patch was rather non-intrusive- it only updated the bash completion script to use the non-dashed forms. I'm not sure how this leads to surprised users at all.

-Dan

(Sorry for the double send, forgot the reply-all the first time. Looks like I need another Sunday cup of coffee.)

#7 lore raw

Hi,

Quoted 5 lines · Dan McGee
Quoted 2 lines · Johannes Schindelin

On Sun, 20 Apr 2008, Dan McGee wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

[no commit message]

I would like to deprecate dashed form _officially_ first (as in ReleaseNotes), before doing something that could lead to quite some surprised users.

Now you've confused me. From Documentation/RelNotes-1.5.4.txt, it seems fairly clear that dashed command forms are deprecated.

Oh, I must have missed that. Nevertheless, I think it should be synchronised with when the dashed commands vanish from the default installation.

Ciao,
Dscho

author
#8 lore raw
Quoted 16 lines · Johannes Schindelin

Hi,

Quoted 12 lines · Dan McGee
Quoted 7 lines · Johannes Schindelin
Quoted 1 line · Dan McGee

[no commit message]

I would like to deprecate dashed form _officially_ first (as in ReleaseNotes), before doing something that could lead to quite some surprised users.

Quoted 8 lines
Quoted 2 lines

Now you've confused me. From Documentation/RelNotes-1.5.4.txt, it seems fairly clear that dashed command forms are deprecated.

Oh, I must have missed that. Nevertheless, I think it should be synchronised with when the dashed commands vanish from the default installation.

From the RelNotes:

Users are strongly encouraged to adjust their habits and scripts now to prepare for this change.

It seems like setting a good example would be prudent, so I attempted to do that here. If adding a commit message referencing the documentation would have helped, then I'm sorry for that, but I've submitted patches like this in the past (22fa97) without near as much hassle as I'm getting for this small change.

-Dan

#9 lore raw
In reply to Johannes Schindelin
Quoted 3 lines · Johannes Schindelin

Oh, I must have missed that. Nevertheless, I think it should be synchronised with when the dashed commands vanish from the default installation.

I think you missed the point of the patch.

It removes _uses_ of dashed-form in the completion script, but doesn't remove completion for dashed forms. That could be made clear in the commit message to avoid confusion.

Signature · 1 line
Matthieu
#10 lore raw
In reply to Johannes Schindelin
Quoted 9 lines · Johannes Schindelin

Hi,

Quoted 1 line · Dan McGee

[no commit message]

I would like to deprecate dashed form _officially_ first (as in ReleaseNotes), before doing something that could lead to quite some surprised users.

I'd share your distaste against an empty log message to justify the changes, but I do not see where those "quite some surprised users" would come from.

At least people know "git foo" form is and has been supported, so if somebody changes "git-ls-files" to "git ls-files", nobody would go "gee, I did not know I can write it without dash" these days...