git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* testing for cloned repository
@ 2006-07-27 13:46 Robert White
  2006-07-27 14:10 ` Johannes Schindelin
  0 siblings, 1 reply; 2+ messages in thread
From: Robert White @ 2006-07-27 13:46 UTC (permalink / raw)
  To: git

I am using:
if [ -f ".git/remotes/origin" ]; then
	# this repository is a clone
fi
in a bash script to test if a repository was cloned and then do  
appropriate pulls and pushes which fit my situation.
Is this the proper way to test this or should I be using something  
different?

Thanks in advance for your help and for providing git.  I have been  
using it on my Linux and MacOSX machines without any problems.

Bob White

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: testing for cloned repository
  2006-07-27 13:46 testing for cloned repository Robert White
@ 2006-07-27 14:10 ` Johannes Schindelin
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2006-07-27 14:10 UTC (permalink / raw)
  To: Robert White; +Cc: git

Hi,

On Thu, 27 Jul 2006, Robert White wrote:

> if [ -f ".git/remotes/origin" ]; then
> 	# this repository is a clone
> fi
> in a bash script to test if a repository was cloned and then do appropriate
> pulls and pushes which fit my situation.

I think it would be better to do this:

-- snip --
. git-parse-remote
test "$(get_remote_url origin)" != origin && echo "is cloned"
-- snap --

There are 3 different ways to store remote information ATM, and this 
method gets them all (even if, at a certain distant time in the future, 
the default should be changed).

Hth,
Dscho

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-27 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-27 13:46 testing for cloned repository Robert White
2006-07-27 14:10 ` Johannes Schindelin

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).