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

Re: [PATCH] git-rerere.txt: Mention rr-cache directory

From
Stephan Beyer <s-beyer@gmx.net>
Date
Jul 9, 2008, 09:21 UTC
Message-ID
<20080709092103.GA5185@leksak.fem-net>
In-Reply-To
<alpine.DEB.1.00.0807090230560.5277@eeepc-johanness>
Hi,
On Wed, Jul 09, Johannes Schindelin wrote:
Show 8 quoted lines
> On Wed, 9 Jul 2008, Johannes Schindelin wrote:
> > On Wed, 9 Jul 2008, Stephan Beyer wrote:
> > 
> > > If a user reads the rerere documentation, he or she is not told to 
> > > create the $GIT_DIR/rr-cache directory to be able to use git-rerere. 
> > 
> > Is it?  The config setting is not enough?  Then that is a bug, and should 
> > not be blessed by a bug in the documentation.
I don't know if this is exactly a bug, at least config.txt says:
rerere.enabled::
	Activate recording of resolved conflicts, so that identical
	conflict hunks can be resolved automatically, should they
	be encountered again.  linkgit:git-rerere[1] command is by
	default enabled if you create `rr-cache` directory under
	`$GIT_DIR`, but can be disabled by setting this option to false.

So according to *that* documentation it is right, according to the git-rerere.txt documentation it was wrong, and according to the source it is...

Show 27 quoted lines
> -- snip --
> static int is_rerere_enabled(void)
> {
>         struct stat st;
>         const char *rr_cache;
>         int rr_cache_exists;
> 
>         if (!rerere_enabled)
>                 return 0;
> 
>         rr_cache = git_path("rr-cache");
>         rr_cache_exists = !stat(rr_cache, &st) && S_ISDIR(st.st_mode);
>         if (rerere_enabled < 0)
>                 return rr_cache_exists;
> 
>         if (!rr_cache_exists &&
>             (mkdir(rr_cache, 0777) || adjust_shared_perm(rr_cache)))
>                 die("Could not create directory %s", rr_cache);
>         return 1;
> }
> -- snap --
> 
> As you can see, in the case rerere_enabled < 0 (i.e. the config did not 
> say anything about rerere), it is assumed enabled _exactly_ when 
> .git/rr_cache/ exists.
> 
> But if it is > 0, the directory is created.

Yes. There is also an important part in the file: -- snip -- /* if rerere_enabled == -1, fall back to detection of .git/rr-cache */ static int rerere_enabled = -1; -- snap --

So this means it's the following behavior:
 - rerere_enabled < 0: enable, iff rr-cache exists
 - rerere_enabled ==0: disable
 - rerere_enabled > 0: enable and create rr-cache if it does not exist

So this is my fault, sorry :) Both documentations (config.txt and git-rerere.txt) are right. It was not explicitly enabled on this one machine which lead me to the wrong assumption. I should sync my ~/.gitconfig more often ;)

Sorry for that,
  Stephan
-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F
Previous: Junio C HamanoNext: Stephan Beyer
Message 5 of 11 in “git-rerere.txt: Mention rr-cache directory”
  1. git-rerere.txt: Mention rr-cache directoryStephan Beyer, Jul 9, 2008
  2. Johannes SchindelinJul 9, 2008
  3. Johannes SchindelinJul 9, 2008
  4. Junio C HamanoJul 9, 2008
  5. Stephan BeyerJul 9, 2008
  6. rerere: Separate libgit and builtin functionsStephan Beyer, Jul 9, 2008
  7. Johannes SchindelinJul 9, 2008
  8. Stephan BeyerJul 9, 2008
  9. [PATCHv2] rerere: Separate libgit and builtin functionsStephan Beyer, Jul 9, 2008
  10. Johannes SchindelinJul 9, 2008
  11. Junio C HamanoJul 9, 2008

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.