threads / patch / 8878

patchgit init: activate rerere by default

Subject: [PATCH] git init: activate rerere by default

## tl;dr

11 messages between Jul 5, 2007 and Jul 6, 2007. Diffs are folded; open one to read it.

replies: 10people: 4as markdown or json

Johannes Schindelin· Jul 5, 2007, 12:16 UTC · lore

We have a working implementation of rerere since long ago, and we even make sure that it works as expected in a test case. It is also a very useful feature, so why not turn it on for the benefit of users who are not even aware of it? This patch does that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	Maybe it is too late for 1.5.3? But maybe this is nice enough to 
	have in 1.5.3?
	BTW I shamelessly put in a comment to boost my comment ration on 
	ohloh.net...
 builtin-init-db.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Show changes to builtin-init-db.c +3 −0
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 66ddaeb..aa3a01e 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -293,6 +293,9 @@ static int create_default_files(const char *git_dir, const char *git_work_tree,
 		if (git_work_tree)
 			git_config_set("core.worktree", git_work_tree);
 	}
+	/* activate rerere */
+	strcpy(path + len, "rr-cache");
+	safe_create_dir(path, 1);
 	return reinit;
 }
 
-- 
1.5.3.rc0.2689.g99ca2-dirty
Alex Riesen· Jul 5, 2007, 13:10 UTC · re: Johannes Schindelin · lore

Re: [PATCH] git init: activate rerere by default

On 7/5/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 5 quoted lines
>
> We have a working implementation of rerere since long ago, and we even
> make sure that it works as expected in a test case.  It is also a very
> useful feature, so why not turn it on for the benefit of users who are
> not even aware of it? This patch does that.
Maybe just create in template directory?
Junio C Hamano· Jul 5, 2007, 16:46 UTC · re: Alex Riesen · lore

Re: [PATCH] git init: activate rerere by default

"Alex Riesen" <raa.lkml@gmail.com> writes:
Show 8 quoted lines
> On 7/5/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>>
>> We have a working implementation of rerere since long ago, and we even
>> make sure that it works as expected in a test case.  It is also a very
>> useful feature, so why not turn it on for the benefit of users who are
>> not even aware of it? This patch does that.
>
> Maybe just create in template directory?
Sounds saner.
Johannes Schindelin· Jul 5, 2007, 17:15 UTC · re: Junio C Hamano · lore

Re: [PATCH] git init: activate rerere by default

Hi,
On Thu, 5 Jul 2007, Junio C Hamano wrote:
Show 12 quoted lines
> "Alex Riesen" <raa.lkml@gmail.com> writes:
> 
> > On 7/5/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> >>
> >> We have a working implementation of rerere since long ago, and we even
> >> make sure that it works as expected in a test case.  It is also a very
> >> useful feature, so why not turn it on for the benefit of users who are
> >> not even aware of it? This patch does that.
> >
> > Maybe just create in template directory?
> 
> Sounds saner.
Does it?

I had the impression that the templates are meant for site-specific modifications. My patch tried to make it more standard than that.

For example, you _could_ have set core.logallrefupdates from the templates, yet you chose not to, but rather hard-wire it into "git init". Which I completely agree to.

Ciao, Dscho

Junio C Hamano· Jul 5, 2007, 18:53 UTC · re: Johannes Schindelin · lore

Re: [PATCH] git init: activate rerere by default

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 25 quoted lines
> Hi,
>
> On Thu, 5 Jul 2007, Junio C Hamano wrote:
>
>> "Alex Riesen" <raa.lkml@gmail.com> writes:
>> 
>> > On 7/5/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>> >>
>> >> We have a working implementation of rerere since long ago, and we even
>> >> make sure that it works as expected in a test case.  It is also a very
>> >> useful feature, so why not turn it on for the benefit of users who are
>> >> not even aware of it? This patch does that.
>> >
>> > Maybe just create in template directory?
>> 
>> Sounds saner.
>
> Does it?
>
> I had the impression that the templates are meant for site-specific 
> modifications. My patch tried to make it more standard than that.
>
> For example, you _could_ have set core.logallrefupdates from the 
> templates, yet you chose not to, but rather hard-wire it into "git init". 
> Which I completely agree to.
I think what Alex meant is this.
Show changes to templates/rr-cache-- +1 −0
diff --git a/templates/rr-cache-- b/templates/rr-cache--
new file mode 100644
index 0000000..fae8870
--- /dev/null
+++ b/templates/rr-cache--
@@ -0,0 +1 @@
+: this is just to ensure the directory exists.
Johannes Schindelin· Jul 5, 2007, 19:22 UTC · re: Junio C Hamano · lore

Re: [PATCH] git init: activate rerere by default

Hi,
On Thu, 5 Jul 2007, Junio C Hamano wrote:
Show 10 quoted lines
> I think what Alex meant is this.
> 
> diff --git a/templates/rr-cache-- b/templates/rr-cache--
> new file mode 100644
> index 0000000..fae8870
> --- /dev/null
> +++ b/templates/rr-cache--
> @@ -0,0 +1 @@
> +: this is just to ensure the directory exists.
> 
Yes, I fully understood.

However, when I use a new version of Git (which happens regularly, since I pull quite often), I do not update the templates. I guess that many distros do not update their templates as often as the core, because they are much more likely to be modified distro-specifically. Further, there are some platforms which are insane enough that you cannot trust the executable bit, and therefore the templates are disabled by default.

All this means that the given patch would not hardly make rerere as widespread as I intended.

Yes, templates are nice. But I don't think that templates are the way to go for introducing nice features as rr-cache.

Ciao, Dscho

Alex Riesen· Jul 5, 2007, 21:40 UTC · re: Johannes Schindelin · lore

Re: [PATCH] git init: activate rerere by default

Johannes Schindelin, Thu, Jul 05, 2007 21:22:43 +0200:
> Yes, templates are nice. But I don't think that templates are the way to 
> go for introducing nice features as rr-cache.

Looks like you're trying to enforce the feature, not introduce. It changes the user-visible behaviour, and this can be unexpected.

It is not like you see people asking question: "How do I avoid repeating the same boring conflict?" every day on vger or irc.

That said, the templates are installed with every make install (and I suppose with every .deb and .rpm), and template is copied in every new repo, so people will get the rr-cache sooner or later. What's wrong with "a bit later" than "much sooner"?

Johannes Schindelin· Jul 5, 2007, 22:29 UTC · re: Alex Riesen · lore

Re: [PATCH] git init: activate rerere by default

Hi,
On Thu, 5 Jul 2007, Alex Riesen wrote:
Show 5 quoted lines
> Johannes Schindelin, Thu, Jul 05, 2007 21:22:43 +0200:
> > Yes, templates are nice. But I don't think that templates are the way to 
> > go for introducing nice features as rr-cache.
> 
> Looks like you're trying to enforce the feature, not introduce.

Yes. Actually, since long I wondered if this feature should not be controlled by a core.rerere variable.

> It changes the user-visible behaviour, and this can be unexpected.
Yes, but I think for the better.
> It is not like you see people asking question: "How do I avoid repeating 
> the same boring conflict?" every day on vger or irc.

That is because people have been trained to cope with CVS. They do not even know rerere exists.

> That said, the templates are installed with every make install (and I 
> suppose with every .deb and .rpm), and template is copied in every new 
> repo, so people will get the rr-cache sooner or later. What's wrong with 
> "a bit later" than "much sooner"?

In the part of my reply that you conveniently scissored, I explained that it is often not "a bit later", but "never".

Ciao, Dscho

Junio C Hamano· Jul 6, 2007, 05:12 UTC · re: Johannes Schindelin · lore

Re: [PATCH] git init: activate rerere by default

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> .... I guess that many 
> distros do not update their templates as often as the core, because they 
> are much more likely to be modified distro-specifically.
Can you back that up?  Fedora and Debian seem to ship them unmodified.
Show 6 quoted lines
> Further, there 
> are some platforms which are insane enough that you cannot trust the 
> executable bit, and therefore the templates are disabled by default.
>
> All this means that the given patch would not hardly make rerere as 
> widespread as I intended.

If you truly want to have rerere enabled by default, it might make sense to:

 * Remove "if test -d "$GIT_DIR/rr-cache" tests we have in the
   existing users;
 * Implement a new test in builtin-rerere.c, as:
   - if rerere.enabled configuration does not exist, check
     $GIT_DIR/rr-cache as before;
   - if rerere.enabled configuration is true, do not bother
     checking $GIT_DIR/rr-cache, but just do it;
   - if rerere.enabled configuration is explicitly set to false,
     never use rerere.
 * Maybe later we might change the default value for
   rerere.enabled to "true", IOW, everybody except people who
   say "[rerere] enabled = false" in their configuration
   automatically gets rerere.

Doing it in git-init, either your patch or by installing a new template, means existing old repository would never get the updated behaviour unless the user runs "git init" there, which is not a very intuitive thing to do to begin with.

Johannes Schindelin· Jul 6, 2007, 12:03 UTC · re: Junio C Hamano · lore

Re: [PATCH] git init: activate rerere by default

Hi,
On Thu, 5 Jul 2007, Junio C Hamano wrote:
Show 7 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > .... I guess that many distros do not update their templates as often 
> > as the core, because they are much more likely to be modified 
> > distro-specifically.
> 
> Can you back that up?  Fedora and Debian seem to ship them unmodified.
No.
> > Further, there are some platforms which are insane enough that you 
> > cannot trust the executable bit, and therefore the templates are 
> > disabled by default.
But this still holds.
Show 26 quoted lines
> If you truly want to have rerere enabled by default, it might make sense 
> to:
> 
>  * Remove "if test -d "$GIT_DIR/rr-cache" tests we have in the
>    existing users;
> 
>  * Implement a new test in builtin-rerere.c, as:
> 
>    - if rerere.enabled configuration does not exist, check
>      $GIT_DIR/rr-cache as before;
> 
>    - if rerere.enabled configuration is true, do not bother
>      checking $GIT_DIR/rr-cache, but just do it;
> 
>    - if rerere.enabled configuration is explicitly set to false,
>      never use rerere.
> 
>  * Maybe later we might change the default value for
>    rerere.enabled to "true", IOW, everybody except people who
>    say "[rerere] enabled = false" in their configuration
>    automatically gets rerere.
> 
> Doing it in git-init, either your patch or by installing a new
> template, means existing old repository would never get the
> updated behaviour unless the user runs "git init" there, which
> is not a very intuitive thing to do to begin with.
Well, I finally bit the apple. Will post in a minute.

Ciao, Dscho

しらいしななこ· Jul 6, 2007, 11:12 UTC · re: Johannes Schindelin · lore

Re: [PATCH] git init: activate rerere by default

Quoting Johannes Schindelin <Johannes.Schindelin@gmx.de>:
Show 5 quoted lines
> All this means that the given patch would not hardly make rerere as 
> widespread as I intended.
>
> Yes, templates are nice. But I don't think that templates are the way to 
> go for introducing nice features as rr-cache.

I am sorry, but I can't understand how it works and how it is useful, after reading the manual page of git-rerere three times. Are there "rerere tutorial for stupid newbies" document somewhere? I earlier created .git/rr-cache folder but I have not seen anything interesting happened in my repository.

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

----------------------------------------------------------------------
Free pop3 email with a spam filter.
http://www.bluebottle.com/tag/5

← back to recent threads