Git development
 help / color / mirror / Atom feed
From: Petr Baudis <pasky@ucw.cz>
To: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Cc: git@vger.kernel.org
Subject: Re: Slight enhancement of GIT wrapper
Date: Thu, 14 Apr 2005 00:55:10 +0200	[thread overview]
Message-ID: <20050413225509.GL25711@pasky.ji.cz> (raw)
In-Reply-To: <200504132249.16848.pisa@cmp.felk.cvut.cz>

Dear diary, on Wed, Apr 13, 2005 at 10:49:16PM CEST, I got a letter
where Pavel Pisa <pisa@cmp.felk.cvut.cz> told me that...
> Ahoj Petre,

Hi,

cc'ing git@vger.kernel.org so that we hopefully get less of duplicated
work (and maybe even some more insights).

> Index: commit-id
> ===================================================================
> Index: git
> ===================================================================
> --- 6c355da7a316f50742eeffa49405a15e75526012/git  (mode:100755 sha1:f766a87adff6e17d24cd97417d7303f2cdab6f3c)
> +++ 85f2d458ffebf52569e777af222accc1268afdf9/git  (mode:100755 sha1:c179a65c3955e39bda18dc8a314b061bc0fb5de7)
> @@ -9,6 +9,7 @@
>  # This command mostly only multiplexes to the individual script based
>  # on the first argument.
>  
> +
>  error () {
>  	echo git: $@ >&2
>  }
> @@ -17,6 +18,25 @@
>  	exit 1
>  }
>  
> +cwd="`pwd 2> /dev/null`"

Please use $() instead of ``.

Why do you silence stderr?

> +
> +if [ -h "$0" ]; then
> +  GIT_DIR=`ls -l "$0" | sed 's/^.*-> *\(.*\) *$/\1/'`

Well, I don't like this much, but I'm not sure how to do better.

> +  GIT_DIR=`dirname "$GIT_DIR"`
> +else
> +  GIT_DIR=`dirname "$0"`
> +fi

We use tabs for indentation.

> +cd "$GIT_DIR"
> +GIT_DIR="`pwd 2> /dev/null`"

Why do you silence stderr?

> +cd "$cwd" 2> /dev/null
> +if [ $? -gt 0 ] ; then
> +  die "Cannot return back to the CWD $cwd"
> +fi

I'd personally just cd "$cwd" || exit 1

> +
> +export PATH=$GIT_DIR:$PATH

You should add $GIT_DIR to $PATH only when it is not there already. This
way you can still override some of the git tools by stuffing your
overrides to $PATH.

> +
> +#echo GIT_DIR=$GIT_DIR
> +#echo PATH=$PATH

?

>  
>  help () {
>  	cat <<__END__

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

       reply	other threads:[~2005-04-13 22:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200504132249.16848.pisa@cmp.felk.cvut.cz>
2005-04-13 22:55 ` Petr Baudis [this message]
2005-04-13 23:07   ` Slight enhancement of GIT wrapper Johannes Schindelin
2005-04-13 23:10   ` Johannes Schindelin
     [not found] ` <200505241235.02597.pisa@cmp.felk.cvut.cz>
     [not found]   ` <20050524111333.GA11223@pasky.ji.cz>
2005-05-27 16:24     ` GIT and COGITO individual scripts hidding from PATH Pavel Pisa
2005-05-27 16:29       ` Pavel Pisa

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=20050413225509.GL25711@pasky.ji.cz \
    --to=pasky@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=pisa@cmp.felk.cvut.cz \
    /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