Skip to content

Commit

Permalink
parse-remote and ls-remote clean-up.
Browse files Browse the repository at this point in the history
There is no reason to use git-sh-setup from git-ls-remote.
git-parse-remote can help the caller to use .git/remotes
shortcut if it is run inside a git repository, but can still be
useful outside a git repositoryas long as the caller does not
use any shortcut.  Use "git-rev-parse --git-dir" to figure out
where the GIT_DIR is, instead of using git-sh-setup.

This also makes "git-ls-remote origin" to work from inside a
subdirectory of a git managed repository as a side effect.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Nov 25, 2005
1 parent f678dd1 commit e8cc80d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion git-ls-remote.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/sh
#
. git-sh-setup

usage () {
echo >&2 "usage: $0 [--heads] [--tags] <repository> <refs>..."
Expand Down
4 changes: 3 additions & 1 deletion git-parse-remote.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh

. git-sh-setup
# git-ls-remote could be called from outside a git managed repository;
# this would fail in that case and would issue an error message.
GIT_DIR=$(git-rev-parse --git-dir 2>/dev/null) || :;

get_data_source () {
case "$1" in
Expand Down

0 comments on commit e8cc80d

Please sign in to comment.