unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] nmbug: mark repository as bare on clone
@ 2014-04-12 16:30 David Bremner
  2014-04-12 16:39 ` Tomi Ollila
  2014-04-15 17:23 ` W. Trevor King
  0 siblings, 2 replies; 5+ messages in thread
From: David Bremner @ 2014-04-12 16:30 UTC (permalink / raw)
  To: notmuch

As far as I can figure out, if a git repository is non-bare, then it
should either have core.worktree set, or the parent directory should
be the worktree. Since the parent directory is usually the user's home
directory, we don't want that. Although unlikely to be typed by
mistake

% cd $HOME && ln -s .nmbug .git && git reset --hard

would delete a bunch of files.
---

Hah, I managed to escalate a documentation quibble into a
sortof-security issue.

 devel/nmbug/nmbug | 1 +
 1 file changed, 1 insertion(+)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index d6f5213..b18ded7 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -134,6 +134,7 @@ sub do_clone {
           $repository, $tempwork) == 0
     or die "'git clone' exited with nonzero value\n";
   git ('config', '--unset', 'core.worktree');
+  git ('config', 'core.bare', 'true');
 }
 
 sub is_committed {
-- 
1.9.1

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

* Re: [PATCH] nmbug: mark repository as bare on clone
  2014-04-12 16:30 [PATCH] nmbug: mark repository as bare on clone David Bremner
@ 2014-04-12 16:39 ` Tomi Ollila
  2014-04-12 17:09   ` David Bremner
  2014-04-15 17:23 ` W. Trevor King
  1 sibling, 1 reply; 5+ messages in thread
From: Tomi Ollila @ 2014-04-12 16:39 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sat, Apr 12 2014, David Bremner <david@tethera.net> wrote:

> As far as I can figure out, if a git repository is non-bare, then it
> should either have core.worktree set, or the parent directory should
> be the worktree. Since the parent directory is usually the user's home
> directory, we don't want that. Although unlikely to be typed by
> mistake

Based on that info change looks reasonable. I edited my ~/.nmbug/config
and changed bare = false -> bare = true and nothing borke so far.

so +1 from me.

Tomi

>
> % cd $HOME && ln -s .nmbug .git && git reset --hard
>
> would delete a bunch of files.
> ---
>
> Hah, I managed to escalate a documentation quibble into a
> sortof-security issue.
>
>  devel/nmbug/nmbug | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
> index d6f5213..b18ded7 100755
> --- a/devel/nmbug/nmbug
> +++ b/devel/nmbug/nmbug
> @@ -134,6 +134,7 @@ sub do_clone {
>            $repository, $tempwork) == 0
>      or die "'git clone' exited with nonzero value\n";
>    git ('config', '--unset', 'core.worktree');
> +  git ('config', 'core.bare', 'true');
>  }
>  
>  sub is_committed {
> -- 
> 1.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH] nmbug: mark repository as bare on clone
  2014-04-12 16:39 ` Tomi Ollila
@ 2014-04-12 17:09   ` David Bremner
  0 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2014-04-12 17:09 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:
>
> Based on that info change looks reasonable. I edited my ~/.nmbug/config
> and changed bare = false -> bare = true and nothing borke so far.
>
> so +1 from me.
>
> Tomi

I forgot to mention that I ran that way for a week or so without
problems.

d

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

* Re: [PATCH] nmbug: mark repository as bare on clone
  2014-04-12 16:30 [PATCH] nmbug: mark repository as bare on clone David Bremner
  2014-04-12 16:39 ` Tomi Ollila
@ 2014-04-15 17:23 ` W. Trevor King
  2014-04-15 20:33   ` David Bremner
  1 sibling, 1 reply; 5+ messages in thread
From: W. Trevor King @ 2014-04-15 17:23 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 1452 bytes --]

On Sat, Apr 12, 2014 at 01:30:32PM -0300, David Bremner wrote:
> As far as I can figure out, if a git repository is non-bare, then it
> should either have core.worktree set, or the parent directory should
> be the worktree.

If this works in your testing, then +1 from me ;).  However, the
default is the current working directory, not the repo's parent
directory [1]:

  core.worktree
    …
    If --git-dir or GIT_DIR is specified but none of --work-tree,
    GIT_WORK_TREE and core.worktree is specified, the current working
    directory is regarded as the top level of your working tree.

> % cd $HOME && ln -s .nmbug .git && git reset --hard
> 
> would delete a bunch of files.

Actually, that would just clobber existing ~/tags/{message-id}/{tag}
files, which the user likely doesn't have.  To remove files, you'd
need something like:

  $ cd $HOME && ln -s .nmbug .git && git clean -f

Still, these are just quibbles with the commit message.  I'm +1 on the
code change.  My initial bare-resistance [2] was because I didn't
realize that an explicit GIT_WORK_TREE would override the core.bare
setting.

Cheers,
Trevor

[1]: https://www.kernel.org/pub/software/scm/git/docs/git-config.html
[2]: http://article.gmane.org/gmane.mail.notmuch.general/17817

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] nmbug: mark repository as bare on clone
  2014-04-15 17:23 ` W. Trevor King
@ 2014-04-15 20:33   ` David Bremner
  0 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2014-04-15 20:33 UTC (permalink / raw)
  To: W. Trevor King; +Cc: notmuch

"W. Trevor King" <wking@tremily.us> writes:


> Still, these are just quibbles with the commit message.  I'm +1 on the
> code change.  My initial bare-resistance [2] was because I didn't
> realize that an explicit GIT_WORK_TREE would override the core.bare
> setting.

OK, pushed with an amended commit message/

d

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

end of thread, other threads:[~2014-04-15 20:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-12 16:30 [PATCH] nmbug: mark repository as bare on clone David Bremner
2014-04-12 16:39 ` Tomi Ollila
2014-04-12 17:09   ` David Bremner
2014-04-15 17:23 ` W. Trevor King
2014-04-15 20:33   ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).