git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [TopGit] Pretty print the help creation commands in Makefile.
@ 2008-08-06  2:43       ` Russell Steicke
  2008-08-09  0:28         ` Petr Baudis
  0 siblings, 1 reply; 8+ messages in thread
From: Russell Steicke @ 2008-08-06  2:43 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Print "[HELP] cmdname" while compiling the tg-cmdname.txt files.

Signed-off-by: Russell Steicke <russellsteicke@gmail.com>

---
 Makefile |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 238d07d..2975f29 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,9 @@ tg $(commands_out) $(hooks_out): % : %.sh
 	mv $@+ $@
 
 $(help_out): README
-	./create-help.sh `echo $@ | sed -e 's/tg-//' -e 's/\.txt//'`
+	@CMD=`echo $@ | sed -e 's/tg-//' -e 's/\.txt//'` && \
+	echo '[HELP]' $$CMD && \
+	./create-help.sh $$CMD
 
 install:: all
 	install tg "$(bindir)"
-- 
tg: (e311d15..) t/help2 (depends on: master)




-- 
Russell Steicke

-- Fortune says:
Today is the first day of the rest of your life.

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

* [TopGit PATCH] tg.sh: Runtime tg-* command check
@ 2008-08-06  7:49     ` Bert Wesarg
  2008-08-06  2:43       ` [PATCH] [TopGit] Pretty print the help creation commands in Makefile Russell Steicke
  0 siblings, 1 reply; 8+ messages in thread
From: Bert Wesarg @ 2008-08-06  7:49 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Bert Wesarg, git

Check for tg commands at runtime, not the hard coded list inside tg.sh.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>

---
 tg.sh |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/tg.sh b/tg.sh
index 03a392b..179f0de 100644
--- a/tg.sh
+++ b/tg.sh
@@ -152,8 +152,21 @@ switch_to_base()
 do_help()
 {
 	if [ -z "$1" ] ; then
+		## Build available commands list for help output
+
+		cmds=
+		sep=
+		for cmd in "@cmddir@"/tg-*; do
+			! [ -r "$cmd" ] && continue
+			# strip directory part and "tg-" prefix
+			cmd="$(basename "$cmd")"
+			cmd="${cmd#tg-}"
+			cmds="$cmds$sep$cmd"
+			sep="|"
+		done
+
 		echo "TopGit v0.1 - A different patch queue manager"
-		echo "Usage: tg (create|delete|info|patch|summary|update|help) ..."
+		echo "Usage: tg ($cmds|help) ..."
 	elif [ -f "@sharedir@/tg-$1.txt" ] ; then
 		cat "@sharedir@/tg-$1.txt"
 	else
@@ -171,6 +184,8 @@ root_dir="$(git rev-parse --show-cdup)"; root_dir="${root_dir:-.}"
 setup_ours
 setup_hook "pre-commit"
 
+[ -d "@cmddir@" ] ||
+	die "No command directory: '@cmddir@'"
 
 ## Dispatch
 
@@ -186,12 +201,13 @@ case "$cmd" in
 help)
 	do_help "$1"
 	exit 1;;
-create|delete|info|patch|summary|update)
-	. "@cmddir@"/tg-$cmd;;
 --hooks-path)
 	# Internal command
 	echo "@hooksdir@";;
 *)
-	echo "Unknown subcommand: $cmd" >&2
-	exit 1;;
+	[ -r "@cmddir@"/tg-$cmd ] || {
+		echo "Unknown subcommand: $cmd" >&2
+		exit 1
+	}
+	. "@cmddir@"/tg-$cmd;;
 esac
-- 
tg: (e311d15..) t/auto-generate-command-list-for-tg.sh (depends on: master)

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

* [TopGit PATCH] tg.sh: Check for read permissions of help files
@ 2008-08-06  8:02   ` Bert Wesarg
  2008-08-06  7:49     ` [TopGit PATCH] tg.sh: Runtime tg-* command check Bert Wesarg
  2008-08-09  7:35     ` [TopGit PATCH] tg.sh: Check for read permissions of help files Bert Wesarg
  0 siblings, 2 replies; 8+ messages in thread
From: Bert Wesarg @ 2008-08-06  8:02 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Bert Wesarg, git

We currently check only for '-f' but we need to have read permissions as well.

And help files don't need the execution bit set.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>

---
 Makefile |    2 +-
 tg.sh    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 238d07d..f9dbe6e 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ install:: all
 	install -d -m 755 "$(hooksdir)"
 	install $(hooks_out) "$(hooksdir)"
 	install -d -m 755 "$(sharedir)"
-	install $(help_out) "$(sharedir)"
+	install -m 644 $(help_out) "$(sharedir)"
 
 clean::
 	rm -f tg $(commands_out) $(hooks_out) $(help_out)
diff --git a/tg.sh b/tg.sh
index 03a392b..edac006 100644
--- a/tg.sh
+++ b/tg.sh
@@ -154,7 +154,7 @@ do_help()
 	if [ -z "$1" ] ; then
 		echo "TopGit v0.1 - A different patch queue manager"
 		echo "Usage: tg (create|delete|info|patch|summary|update|help) ..."
-	elif [ -f "@sharedir@/tg-$1.txt" ] ; then
+	elif [ -f "@sharedir@/tg-$1.txt" -a -r "@sharedir@/tg-$1.txt" ] ; then
 		cat "@sharedir@/tg-$1.txt"
 	else
 		echo "`basename $0`: no help for $1" 1>&2
-- 
tg: (e311d15..) t/check-read-permissions-of-help-files (depends on: master)

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

* [TopGit PATCH] Makefile: mkdir $(bindir)
@ 2008-08-07 16:39 ` Bert Wesarg
  2008-08-06  8:02   ` [TopGit PATCH] tg.sh: Check for read permissions of help files Bert Wesarg
  0 siblings, 1 reply; 8+ messages in thread
From: Bert Wesarg @ 2008-08-07 16:39 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Bert Wesarg, git

Mkdir $(bindir) in install target.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>

---
 Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 238d07d..2e162ce 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,7 @@ $(help_out): README
 	./create-help.sh `echo $@ | sed -e 's/tg-//' -e 's/\.txt//'`
 
 install:: all
+	install -d -m 755 "$(bindir)"
 	install tg "$(bindir)"
 	install -d -m 755 "$(cmddir)"
 	install $(commands_out) "$(cmddir)"
-- 
tg: (e311d15..) t/mkdir-bindir (depends on: master)

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

* [TopGit PATCH] tg.sh: it's info/attributes not info/gitattributes
@ 2008-08-08  6:43 Bert Wesarg
  2008-08-07 16:39 ` [TopGit PATCH] Makefile: mkdir $(bindir) Bert Wesarg
  0 siblings, 1 reply; 8+ messages in thread
From: Bert Wesarg @ 2008-08-08  6:43 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Bert Wesarg, git

The merge attribute hasn't any effect, because the wrong attribute file was
used.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>

---
 tg.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tg.sh b/tg.sh
index 03a392b..209b69e 100644
--- a/tg.sh
+++ b/tg.sh
@@ -45,11 +45,11 @@ setup_hook()
 # setup_ours (no arguments)
 setup_ours()
 {
-	if [ ! -s "$git_dir/info/gitattributes" ] || ! grep -q topmsg "$git_dir/info/gitattributes"; then
+	if [ ! -s "$git_dir/info/attributes" ] || ! grep -q topmsg "$git_dir/info/attributes"; then
 		{
 			echo -e ".topmsg\tmerge=ours"
 			echo -e ".topdeps\tmerge=ours"
-		} >>"$git_dir/info/gitattributes"
+		} >>"$git_dir/info/attributes"
 	fi
 	if ! git config merge.ours.driver >/dev/null; then
 		git config merge.ours.name '"always keep ours" merge driver'
-- 
tg: (e311d15..) t/its-info-attributes (depends on: master)

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

* Re: [PATCH] [TopGit] Pretty print the help creation commands in Makefile.
  2008-08-06  2:43       ` [PATCH] [TopGit] Pretty print the help creation commands in Makefile Russell Steicke
@ 2008-08-09  0:28         ` Petr Baudis
  0 siblings, 0 replies; 8+ messages in thread
From: Petr Baudis @ 2008-08-09  0:28 UTC (permalink / raw)
  To: Russell Steicke, Bert Wesarg; +Cc: git

  Hi,

  thanks, patches applied (after heavy dose of swearing in the general
direction of git-am and git-apply at #git - now I'm really ashamed
I've ever put "git is well-suited for patch-oriented workflows" on
any of my slides).

-- 
				Petr "Pasky" Baudis
The next generation of interesting software will be done
on the Macintosh, not the IBM PC.  -- Bill Gates

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

* Re: [TopGit PATCH] tg.sh: Check for read permissions of help files
  2008-08-06  8:02   ` [TopGit PATCH] tg.sh: Check for read permissions of help files Bert Wesarg
  2008-08-06  7:49     ` [TopGit PATCH] tg.sh: Runtime tg-* command check Bert Wesarg
@ 2008-08-09  7:35     ` Bert Wesarg
  2008-08-09  8:24       ` Petr Baudis
  1 sibling, 1 reply; 8+ messages in thread
From: Bert Wesarg @ 2008-08-09  7:35 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Bert Wesarg, git

Petr,

On Wed, Aug 6, 2008 at 10:02, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> -       elif [ -f "@sharedir@/tg-$1.txt" ] ; then
> +       elif [ -f "@sharedir@/tg-$1.txt" -a -r "@sharedir@/tg-$1.txt" ] ; then
I saw your simplified commit for this, but you should know, that '-r'
tests only for read permissions, not for a regular file, so this test
succeed also for a pipe/socket for which do you have read permissions.

Bert

>                cat "@sharedir@/tg-$1.txt"
>        else
>                echo "`basename $0`: no help for $1" 1>&2
> --
> tg: (e311d15..) t/check-read-permissions-of-help-files (depends on: master)
>

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

* Re: [TopGit PATCH] tg.sh: Check for read permissions of help files
  2008-08-09  7:35     ` [TopGit PATCH] tg.sh: Check for read permissions of help files Bert Wesarg
@ 2008-08-09  8:24       ` Petr Baudis
  0 siblings, 0 replies; 8+ messages in thread
From: Petr Baudis @ 2008-08-09  8:24 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: git

On Sat, Aug 09, 2008 at 09:35:19AM +0200, Bert Wesarg wrote:
> Petr,
> 
> On Wed, Aug 6, 2008 at 10:02, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> > -       elif [ -f "@sharedir@/tg-$1.txt" ] ; then
> > +       elif [ -f "@sharedir@/tg-$1.txt" -a -r "@sharedir@/tg-$1.txt" ] ; then
> I saw your simplified commit for this, but you should know, that '-r'
> tests only for read permissions, not for a regular file, so this test
> succeed also for a pipe/socket for which do you have read permissions.

Is that a problem? :-)

				Petr "Pasky" Baudis

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

end of thread, other threads:[~2008-08-09  8:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-08  6:43 [TopGit PATCH] tg.sh: it's info/attributes not info/gitattributes Bert Wesarg
2008-08-07 16:39 ` [TopGit PATCH] Makefile: mkdir $(bindir) Bert Wesarg
2008-08-06  8:02   ` [TopGit PATCH] tg.sh: Check for read permissions of help files Bert Wesarg
2008-08-06  7:49     ` [TopGit PATCH] tg.sh: Runtime tg-* command check Bert Wesarg
2008-08-06  2:43       ` [PATCH] [TopGit] Pretty print the help creation commands in Makefile Russell Steicke
2008-08-09  0:28         ` Petr Baudis
2008-08-09  7:35     ` [TopGit PATCH] tg.sh: Check for read permissions of help files Bert Wesarg
2008-08-09  8:24       ` 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).