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

Re: [PATCH 2/3] gitk: write only changed configuration variables

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 11, 2014, 17:19 UTC
Message-ID
<xmqqtx4edqgz.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1410412888-10187-3-git-send-email-max@max630.net>
Max Kirillov <max@max630.net> writes:
> If a variable is changed in a concurrent gitk or manually it is
> preserved unless it has changed in this instance

It would have been easier to understand why this is a desirable change if you stated what problem you are trying to solve before that sentence. "If I do X, Y happens, which is bad for reason Z. With this change, Y no longer happens as long as I do not do W."

> This change does not affect geometry and views save; geometry does not
> need it, and views need special merging, which treats each view
> separately rather that fully replace the shole list.
s/sh/wh/ I presume?
Show 20 quoted lines
>
> Signed-off-by: Max Kirillov <max@max630.net>
> ---
>  gitk | 41 +++++++++++++++++++++++++++++++++--------
>  1 file changed, 33 insertions(+), 8 deletions(-)
>
> diff --git a/gitk b/gitk
> index 6069afe..6e22024 100755
> --- a/gitk
> +++ b/gitk
> @@ -2804,12 +2804,25 @@ proc doprogupdate {} {
>      }
>  }
>  
> +proc config_variable_change_cb {name name2 op} {
> +    global config_variable_changed
> +    if {$op eq "write"} {
> +	set config_variable_changed($name) 1
> +    }
> +}

Hmm, wouldn't it make more sense to save the original value where you set up the variable trace, and make the savestuff procedure do a 3-way merge? That way, when you and the other party changed a variable to a different value, you can give a better diagnosis to the user to know what is going on. If both of you changed to the same value, then the end result would be the same, of course.

Previous: Max KirillovNext: Max Kirillov
Message 4 of 7 in “gitk: save only changed configuration on exit”
  1. 0/3 gitk: save only changed configuration on exitMax Kirillov, Sep 11, 2014
  2. 1/3 gitk refactor: remove boilerplate for configuration variablesMax Kirillov, Sep 11, 2014
  3. 2/3 gitk: write only changed configuration variablesMax Kirillov, Sep 11, 2014
  4. Junio C HamanoSep 11, 2014
  5. Max KirillovSep 11, 2014
  6. Junio C HamanoSep 11, 2014
  7. 3/3 gitk: merge views with existing onesMax Kirillov, Sep 11, 2014

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.