Skip to content

Commit 871f4c9

Browse files
committed
git-gui: Display all authors of git-gui.
Now that git-gui has been released to the public as part of Git 1.5.0 I am starting to see some work from other people beyond myself and Paul. Consequently the copyright for git-gui is not strictly the two of us anymore, and these others deserve to have some credit given to them. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
1 parent ee40599 commit 871f4c9

File tree

4 files changed

+136
-10
lines changed

4 files changed

+136
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
CREDITS-FILE
12
GIT-VERSION-FILE
23
git-citool
34
git-gui

CREDITS-GEN

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/sh
2+
3+
CF=CREDITS-FILE
4+
tip=
5+
6+
tree_search ()
7+
{
8+
head=$1
9+
tree=$2
10+
for p in $(git rev-list --parents --max-count=1 $head 2>/dev/null)
11+
do
12+
test $tree = $(git rev-parse $p^{tree} 2>/dev/null) &&
13+
vn=$(git describe --abbrev=4 $p 2>/dev/null) &&
14+
case "$vn" in
15+
gitgui-[0-9]*) echo $p; break;;
16+
esac
17+
done
18+
}
19+
20+
generate_credits ()
21+
{
22+
tip=$1 &&
23+
rm -f $CF &&
24+
git shortlog -n -s $tip | sed 's/: .*$//' >$CF || exit
25+
}
26+
27+
# Always use the tarball credits file if found, just
28+
# in case we are somehow contained in a larger git
29+
# repository that doesn't actually track our state.
30+
# (At least one package manager is doing this.)
31+
#
32+
# We may be a subproject, so try looking for the merge
33+
# commit that supplied this directory content if we are
34+
# not at the toplevel. We probably will always be the
35+
# second parent in the commit, but we shouldn't rely on
36+
# that fact.
37+
#
38+
39+
if test -f credits
40+
then
41+
rm -f $CF &&
42+
cp credits $CF || exit
43+
elif prefix="$(git rev-parse --show-prefix 2>/dev/null)" &&
44+
test -n "$prefix" &&
45+
head=$(git rev-list --max-count=1 HEAD -- . 2>/dev/null) &&
46+
tree=$(git rev-parse --verify "HEAD:$prefix" 2>/dev/null) &&
47+
tip=$(tree_search $head $tree) &&
48+
test -n "$tip"
49+
then
50+
generate_credits $tip || exit
51+
elif tip="$(git rev-parse --verify HEAD 2>/dev/null)" &&
52+
test -n "$tip"
53+
then
54+
generate_credits $tip || exit
55+
else
56+
echo "error: Cannot locate authorship information." >&2
57+
exit 1
58+
fi

Makefile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
44
@$(SHELL_PATH) ./GIT-VERSION-GEN
55
-include GIT-VERSION-FILE
66

7-
SCRIPT_SH = git-gui.sh
87
GITGUI_BUILT_INS = git-citool
9-
ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
8+
ALL_PROGRAMS = git-gui $(GITGUI_BUILT_INS)
109

1110
ifndef SHELL_PATH
1211
SHELL_PATH = /bin/sh
@@ -24,33 +23,39 @@ DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
2423
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
2524
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
2625

27-
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
26+
git-gui: git-gui.sh GIT-VERSION-FILE CREDITS-FILE
2827
rm -f $@ $@+
29-
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
28+
sed -n \
29+
-e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
3030
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
31+
-e '1,/^set gitgui_credits /p' \
3132
$@.sh >$@+
33+
cat CREDITS-FILE >>$@+
34+
sed -e '1,/^set gitgui_credits /d' $@.sh >>$@+
3235
chmod +x $@+
3336
mv $@+ $@
3437

38+
CREDITS-FILE: CREDITS-GEN .FORCE-CREDITS-FILE
39+
$(SHELL_PATH) ./CREDITS-GEN
40+
3541
$(GITGUI_BUILT_INS): git-gui
3642
rm -f $@ && ln git-gui $@
3743

38-
# These can record GITGUI_VERSION
39-
$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE
40-
4144
all:: $(ALL_PROGRAMS)
4245

4346
install: all
4447
$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
4548
$(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
4649
$(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
4750

48-
dist-version:
51+
dist-version: CREDITS-FILE
4952
@mkdir -p $(TARDIR)
5053
@echo $(GITGUI_VERSION) > $(TARDIR)/version
54+
@cat CREDITS-FILE > $(TARDIR)/credits
5155

5256
clean::
53-
rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE
57+
rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE CREDITS-FILE
5458

5559
.PHONY: all install dist-version clean
5660
.PHONY: .FORCE-GIT-VERSION-FILE
61+
.PHONY: .FORCE-CREDITS-FILE

git-gui.sh

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exec wish "$0" -- "$@"
44

55
set appvers {@@GITGUI_VERSION@@}
66
set copyright {
7-
Copyright © 2006, 2007 Shawn Pearce, Paul Mackerras.
7+
Copyright © 2006, 2007 Shawn Pearce, et. al.
88

99
This program is free software; you can redistribute it and/or modify
1010
it under the terms of the GNU General Public License as published by
@@ -19,6 +19,9 @@ GNU General Public License for more details.
1919
You should have received a copy of the GNU General Public License
2020
along with this program; if not, write to the Free Software
2121
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}
22+
set gitgui_credits {
23+
Paul Mackerras
24+
}
2225

2326
######################################################################
2427
##
@@ -4477,6 +4480,61 @@ proc do_commit {} {
44774480
commit_tree
44784481
}
44794482

4483+
proc do_credits {} {
4484+
global gitgui_credits
4485+
4486+
set w .credits_dialog
4487+
4488+
toplevel $w
4489+
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
4490+
4491+
label $w.header -text {git-gui Contributors} -font font_uibold
4492+
pack $w.header -side top -fill x
4493+
4494+
frame $w.buttons
4495+
button $w.buttons.close -text {Close} \
4496+
-font font_ui \
4497+
-command [list destroy $w]
4498+
pack $w.buttons.close -side right
4499+
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
4500+
4501+
frame $w.credits
4502+
text $w.credits.t \
4503+
-background [$w.header cget -background] \
4504+
-yscrollcommand [list $w.credits.sby set] \
4505+
-width 20 \
4506+
-height 10 \
4507+
-wrap none \
4508+
-borderwidth 1 \
4509+
-relief solid \
4510+
-padx 5 -pady 5 \
4511+
-font font_ui
4512+
scrollbar $w.credits.sby -command [list $w.credits.t yview]
4513+
pack $w.credits.sby -side right -fill y
4514+
pack $w.credits.t -fill both -expand 1
4515+
pack $w.credits -side top -fill both -expand 1 -padx 5 -pady 5
4516+
4517+
label $w.desc \
4518+
-text "All portions are copyrighted by their respective authors
4519+
and are distributed under the GNU General Public License." \
4520+
-padx 5 -pady 5 \
4521+
-justify left \
4522+
-anchor w \
4523+
-borderwidth 1 \
4524+
-relief solid \
4525+
-font font_ui
4526+
pack $w.desc -side top -fill x -padx 5 -pady 5
4527+
4528+
$w.credits.t insert end "[string trim $gitgui_credits]\n"
4529+
$w.credits.t conf -state disabled
4530+
$w.credits.t see 1.0
4531+
4532+
bind $w <Visibility> "grab $w; focus $w"
4533+
bind $w <Key-Escape> [list destroy $w]
4534+
wm title $w [$w.header cget -text]
4535+
tkwait window $w
4536+
}
4537+
44804538
proc do_about {} {
44814539
global appvers copyright
44824540
global tcl_patchLevel tk_patchLevel
@@ -4493,6 +4551,10 @@ proc do_about {} {
44934551
button $w.buttons.close -text {Close} \
44944552
-font font_ui \
44954553
-command [list destroy $w]
4554+
button $w.buttons.credits -text {Contributors} \
4555+
-font font_ui \
4556+
-command do_credits
4557+
pack $w.buttons.credits -side left
44964558
pack $w.buttons.close -side right
44974559
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
44984560

0 commit comments

Comments
 (0)