Skip to content

Commit 5bac4a6

Browse files
author
Junio C Hamano
committed
Merge branch 'master' of git://repo.or.cz/git-gui into maint
* 'master' of git://repo.or.cz/git-gui: git-gui: Don't crash in citool mode on initial commit. git-gui: Remove TODO list. git-gui: Include browser in our usage message. git-gui: Change summary of git-gui. git-gui: Display all authors of git-gui. git-gui: Use mixed path for docs on Cygwin. git-gui: Correct crash when saving options in blame mode. git-gui: Expose the browser as a subcommand. git-gui: Create new branches from a tag. git-gui: Prefer version file over git-describe. git-gui: Print version on the console. git-gui: More consistently display the application name. git-gui: Permit merging tags into the current branch. git-gui: Basic version check to ensure git 1.5.0 or later is used. git-gui: Refactor 'exec git subcmd' idiom.
2 parents c750da2 + 9811937 commit 5bac4a6

File tree

6 files changed

+308
-120
lines changed

6 files changed

+308
-120
lines changed

git-gui/.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

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

git-gui/GIT-VERSION-GEN

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,25 @@ tree_search ()
2020
done
2121
}
2222

23+
# Always use the tarball version file if found, just
24+
# in case we are somehow contained in a larger git
25+
# repository that doesn't actually track our state.
26+
# (At least one package manager is doing this.)
27+
#
2328
# We may be a subproject, so try looking for the merge
2429
# commit that supplied this directory content if we are
2530
# not at the toplevel. We probably will always be the
2631
# second parent in the commit, but we shouldn't rely on
2732
# that fact.
2833
#
2934
# If we are at the toplevel or the merge assumption fails
30-
# try looking for a gitgui-* tag, or fallback onto the
31-
# distributed version file.
35+
# try looking for a gitgui-* tag.
3236

33-
if prefix="$(git rev-parse --show-prefix 2>/dev/null)"
37+
if test -f version &&
38+
VN=$(cat version)
39+
then
40+
: happy
41+
elif prefix="$(git rev-parse --show-prefix 2>/dev/null)"
3442
test -n "$prefix" &&
3543
head=$(git rev-list --max-count=1 HEAD -- . 2>/dev/null) &&
3644
tree=$(git rev-parse --verify "HEAD:$prefix" 2>/dev/null) &&
@@ -48,9 +56,6 @@ elif VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
4856
esac
4957
then
5058
VN=$(echo "$VN" | sed -e 's/^gitgui-//;s/-/./g');
51-
elif test -f version
52-
then
53-
VN=$(cat version) || VN="$DEF_VER"
5459
else
5560
VN="$DEF_VER"
5661
fi

git-gui/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/TODO

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)