diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-03-21 09:25:58 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-21 09:25:58 -0700 |
| commit | 6e8d538aab8fe4dd07ba9fb87b5c7edcfa5706ad (patch) | |
| tree | e2021a881ddddc19d3959d2f2c2f6476f7f726d9 | |
| parent | b70a02dcc9add838175b4c4a07171f8ab6b9f7c0 (diff) | |
| parent | bb52cdac6254c006e06bf0bb820268dcf024fc22 (diff) | |
| download | git-6e8d538aab8fe4dd07ba9fb87b5c7edcfa5706ad.tar.xz | |
Merge branch 'master' of https://github.com/j6t/git-gui
* 'master' of https://github.com/j6t/git-gui:
git-gui: grey out comment lines in commit message
git-gui: wire up "git-gui--askyesno" with Meson
git-gui: massage "git-gui--askyesno" with "generate-script.sh"
git-gui: prefer shell at "/bin/sh" with Meson
git-gui: fix use of GIT_CEILING_DIRECTORIES
git-gui: shift tabstops to account for the first column of patch text
| -rw-r--r-- | git-gui/.gitignore | 1 | ||||
| -rwxr-xr-x | git-gui/GIT-VERSION-GEN | 16 | ||||
| -rw-r--r-- | git-gui/Makefile | 9 | ||||
| -rwxr-xr-x | git-gui/git-gui--askyesno.sh (renamed from git-gui/git-gui--askyesno) | 0 | ||||
| -rwxr-xr-x | git-gui/git-gui.sh | 18 | ||||
| -rw-r--r-- | git-gui/lib/diff.tcl | 2 | ||||
| -rw-r--r-- | git-gui/meson.build | 31 | ||||
| -rw-r--r-- | git-gui/meson_options.txt | 2 |
8 files changed, 58 insertions, 21 deletions
diff --git a/git-gui/.gitignore b/git-gui/.gitignore index 5130b4f018..38a41ebc58 100644 --- a/git-gui/.gitignore +++ b/git-gui/.gitignore @@ -5,4 +5,5 @@ GIT-GUI-BUILD-OPTIONS GIT-VERSION-FILE git-gui git-gui--askpass +git-gui--askyesno lib/tclIndex diff --git a/git-gui/GIT-VERSION-GEN b/git-gui/GIT-VERSION-GEN index c2767b4136..2f729de4bb 100755 --- a/git-gui/GIT-VERSION-GEN +++ b/git-gui/GIT-VERSION-GEN @@ -5,19 +5,27 @@ DEF_VER=0.21.GITGUI LF=' ' -if test "$#" -ne 2 +if test "$#" -lt 2 then - echo >&2 "usage: $0 <SOURCE_DIR> <OUTPUT>" + echo >&2 "usage: $0 <SOURCE_DIR> <OUTPUT> [<PARENT_PROJECT_DIR>]" exit 1 fi SOURCE_DIR="$1" OUTPUT="$2" +PARENT_PROJECT_DIR="$3" # Protect us from reading Git version information outside of the Git directory # in case it is not a repository itself, but embedded in an unrelated -# repository. -GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.." +# repository. The PARENT_PROJECT_DIR variable can be used to override this, for +# example when git-gui is included as a subproject. +if test -n "$PARENT_PROJECT_DIR" +then + GIT_CEILING_DIRECTORIES="$PARENT_PROJECT_DIR/.." +else + GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.." +fi + export GIT_CEILING_DIRECTORIES tree_search () diff --git a/git-gui/Makefile b/git-gui/Makefile index 69b0b84435..ca01068810 100644 --- a/git-gui/Makefile +++ b/git-gui/Makefile @@ -9,7 +9,7 @@ all:: # GIT-VERSION-FILE: FORCE - @$(SHELL_PATH) ./GIT-VERSION-GEN . $@ + @$(SHELL_PATH) ./GIT-VERSION-GEN . $@ "$(PARENT_PROJECT_DIR)" uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') @@ -177,10 +177,13 @@ GIT-GUI-BUILD-OPTIONS: FORCE git-gui--askpass: git-gui--askpass.sh GIT-GUI-BUILD-OPTIONS generate-script.sh $(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS +git-gui--askyesno: git-gui--askyesno.sh GIT-GUI-BUILD-OPTIONS generate-script.sh + $(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS + ifdef GITGUI_WINDOWS_WRAPPER all:: git-gui endif -all:: $(GITGUI_MAIN) git-gui--askpass lib/tclIndex $(ALL_MSGFILES) +all:: $(GITGUI_MAIN) git-gui--askpass git-gui--askyesno lib/tclIndex $(ALL_MSGFILES) install: all $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1) @@ -221,7 +224,7 @@ dist-version: GIT-VERSION-FILE @sed 's|^GITGUI_VERSION=||' <GIT-VERSION-FILE >$(TARDIR)/version clean:: - $(RM_RF) $(GITGUI_MAIN) git-gui--askpass lib/tclIndex po/*.msg $(PO_TEMPLATE) + $(RM_RF) $(GITGUI_MAIN) git-gui--askpass git-gui--askyesno lib/tclIndex po/*.msg $(PO_TEMPLATE) $(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS ifdef GITGUI_WINDOWS_WRAPPER $(RM_RF) git-gui diff --git a/git-gui/git-gui--askyesno b/git-gui/git-gui--askyesno.sh index 142d1bc3de..142d1bc3de 100755 --- a/git-gui/git-gui--askyesno +++ b/git-gui/git-gui--askyesno.sh diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index d3d3aa14a9..23fe76e498 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -3900,6 +3900,24 @@ if {[winfo exists $ui_comm]} { backup_commit_buffer + # Grey out comment lines (which are stripped from the final commit message by + # wash_commit_message). + $ui_comm tag configure commit_comment -foreground gray + proc dim_commit_comment_lines {} { + global ui_comm comment_string + $ui_comm tag remove commit_comment 1.0 end + set text [$ui_comm get 1.0 end] + # See also cmt_rx in wash_commit_message + set cmt_rx [strcat {^} [regsub -all {\W} $comment_string {\\&}]] + set ranges [regexp -all -indices -inline -line -- $cmt_rx $text] + foreach pair $ranges { + set idx "1.0 + [lindex $pair 0] chars" + $ui_comm tag add commit_comment $idx "$idx lineend + 1 char" + } + } + dim_commit_comment_lines + bind $ui_comm <<Modified>> { after idle dim_commit_comment_lines } + # -- If the user has aspell available we can drive it # in pipe mode to spellcheck the commit message. # diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl index 442737ba4f..8be1a613fb 100644 --- a/git-gui/lib/diff.tcl +++ b/git-gui/lib/diff.tcl @@ -385,6 +385,8 @@ proc read_diff {fd conflict_size cont_info} { # if {[string match {@@@ *} $line]} { set is_3way_diff 1 + apply_tab_size 2 + } elseif {[string match {@@ *} $line]} { apply_tab_size 1 } diff --git a/git-gui/meson.build b/git-gui/meson.build index 320ba09ecf..a8119aa29f 100644 --- a/git-gui/meson.build +++ b/git-gui/meson.build @@ -4,7 +4,7 @@ project('git-gui', fs = import('fs') -shell = find_program('sh') +shell = find_program('/bin/sh', 'sh') tclsh = find_program('tclsh') wish = find_program('wish') @@ -34,6 +34,7 @@ version_file = custom_target( '@INPUT@', meson.current_source_dir(), '@OUTPUT@', + get_option('parent_project_dir'), ], build_always_stale: true, ) @@ -53,19 +54,21 @@ if target_machine.system() == 'windows' ) endif -custom_target( - output: 'git-gui--askpass', - input: 'git-gui--askpass.sh', - command: [ - shell, - meson.current_source_dir() / 'generate-script.sh', - '@OUTPUT@', - '@INPUT@', - meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', - ], - install: true, - install_dir: get_option('libexecdir') / 'git-core', -) +foreach script : [ 'git-gui--askpass', 'git-gui--askyesno' ] + custom_target( + output: script, + input: script + '.sh', + command: [ + shell, + meson.current_source_dir() / 'generate-script.sh', + '@OUTPUT@', + '@INPUT@', + meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', + ], + install: true, + install_dir: get_option('libexecdir') / 'git-core', + ) +endforeach custom_target( input: 'git-gui.sh', diff --git a/git-gui/meson_options.txt b/git-gui/meson_options.txt new file mode 100644 index 0000000000..7591a34218 --- /dev/null +++ b/git-gui/meson_options.txt @@ -0,0 +1,2 @@ +option('parent_project_dir', type: 'string', value: '', + description: 'The directory of the parent project. This is used so that the version can be determined even in case git-gui is included as a subtree.') |
