git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Proposed script: cg-info
@ 2005-07-05  5:46 Pavel Roskin
  2005-07-05  9:22 ` Petr Baudis
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Roskin @ 2005-07-05  5:46 UTC (permalink / raw)
  To: git, Petr Baudis

Hello!

It would be useful to have a script to display current status of the
repository - branches, current branch and merge status.  Maybe I'm
missing something, but I don't see such script.

I wrote a script that would do that.  I'm still not fully familiar with
the concepts of cogito, so maybe wrong terms are used in the script.  I
just want to offer this scripts as a base for further work.

cg-info sounds very pretentious, so maybe the script should be renamed
to cg-heads-ls or cg-admin-status or something like that.

Signed-off-by: Pavel Roskin <proski@gnu.org>

#!/usr/bin/env bash
#
# Show status of the GIT repository.
# Copyright (c) Pavel Roskin 2005
#
# The output includes the list of branches and merge status.
# Current branch is marked by ">"

USAGE="cg-info"

. ${COGITO_LIB}cg-Xlib

mkdir -p $_git/refs/heads
[ "$(find $_git/refs/heads -follow -type f)" ] \
       || die "List of heads is empty."

branch=
headlink=$(readlink $_git/HEAD)
if [ "$headlink" ]; then
	branch=$(basename "$headlink")
else
	headsha1=$(cat $_git/HEAD)
	echo "HEAD: $headsha1"
fi

echo "Heads:"

for head in $_git/refs/heads/*; do
	headsha1=$(cat $head)
	headbase=$(basename $head)
	if [ "$headbase" = "$branch" ]; then
		echo ">$headbase $headsha1"
	else
		echo " $headbase $headsha1"
	fi
done

if [ -s "$_git/blocked" ]; then
	tmp=$(cat "$_git/blocked")
	echo "Blocked: $tmp"
fi

if [ -s "$_git/merging" ]; then
	tmp=$(cat "$_git/merging")
	echo "Merging: $tmp"
fi

if [ -s "$_git/merging-sym" ]; then
	tmp=$(cat "$_git/merging-sym")
	echo "Merging-sym: $tmp"
fi

if [ -s "$_git/merge-base" ]; then
	tmp=$(cat "$_git/merge-base")
	echo "Merge-base: $tmp"
fi


-- 
Regards,
Pavel Roskin

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

* Re: Proposed script: cg-info
  2005-07-05  5:46 Proposed script: cg-info Pavel Roskin
@ 2005-07-05  9:22 ` Petr Baudis
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Baudis @ 2005-07-05  9:22 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: git

Dear diary, on Tue, Jul 05, 2005 at 07:46:12AM CEST, I got a letter
where Pavel Roskin <proski@gnu.org> told me that...
> Hello!

Hello,

> It would be useful to have a script to display current status of the
> repository - branches, current branch and merge status.  Maybe I'm
> missing something, but I don't see such script.
> 
> I wrote a script that would do that.  I'm still not fully familiar with
> the concepts of cogito, so maybe wrong terms are used in the script.  I
> just want to offer this scripts as a base for further work.
> 
> cg-info sounds very pretentious, so maybe the script should be renamed
> to cg-heads-ls or cg-admin-status or something like that.
> 
> Signed-off-by: Pavel Roskin <proski@gnu.org>

thanks. I've somewhat cleaned it up and added some more information to
show, and committed it.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
<Espy> be careful, some twit might quote you out of context..

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

end of thread, other threads:[~2005-07-05  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-05  5:46 Proposed script: cg-info Pavel Roskin
2005-07-05  9:22 ` Petr Baudis

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