git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [GSoC] Move ~/.git-credential-cache to ~/.cache/git
@ 2017-03-10 23:30 Devin Lehmacher
  2017-03-11  0:26 ` Jonathan Nieder
  0 siblings, 1 reply; 5+ messages in thread
From: Devin Lehmacher @ 2017-03-10 23:30 UTC (permalink / raw)
  To: git

I started working on this microproject and am not quite sure what is necessary for backwards compatibility. Since the socket is recreated whenever the credential daemon exits backwards compatibility shouldn’t really be a concern with regard to where the socket is located in the filesystem.

However, contrib/persistent-https depends on the socket being at ~/.git-credential-cache/socket, so changing the default location would break this. However, if we need to keep the socket at that location for cases like this I don’t understand how this change would be helpful in any way.

Is it safe to change the default location for this socket and removing the original location?

Thanks in advanced,
Devin Lehmacher

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

* Re: [GSoC] Move ~/.git-credential-cache to ~/.cache/git
  2017-03-10 23:30 [GSoC] Move ~/.git-credential-cache to ~/.cache/git Devin Lehmacher
@ 2017-03-11  0:26 ` Jonathan Nieder
  2017-03-11  1:02   ` Noam Postavsky
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Nieder @ 2017-03-11  0:26 UTC (permalink / raw)
  To: Devin Lehmacher; +Cc: git, Noam Postavsky

(+cc: npostavs)
Hi Devin,

Devin Lehmacher wrote:

> I started working on this microproject and am not quite sure what is
> necessary for backwards compatibility. Since the socket is recreated
> whenever the credential daemon exits backwards compatibility
> shouldn’t really be a concern with regard to where the socket is
> located in the filesystem.
>
> However, contrib/persistent-https depends on the socket being at
> ~/.git-credential-cache/socket, so changing the default location
> would break this. However, if we need to keep the socket at that
> location for cases like this I don’t understand how this change
> would be helpful in any way.

That's a good question.  If I'm reading contrib/persistent-https/
correctly, it uses the same directory but doesn't rely on the socket
there, so it should not be a problem.

However, that reminded me to search for other tools that might rely on
the socket.  Using
https://codesearch.debian.net/search?q=%5C.git-credential-cache, I
find that magit does rely on the socket path.

 $ git clone https://github.com/magit/magit
 $ git log -S.git-credential-cache
 commit 0f30dfbb0075ac2e99b65a2c7fac360197a989c1
 Author: Noam Postavsky <npostavs@users.sourceforge.net>
 Date:   Sat Oct 24 15:57:54 2015 -0400

    Start credential daemon on magit-credential-hook

    If we let git start the daemon, Emacs will send a SIGHUP when git
    finishes and closes the pty, killing the daemon.  Hence the need to have
    our own daemon running first.

Cc-ing Noam to figure out what a safe transition will look like.

Thanks for noticing,
Jonathan

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

* Re: [GSoC] Move ~/.git-credential-cache to ~/.cache/git
  2017-03-11  0:26 ` Jonathan Nieder
@ 2017-03-11  1:02   ` Noam Postavsky
  2017-03-11  2:27     ` Devin Lehmacher
  0 siblings, 1 reply; 5+ messages in thread
From: Noam Postavsky @ 2017-03-11  1:02 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Devin Lehmacher, git

On Fri, Mar 10, 2017 at 7:26 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> I find that magit does rely on the socket path.
>
>     Start credential daemon on magit-credential-hook
>
>     If we let git start the daemon, Emacs will send a SIGHUP when git
>     finishes and closes the pty, killing the daemon.  Hence the need to have
>     our own daemon running first.

Magit doesn't really care about the particular path, but it does call
git-credential-cache--daemon directly which needs to be told where to
create the socket. I guess Magit could just default to using
~/.cache/git/socket if ~/.cache/git exists? (Magit users can override
the path regardless)

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

* Re: [GSoC] Move ~/.git-credential-cache to ~/.cache/git
  2017-03-11  1:02   ` Noam Postavsky
@ 2017-03-11  2:27     ` Devin Lehmacher
  2017-03-11  3:17       ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Devin Lehmacher @ 2017-03-11  2:27 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Jonathan Nieder, git

If I’m not mistaken magit won’t stop working with the changed location since it will just spawn an new instance of the daemon. The only downside would be it wouldn’t get credentials that were cached in the default socket.

I am going to move forward with git-credential-cache just using the new location at
`~/.cache/git/credential/socket` and submit a patch and then get more feedback on the patch.

Devin Lehmacher

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

* Re: [GSoC] Move ~/.git-credential-cache to ~/.cache/git
  2017-03-11  2:27     ` Devin Lehmacher
@ 2017-03-11  3:17       ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2017-03-11  3:17 UTC (permalink / raw)
  To: Devin Lehmacher; +Cc: Noam Postavsky, Jonathan Nieder, git

Devin Lehmacher <djl329@cornell.edu> writes:

> If I’m not mistaken magit won’t stop working with the changed
> location since it will just spawn an new instance of the
> daemon. The only downside would be it wouldn’t get credentials
> that were cached in the default socket.

I am not quite sure how you can say "only" in that sentence.  Isn't
the whole point of socket based daemon interface to allow starting
the daemon so that it can keep using it?

Somebody upthread mentioned checking the current location (and use
it if there is) and then use the new location, which I found a more
reasonable approach.

Assuming that it is sensible to move it from ~/.git-credential-cache
to ~/.cache/git/ in the first place, that is.  If both are equally
acceptable places, then perhaps a configuration that allows those
who want to have things in ~/.config/git/ to specify where to have
the thing (and those without such a custom configuration will keep
using the current location) may be more appropriate.

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

end of thread, other threads:[~2017-03-11  3:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 23:30 [GSoC] Move ~/.git-credential-cache to ~/.cache/git Devin Lehmacher
2017-03-11  0:26 ` Jonathan Nieder
2017-03-11  1:02   ` Noam Postavsky
2017-03-11  2:27     ` Devin Lehmacher
2017-03-11  3:17       ` Junio C Hamano

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

	https://80x24.org/mirrors/git.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).