+CREDITS-FILE
GIT-VERSION-FILE
git-citool
git-gui
--- /dev/null
+#!/bin/sh
+
+CF=CREDITS-FILE
+tip=
+
+tree_search ()
+{
+ head=$1
+ tree=$2
+ for p in $(git rev-list --parents --max-count=1 $head 2>/dev/null)
+ do
+ test $tree = $(git rev-parse $p^{tree} 2>/dev/null) &&
+ vn=$(git describe --abbrev=4 $p 2>/dev/null) &&
+ case "$vn" in
+ gitgui-[0-9]*) echo $p; break;;
+ esac
+ done
+}
+
+generate_credits ()
+{
+ tip=$1 &&
+ rm -f $CF &&
+ git shortlog -n -s $tip | sed 's/: .*$//' >$CF || exit
+}
+
+# Always use the tarball credits file if found, just
+# in case we are somehow contained in a larger git
+# repository that doesn't actually track our state.
+# (At least one package manager is doing this.)
+#
+# We may be a subproject, so try looking for the merge
+# commit that supplied this directory content if we are
+# not at the toplevel. We probably will always be the
+# second parent in the commit, but we shouldn't rely on
+# that fact.
+#
+
+if test -f credits
+then
+ rm -f $CF &&
+ cp credits $CF || exit
+elif prefix="$(git rev-parse --show-prefix 2>/dev/null)" &&
+ test -n "$prefix" &&
+ head=$(git rev-list --max-count=1 HEAD -- . 2>/dev/null) &&
+ tree=$(git rev-parse --verify "HEAD:$prefix" 2>/dev/null) &&
+ tip=$(tree_search $head $tree) &&
+ test -n "$tip"
+then
+ generate_credits $tip || exit
+elif tip="$(git rev-parse --verify HEAD 2>/dev/null)" &&
+ test -n "$tip"
+then
+ generate_credits $tip || exit
+else
+ echo "error: Cannot locate authorship information." >&2
+ exit 1
+fi
@$(SHELL_PATH) ./GIT-VERSION-GEN
-include GIT-VERSION-FILE
-SCRIPT_SH = git-gui.sh
GITGUI_BUILT_INS = git-citool
-ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
+ALL_PROGRAMS = git-gui $(GITGUI_BUILT_INS)
ifndef SHELL_PATH
SHELL_PATH = /bin/sh
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
-$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
+git-gui: git-gui.sh GIT-VERSION-FILE CREDITS-FILE
rm -f $@ $@+
- sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
+ sed -n \
+ -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
+ -e '1,/^set gitgui_credits /p' \
$@.sh >$@+
+ cat CREDITS-FILE >>$@+
+ sed -e '1,/^set gitgui_credits /d' $@.sh >>$@+
chmod +x $@+
mv $@+ $@
+CREDITS-FILE: CREDITS-GEN .FORCE-CREDITS-FILE
+ $(SHELL_PATH) ./CREDITS-GEN
+
$(GITGUI_BUILT_INS): git-gui
rm -f $@ && ln git-gui $@
-# These can record GITGUI_VERSION
-$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE
-
all:: $(ALL_PROGRAMS)
install: all
$(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
$(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
-dist-version:
+dist-version: CREDITS-FILE
@mkdir -p $(TARDIR)
@echo $(GITGUI_VERSION) > $(TARDIR)/version
+ @cat CREDITS-FILE > $(TARDIR)/credits
clean::
- rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE
+ rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE CREDITS-FILE
.PHONY: all install dist-version clean
.PHONY: .FORCE-GIT-VERSION-FILE
+.PHONY: .FORCE-CREDITS-FILE
set appvers {@@GITGUI_VERSION@@}
set copyright {
-Copyright © 2006, 2007 Shawn Pearce, Paul Mackerras.
+Copyright © 2006, 2007 Shawn Pearce, et. al.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}
+set gitgui_credits {
+Paul Mackerras
+}
######################################################################
##
commit_tree
}
+proc do_credits {} {
+ global gitgui_credits
+
+ set w .credits_dialog
+
+ toplevel $w
+ wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
+
+ label $w.header -text {git-gui Contributors} -font font_uibold
+ pack $w.header -side top -fill x
+
+ frame $w.buttons
+ button $w.buttons.close -text {Close} \
+ -font font_ui \
+ -command [list destroy $w]
+ pack $w.buttons.close -side right
+ pack $w.buttons -side bottom -fill x -pady 10 -padx 10
+
+ frame $w.credits
+ text $w.credits.t \
+ -background [$w.header cget -background] \
+ -yscrollcommand [list $w.credits.sby set] \
+ -width 20 \
+ -height 10 \
+ -wrap none \
+ -borderwidth 1 \
+ -relief solid \
+ -padx 5 -pady 5 \
+ -font font_ui
+ scrollbar $w.credits.sby -command [list $w.credits.t yview]
+ pack $w.credits.sby -side right -fill y
+ pack $w.credits.t -fill both -expand 1
+ pack $w.credits -side top -fill both -expand 1 -padx 5 -pady 5
+
+ label $w.desc \
+ -text "All portions are copyrighted by their respective authors
+and are distributed under the GNU General Public License." \
+ -padx 5 -pady 5 \
+ -justify left \
+ -anchor w \
+ -borderwidth 1 \
+ -relief solid \
+ -font font_ui
+ pack $w.desc -side top -fill x -padx 5 -pady 5
+
+ $w.credits.t insert end "[string trim $gitgui_credits]\n"
+ $w.credits.t conf -state disabled
+ $w.credits.t see 1.0
+
+ bind $w <Visibility> "grab $w; focus $w"
+ bind $w <Key-Escape> [list destroy $w]
+ wm title $w [$w.header cget -text]
+ tkwait window $w
+}
+
proc do_about {} {
global appvers copyright
global tcl_patchLevel tk_patchLevel
button $w.buttons.close -text {Close} \
-font font_ui \
-command [list destroy $w]
+ button $w.buttons.credits -text {Contributors} \
+ -font font_ui \
+ -command do_credits
+ pack $w.buttons.credits -side left
pack $w.buttons.close -side right
pack $w.buttons -side bottom -fill x -pady 10 -padx 10