git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-gui: offer a list of recent repositories on startup

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 7, 2007, 23:30 UTC
Message-ID
<20071007233023.GE2137@spearce.org>
In-Reply-To
<11917925011987-git-send-email-prohaska@zib.de>
Steffen Prohaska <prohaska@zib.de> wrote:
Show 11 quoted lines
> If git-gui is started outside a work tree the repository
> chooser will offer a list of recently opend repositories.
> Clicking on an entry directly opens the repository.
> 
> The list of recently opened repositories is stored in the
> config as gui.recentrepos. If the list grows beyond 10
> entries it will be truncated.
> 
> Note, only repositories that are opened through the
> repository chooser will get added to the recent list.
> Repositories opened from the shell will not yet be added.
I think that all makes a lot of sense.  Three comments below about
this patch in particular.
 
Show 10 quoted lines
> I'd suggest to reduce the number of clicks needed to open or
> clone an existing directory that is not in the list of
> recent repositories. First choosing from the radiobuttons
> and then clicking next is one click to much. There are no
> options to combine. Choosing from the list should
> immediately trigger the action.
> 
> We could either put 'Create/Clone/Open New Repository' into
> the Repository menu and only present the recent repository
> list. Or we could offer push buttons for the other actions.

I agree entirely. That "Next" button is stupid stupid stupid. What was I smoking that day? :-)

I'm concerned about putting them into the Repository menu only as then the main window is competely void and users are sort of wondering what they should do next. I think we should actually do both. Put them into the menu and as push buttons on the window.

> +	label $w_body.space
> +	label $w_body.recentlabel \
> +		-anchor w \
> +		-text "Select Recent Repository:"
This string needs to be i18n'd with [mc ...].
> +	listbox $w_body.recentlist \

Please make a field in this class called say "w_recentlist" so you can use that field name instead of $w_body.recentlist. This simplifies the code if we ever have to change the actual path that the widget resides at, such as to alter the layout.

Show 11 quoted lines
> +proc _append_recentrepos {path} {
> +	set recent [get_config gui.recentrepos]
> +	if {[lsearch $recent $path] < 0} {
> +		lappend recent $path
> +	}
> +	if {[llength $recent] > 10} {
> +		set recent [lrange $recent 1 end]
> +	}
> +	regsub -all "\[{}\]" $recent {"} recent
> +	git config --global gui.recentrepos $recent
> +}

Why treat this as a Tcl list in a single value? Why not make it a true multi-value configuration entry in ~/.gitconfig, like how remote.$name.fetch is a multi-value entry? Does Windows allow you to put " in a path name? Because the above regex will make a list of paths that contains " in one of the entries invalid.

I think you also want to have this function return back immediately if [lsearch $recent $path] >= 0 as then you don't invoke git-config to perform a no-op change in the configuration file. As you well know forking on Windows is a major cost. We shouldn't run git-config just because the user opened a recent repository.

-- 
Shawn.
Previous: Steffen ProhaskaNext: Steffen Prohaska
Message 2 of 10 in “git-gui: offer a list of recent repositories on startup”
  1. git-gui: offer a list of recent repositories on startupSteffen Prohaska, Oct 7, 2007
  2. Shawn O. PearceOct 7, 2007
  3. Steffen ProhaskaOct 8, 2007
  4. Johannes SchindelinOct 9, 2007
  5. Steffen ProhaskaOct 9, 2007
  6. Shawn O. PearceOct 10, 2007
  7. Johannes SchindelinOct 10, 2007
  8. Shawn O. PearceOct 10, 2007
  9. Steffen ProhaskaOct 10, 2007
  10. Shawn O. PearceOct 10, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.