From c7bafad10d294cc0b26ab6171efd89dd9b132f70 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 12 Mar 2007 13:03:47 -0400 Subject: git-gui: Allow committing empty merges Johannes Sixt noticed that git-gui would not let the user commit a merge created by `git merge -s ours` as the ours strategy does not alter the tree (that is HEAD^1^{tree} = HEAD^{tree} after the merge). The same issue arises from amending such a merge commit. We now permit an empty commit (no changed files) if we are doing a merge commit. Core Git does this with its command line based git-commit tool, so it makes sense for the GUI to do the same. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-gui.sh b/git-gui.sh index 1981827a8e..0e448007f7 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1171,7 +1171,7 @@ File [short_path $path] cannot be committed by this program. } } } - if {!$files_ready} { + if {!$files_ready && ![string match *merge $curType]} { info_popup {No changes to commit. You must add at least 1 file before you can commit. -- cgit v1.2.3 From 56a7fde16ed060bc4169cc78308f8cf10f1d92a8 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 12 Mar 2007 13:25:58 -0400 Subject: git-gui: Revert "Don't modify CREDITS-FILE if it hasn't changed." This reverts commit 92446aba47b0e0db28f7b858ea387efcca30ab44. Too many users have complained about the credits generator in git-gui, so I'm backing the entire thing out. Signed-off-by: Shawn O. Pearce --- CREDITS-GEN | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/CREDITS-GEN b/CREDITS-GEN index d1b0f86355..da2c07629e 100755 --- a/CREDITS-GEN +++ b/CREDITS-GEN @@ -20,8 +20,8 @@ tree_search () generate_credits () { tip=$1 && - rm -f "$2" && - git shortlog -n -s $tip | sed 's/: .*$//' >"$2" || exit + rm -f $CF && + git shortlog -n -s $tip | sed 's/: .*$//' >$CF || exit } # Always use the tarball credits file if found, just @@ -36,14 +36,10 @@ generate_credits () # that fact. # -credits_tmp=/var/tmp/gitgui-credits-$$ -trap 'rm -f "$credits_tmp"' 0 - -orig="$credits_tmp" - if test -f credits then - orig=credits + 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) && @@ -51,21 +47,12 @@ elif prefix="$(git rev-parse --show-prefix 2>/dev/null)" && tip=$(tree_search $head $tree) && test -n "$tip" then - generate_credits $tip "$orig" || exit + generate_credits $tip || exit elif tip="$(git rev-parse --verify HEAD 2>/dev/null)" && test -n "$tip" then - generate_credits $tip "$orig" || exit + generate_credits $tip || exit else echo "error: Cannot locate authorship information." >&2 exit 1 fi - -if test -f "$orig" && cmp -s "$orig" "$CF" -then - : noop -else - rm -f "$CF" && - cat "$orig" >"$CF" -fi - -- cgit v1.2.3 From bb616ddd159508e6c6469626d494a69e28da7032 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 12 Mar 2007 13:26:04 -0400 Subject: git-gui: Revert "git-gui: Display all authors of git-gui." This reverts commit 871f4c97ad7e021d1a0a98c80c5da77fcf70e4af. Too many users have complained about the credits generator in git-gui, so I'm backing the entire thing out. This revert will finish that series. Signed-off-by: Shawn O. Pearce --- .gitignore | 1 - CREDITS-GEN | 58 --------------------------------------------------------- Makefile | 23 +++++++++-------------- git-gui.sh | 62 ------------------------------------------------------------- 4 files changed, 9 insertions(+), 135 deletions(-) delete mode 100755 CREDITS-GEN diff --git a/.gitignore b/.gitignore index 805ca2e1c7..c714d382e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -CREDITS-FILE GIT-VERSION-FILE git-citool git-gui diff --git a/CREDITS-GEN b/CREDITS-GEN deleted file mode 100755 index da2c07629e..0000000000 --- a/CREDITS-GEN +++ /dev/null @@ -1,58 +0,0 @@ -#!/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 diff --git a/Makefile b/Makefile index e486e8f984..d74fca2874 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,9 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @$(SHELL_PATH) ./GIT-VERSION-GEN -include GIT-VERSION-FILE +SCRIPT_SH = git-gui.sh GITGUI_BUILT_INS = git-citool -ALL_PROGRAMS = git-gui $(GITGUI_BUILT_INS) +ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH)) ifndef SHELL_PATH SHELL_PATH = /bin/sh @@ -31,24 +32,20 @@ DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) gitexecdir_SQ = $(subst ','\'',$(gitexecdir)) SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) -git-gui: git-gui.sh GIT-VERSION-FILE CREDITS-FILE +$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh $(QUIET_GEN)rm -f $@ $@+ && \ - sed -n \ - -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ + sed -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 - $(QUIET_GEN)$(SHELL_PATH) ./CREDITS-GEN - $(GITGUI_BUILT_INS): git-gui $(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@ +# These can record GITGUI_VERSION +$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE + all:: $(ALL_PROGRAMS) install: all @@ -56,14 +53,12 @@ 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: CREDITS-FILE +dist-version: @mkdir -p $(TARDIR) @echo $(GITGUI_VERSION) > $(TARDIR)/version - @cat CREDITS-FILE > $(TARDIR)/credits clean:: - rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE CREDITS-FILE + rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE .PHONY: all install dist-version clean .PHONY: .FORCE-GIT-VERSION-FILE -.PHONY: .FORCE-CREDITS-FILE diff --git a/git-gui.sh b/git-gui.sh index 0e448007f7..2888864e49 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -19,9 +19,6 @@ GNU General Public License for more details. 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 -} ###################################################################### ## @@ -4492,61 +4489,6 @@ proc do_commit {} { 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 "grab $w; focus $w" - bind $w [list destroy $w] - wm title $w [$w.header cget -text] - tkwait window $w -} - proc do_about {} { global appvers copyright global tcl_patchLevel tk_patchLevel @@ -4563,10 +4505,6 @@ proc do_about {} { 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 -- cgit v1.2.3 From 756d846fea4ac4b3bf0a0aea9fbf721138cf34cc Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 12 Mar 2007 13:24:10 -0400 Subject: git-gui: Allow 'git gui version' outside of a repository I got a little surprise one day when I tried to run 'git gui version' outside of a Git repository to determine what version of git-gui was installed on that system. Turns out we were doing the repository check long before we got around to command line argument handling. We now look to see if the only argument we have been given is 'version' or '--version', and if so, print out the version and exit immediately; long before we consider looking at the Git version or working directory. This way users can still get to the git-gui version number even if Git's version cannot be read. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 2888864e49..60e79ca1b0 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -299,6 +299,11 @@ proc ask_popup {msg} { ## ## version check +if {{--version} eq $argv || {version} eq $argv} { + puts "git-gui version $appvers" + exit +} + set req_maj 1 set req_min 5 @@ -5054,8 +5059,6 @@ enable_option branch enable_option transport switch -- $subcommand { ---version - -version - browser - blame { disable_option multicommit @@ -5426,11 +5429,6 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]} # -- Not a normal commit type invocation? Do that instead! # switch -- $subcommand { ---version - -version { - puts "git-gui version $appvers" - exit -} browser { if {[llength $argv] != 1} { puts stderr "usage: $argv0 browser commit" -- cgit v1.2.3