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