Skip to content

Commit ba66c58

Browse files
author
Junio C Hamano
committed
Merge branch 'maint'
* maint: git-gui: Make 'make' quieter by default git-gui: Remove unnecessary /dev/null redirection. git-gui: Don't create empty (same tree as parent) commits. git-gui: Add Reset to the Branch menu. git-gui: Relocate the menu/transport menu code.
2 parents c044aa1 + eec1025 commit ba66c58

File tree

2 files changed

+69
-37
lines changed

2 files changed

+69
-37
lines changed

git-gui/Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
all::
22

3+
# Define V=1 to have a more verbose compile.
4+
#
5+
36
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
47
@$(SHELL_PATH) ./GIT-VERSION-GEN
58
-include GIT-VERSION-FILE
@@ -19,27 +22,32 @@ ifndef INSTALL
1922
INSTALL = install
2023
endif
2124

25+
ifndef V
26+
QUIET_GEN = @echo ' ' GEN $@;
27+
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
28+
endif
29+
2230
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
2331
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
2432
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
2533

2634
git-gui: git-gui.sh GIT-VERSION-FILE CREDITS-FILE
27-
rm -f $@ $@+
35+
$(QUIET_GEN)rm -f $@ $@+ && \
2836
sed -n \
2937
-e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
3038
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
3139
-e '1,/^set gitgui_credits /p' \
32-
$@.sh >$@+
33-
cat CREDITS-FILE >>$@+
34-
sed -e '1,/^set gitgui_credits /d' $@.sh >>$@+
35-
chmod +x $@+
40+
$@.sh >$@+ && \
41+
cat CREDITS-FILE >>$@+ && \
42+
sed -e '1,/^set gitgui_credits /d' $@.sh >>$@+ && \
43+
chmod +x $@+ && \
3644
mv $@+ $@
3745

3846
CREDITS-FILE: CREDITS-GEN .FORCE-CREDITS-FILE
39-
$(SHELL_PATH) ./CREDITS-GEN
47+
$(QUIET_GEN)$(SHELL_PATH) ./CREDITS-GEN
4048

4149
$(GITGUI_BUILT_INS): git-gui
42-
rm -f $@ && ln git-gui $@
50+
$(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
4351

4452
all:: $(ALL_PROGRAMS)
4553

git-gui/git-gui.sh

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,24 @@ proc commit_committree {fd_wt curHEAD msg} {
12671267
return
12681268
}
12691269

1270+
# -- Verify this wasn't an empty change.
1271+
#
1272+
if {$commit_type eq {normal}} {
1273+
set old_tree [git rev-parse "$PARENT^{tree}"]
1274+
if {$tree_id eq $old_tree} {
1275+
info_popup {No changes to commit.
1276+
1277+
No files were modified by this commit and it
1278+
was not a merge commit.
1279+
1280+
A rescan will be automatically started now.
1281+
}
1282+
unlock_index
1283+
rescan {set ui_status_value {No changes to commit.}}
1284+
return
1285+
}
1286+
}
1287+
12701288
# -- Build the message.
12711289
#
12721290
set msg_p [gitdir COMMIT_EDITMSG]
@@ -1281,14 +1299,8 @@ proc commit_committree {fd_wt curHEAD msg} {
12811299
# -- Create the commit.
12821300
#
12831301
set cmd [list git commit-tree $tree_id]
1284-
set parents [concat $PARENT $MERGE_HEAD]
1285-
if {[llength $parents] > 0} {
1286-
foreach p $parents {
1287-
lappend cmd -p $p
1288-
}
1289-
} else {
1290-
# git commit-tree writes to stderr during initial commit.
1291-
lappend cmd 2>/dev/null
1302+
foreach p [concat $PARENT $MERGE_HEAD] {
1303+
lappend cmd -p $p
12921304
}
12931305
lappend cmd <$msg_p
12941306
if {[catch {set cmt_id [eval exec $cmd]} err]} {
@@ -5256,6 +5268,12 @@ if {[is_enabled branch]} {
52565268
-font font_ui
52575269
lappend disable_on_lock [list .mbar.branch entryconf \
52585270
[.mbar.branch index last] -state]
5271+
5272+
.mbar.branch add command -label {Reset...} \
5273+
-command do_reset_hard \
5274+
-font font_ui
5275+
lappend disable_on_lock [list .mbar.branch entryconf \
5276+
[.mbar.branch index last] -state]
52595277
}
52605278

52615279
# -- Commit Menu
@@ -5330,6 +5348,34 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
53305348
[list .mbar.commit entryconf [.mbar.commit index last] -state]
53315349
}
53325350

5351+
# -- Merge Menu
5352+
#
5353+
if {[is_enabled branch]} {
5354+
menu .mbar.merge
5355+
.mbar.merge add command -label {Local Merge...} \
5356+
-command do_local_merge \
5357+
-font font_ui
5358+
lappend disable_on_lock \
5359+
[list .mbar.merge entryconf [.mbar.merge index last] -state]
5360+
.mbar.merge add command -label {Abort Merge...} \
5361+
-command do_reset_hard \
5362+
-font font_ui
5363+
lappend disable_on_lock \
5364+
[list .mbar.merge entryconf [.mbar.merge index last] -state]
5365+
5366+
}
5367+
5368+
# -- Transport Menu
5369+
#
5370+
if {[is_enabled transport]} {
5371+
menu .mbar.fetch
5372+
5373+
menu .mbar.push
5374+
.mbar.push add command -label {Push...} \
5375+
-command do_push_anywhere \
5376+
-font font_ui
5377+
}
5378+
53335379
if {[is_MacOSX]} {
53345380
# -- Apple Menu (Mac OS X only)
53355381
#
@@ -5502,28 +5548,6 @@ pack .branch.l1 -side left
55025548
pack .branch.cb -side left -fill x
55035549
pack .branch -side top -fill x
55045550

5505-
if {[is_enabled branch]} {
5506-
menu .mbar.merge
5507-
.mbar.merge add command -label {Local Merge...} \
5508-
-command do_local_merge \
5509-
-font font_ui
5510-
lappend disable_on_lock \
5511-
[list .mbar.merge entryconf [.mbar.merge index last] -state]
5512-
.mbar.merge add command -label {Abort Merge...} \
5513-
-command do_reset_hard \
5514-
-font font_ui
5515-
lappend disable_on_lock \
5516-
[list .mbar.merge entryconf [.mbar.merge index last] -state]
5517-
5518-
5519-
menu .mbar.fetch
5520-
5521-
menu .mbar.push
5522-
.mbar.push add command -label {Push...} \
5523-
-command do_push_anywhere \
5524-
-font font_ui
5525-
}
5526-
55275551
# -- Main Window Layout
55285552
#
55295553
panedwindow .vpane -orient vertical

0 commit comments

Comments
 (0)