git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars Hjemli <hjemli@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH 1/5] Simplify setup of $GIT_DIR in git-sh-setup.sh
Date: Mon, 18 Feb 2008 11:44:19 +0100	[thread overview]
Message-ID: <1203331463-13857-2-git-send-email-hjemli@gmail.com> (raw)
In-Reply-To: <1203331463-13857-1-git-send-email-hjemli@gmail.com>

Using 'git rev-parse --git-dir' makes the code shorter and more future-
proof.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 git-sh-setup.sh |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index f388275..a44b1c7 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -127,20 +127,14 @@ get_author_ident_from_commit () {
 # if we require to be in a git repository.
 if test -z "$NONGIT_OK"
 then
+	GIT_DIR=$(git rev-parse --git-dir) || exit
 	if [ -z "$SUBDIRECTORY_OK" ]
 	then
-		: ${GIT_DIR=.git}
 		test -z "$(git rev-parse --show-cdup)" || {
 			exit=$?
 			echo >&2 "You need to run this command from the toplevel of the working tree."
 			exit $exit
 		}
-	else
-		GIT_DIR=$(git rev-parse --git-dir) || {
-		    exit=$?
-		    echo >&2 "Failed to find a valid git directory."
-		    exit $exit
-		}
 	fi
 	test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || {
 		echo >&2 "Unable to determine absolute path of git directory"
-- 
1.5.4.1.188.g3ea1f5

  reply	other threads:[~2008-02-18 10:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-18 10:44 [PATCH 0/5 v2] Introduce the .gitfile Lars Hjemli
2008-02-18 10:44 ` Lars Hjemli [this message]
2008-02-18 10:44   ` [PATCH 2/5] Add platform-independent .git "symlink" Lars Hjemli
2008-02-18 10:44     ` [PATCH 3/5] Teach resolve_gitlink_ref() about the .git file Lars Hjemli
2008-02-18 10:44       ` [PATCH 4/5] git-submodule: prepare for the .git-file Lars Hjemli
2008-02-18 10:44         ` [PATCH 5/5] Teach GIT-VERSION-GEN about the .git file Lars Hjemli
2008-02-18 12:34     ` [PATCH 2/5] Add platform-independent .git "symlink" Johannes Schindelin
2008-02-18 13:18       ` Lars Hjemli
2008-02-18 13:34         ` Jakub Narebski
2008-02-18 13:35         ` Johannes Schindelin
2008-02-18 14:04           ` Lars Hjemli
2008-02-18 14:44           ` Lars Hjemli
2008-02-18 14:54             ` Johannes Schindelin
2008-02-18 12:17 ` [PATCH 0/5 v2] Introduce the .gitfile Johannes Schindelin
2008-02-18 12:56   ` Lars Hjemli
2008-02-18 13:31     ` Johannes Schindelin
2008-02-18 14:01       ` Lars Hjemli
2008-02-18 14:12         ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1203331463-13857-2-git-send-email-hjemli@gmail.com \
    --to=hjemli@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).