git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git gui: fail on dual entries in recent repo list
@ 2015-12-13 12:59 Philip Oakley
  2015-12-14 15:08 ` [PATCH v1 0/4] Fix git-gui when recentrepo list has duplicates Philip Oakley
  0 siblings, 1 reply; 11+ messages in thread
From: Philip Oakley @ 2015-12-13 12:59 UTC (permalink / raw)
  To: Git List, Pat Thoyts; +Cc: Alexey A

A user, Alexey A, reported
(https://groups.google.com/forum/#!topic/git-users/msev4KsQGFc, Warning:
gui.recentrepo has multiply values while executing) on the Git User list
that the Git Gui start-up could barf if there were duplicate entries in the
user's recent repo list within their --global .gitconfig, but found no fix 
on
the internet.

Alexey had posted a screenshot of the script error, which, with a little
digging, got down to the _unset_recentrepo procedure in the
choose_repository.tcl file where the line
https://github.com/git/git/blob/master/git-gui/lib/choose_repository.tcl#L250

 git config --global --unset gui.recentrepo "^$p\$"

should read

 git config --global --unset-all gui.recentrepo "^$p\$"

for the case where duplicate entries are present.

This fix resolved Alexey's problem.

So far, so good.


Unfortunately this doesn't explain how duplicate entries are created, and if
the fix will affect other code, which I need some help on.

The 'proc _append_recentrepos {path}' code
https://github.com/git/git/blob/master/git-gui/lib/choose_repository.tcl#L254
has some code to avoid both duplicate entries and to limit the number of
entries in the recent repo list.

A web search to understand the code got me to the lreplace function
(http://wiki.tcl.tk/1485 #Performance: Modifying a List In-Place), which
suggest that the de-dup may (randomly) fail in some cases. In addition it
looks like the code may fail if there are multiple entries returned from the
earlier search of the recentrepo list, whereby the following lreplace would
have more args in the arg list (4 rather than two) and so confusing it,
though my ignorance of tcl precedes me here.

Even if all that tcl works fine, my proposed update will still have issues
for that code, because the append_recentrepos de-dup code keeps its own list
of the recent repos, and thinks that it removed entries one at a time, yet
the change can remove multiple entries if duplicates are present, completely
confusing the counting of entries in the local copy '$recent'.


So, have I understood the code correctly? Are more fixes needed for the
append_recentrepos code to refactor the re-ordering of the recent repos list
and limiting the list to 10 entries once the --unset-all fix is added?
--

Philip

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-12-17  7:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-13 12:59 git gui: fail on dual entries in recent repo list Philip Oakley
2015-12-14 15:08 ` [PATCH v1 0/4] Fix git-gui when recentrepo list has duplicates Philip Oakley
2015-12-14 15:09   ` [PATCH v1 1/4] git-gui: remove duplicate entries from .gitconfig's gui.recentrepo Philip Oakley
2015-12-14 22:31     ` Eric Sunshine
2015-12-16 23:41       ` Philip Oakley
2015-12-17  7:45         ` Eric Sunshine
2015-12-14 15:09   ` [PATCH v1 2/4] git gui: cope with duplicates in _get_recentrepo Philip Oakley
2015-12-14 15:09   ` [PATCH v1 3/4] git gui: de-dup selected repo from recentrepo history Philip Oakley
2015-12-14 15:09   ` [PATCH v1 4/4] git gui: allow for a long recentrepo list Philip Oakley
2015-12-14 22:36     ` Eric Sunshine
2015-12-15  0:04       ` Philip Oakley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).