threads / patch / 71

patchAdd lsremote command.

Subject: [PATCH] Add lsremote command.

## tl;dr

3 messages between Apr 17, 2005 and Apr 17, 2005. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Steven Cole· Apr 17, 2005, 05:36 UTC · lore

This is a fairly trivial addition, but if users are adding remote repositories with git addremote, then those users should be able to list out the remote list without having to know the details of where the remotes file is kept.

Steven
Adds lsremote command to list remotes.
Signed-Off-By: Steven Cole <elenstev@mesatop.com>
-------------

diff -urN git-pasky-orig/git git-pasky/git --- git-pasky-orig/git 2005-04-16 22:47:22.000000000 -0600 +++ git-pasky/git 2005-04-16 22:49:14.000000000 -0600

Show changes to diff +9 −0
@@ -41,6 +41,7 @@
 	log
 	ls		[TREE_ID]
 	lsobj		[OBJTYPE]
+	lsremote
 	merge		-b BASE_ID FROM_ID
 	pull		[RNAME]
 	rm		FILE...
@@ -105,6 +106,7 @@
 "log")        gitlog.sh "$@";;
 "ls")         gitls.sh "$@";;
 "lsobj")      gitlsobj.sh "$@";;
+"lsremote")   gitlsremote.sh "$@";;
 "merge")      gitmerge.sh "$@";;
 "pull")       gitpull.sh "$@";;
 "rm")         gitrm.sh "$@";;
diff -urN git-pasky-orig/gitlsremote.sh git-pasky/gitlsremote.sh
--- git-pasky-orig/gitlsremote.sh	1969-12-31 17:00:00.000000000 -0700
+++ git-pasky/gitlsremote.sh	2005-04-16 22:58:15.000000000 -0600
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# ls remotes in GIT repository
+#
+[ -e .git/remotes ] && cat .git/remotes && exit 1
+
+echo 'List of remotes is empty. See git addremote.'
Petr Baudis· Apr 17, 2005, 14:03 UTC · re: Steven Cole · lore

Re: Add lsremote command.

Dear diary, on Sun, Apr 17, 2005 at 07:36:51AM CEST, I got a letter where Steven Cole <elenstev@mesatop.com> told me that...

> This is a fairly trivial addition, but if users are adding remote repositories
> with git addremote, then those users should be able to list out the remote
> list without having to know the details of where the remotes file is kept.

Could you please send your patches inline? (Either in the body or with correct content-disposition header.)

You got the return values other way around and you are missing a copyright notice at the top; you should also mention that you take no parameters.

Please use -s instead of -e, since it is more appropriate in this case. Also, you should report the "no remotes" message to stderr. And always exit when you found that .git/remotes exists, not only if cat succeeds.

Kind regards,
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Steven Cole· Apr 17, 2005, 22:42 UTC · re: Petr Baudis · lore

Re: Add lsremote command.

On Sunday 17 April 2005 08:03 am, Petr Baudis wrote:
Show 19 quoted lines
> Dear diary, on Sun, Apr 17, 2005 at 07:36:51AM CEST, I got a letter
> where Steven Cole <elenstev@mesatop.com> told me that...
> > This is a fairly trivial addition, but if users are adding remote repositories
> > with git addremote, then those users should be able to list out the remote
> > list without having to know the details of where the remotes file is kept.
> 
> Could you please send your patches inline? (Either in the body or with
> correct content-disposition header.)
> 
> You got the return values other way around and you are missing a
> copyright notice at the top; you should also mention that you take no
> parameters.
> 
> Please use -s instead of -e, since it is more appropriate in this case.
> Also, you should report the "no remotes" message to stderr. And always
> exit when you found that .git/remotes exists, not only if cat succeeds.
> 
> Kind regards,
> 

Thanks for the fixes. Here's a better version. Steven

 This is a fairly trivial addition, but if users are adding remote repositories
 with git addremote, then those users should be able to list out the remote
 list without having to know the details of where the remotes file is kept.
Signed-off-by: Steven Cole <elenstev@mesatop.com>

diff -urN git-pasky.orig/git git-pasky/git --- git-pasky.orig/git 2005-04-17 15:02:37.000000000 -0600 +++ git-pasky/git 2005-04-17 15:04:23.000000000 -0600

Show changes to diff +13 −0
@@ -41,6 +41,7 @@
 	log
 	ls		[TREE_ID]
 	lsobj		[OBJTYPE]
+	lsremote
 	merge		-b BASE_ID FROM_ID
 	pull		[RNAME]
 	rm		FILE...
@@ -105,6 +106,7 @@
 "log")        gitlog.sh "$@";;
 "ls")         gitls.sh "$@";;
 "lsobj")      gitlsobj.sh "$@";;
+"lsremote")   gitlsremote.sh "$@";;
 "merge")      gitmerge.sh "$@";;
 "pull")       gitpull.sh "$@";;
 "rm")         gitrm.sh "$@";;
diff -urN git-pasky.orig/gitlsremote.sh git-pasky/gitlsremote.sh
--- git-pasky.orig/gitlsremote.sh	1969-12-31 17:00:00.000000000 -0700
+++ git-pasky/gitlsremote.sh	2005-04-17 16:20:48.000000000 -0600
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Lists remote GIT repositories
+# Copyright (c) Steven Cole 2005
+#
+# Takes no parameters
+#
+[ -s .git/remotes ] && cat .git/remotes
+[ -s .git/remotes ] && exit
+
+echo "List of remotes is empty. See git addremote." >&2

← back to recent threads