Re: [PATCH 2/2] git-gc: skip stashes when expiring reflogs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano wrote:
> Wincent Colaiuta <win@xxxxxxxxxxx> writes:
> 
>> So yes, branches _are_ better and more appropriate for long term  
>> storage than stashes, but even so I don't think it's right for us to  
>> risk throwing away information that the user explicitly stashed and  
>> expected Git to look after for them.
> 
> Yes, but for a limited amount of time.

The fact that this caveat is not mentioned anywhere in the stash
documentation or anywhere in the commit log related to git-stash.sh makes
me think that this idea of 'a limited amount of time' was possibly not a
design decision but merely a side effect of stashes being implemented using the
reflog. Of course I didn't pay any attention to the discussions about stash
back when it was implemented, so I may definitely be wrong.

I'm not sure what the drawback is for persistent stashes though. This is
what I can think of:

  - enlarges repository size by retaining cruft referenced by old stashes
  - encourages bad workflows
  - behaves in a way that is not expected or preferred by the user
  - overly complicates code

The first item I think is somewhat irrelevant. There are many ways that a user
could cause repository size growth, and as Wincent suggested, the increase in
size of the list of stashes is an incentive to clean it up. And in the case of
user generated data, the definition of cruft should be left to the user.

I don't think the second item is true. I don't think any particular work flow
is being encouraged here.

The third item is the one I think is the most important. I think this is a user
interface issue. "Does git do what the user _expects_ git to do?". I offered one
example where the current behavior would produce a result that was likely not
expected by the user and possibly not desired by the user. I think a counter
example (one that would argue against the suggested change in behavior), is if
it were true that if I were to create a stash today, and then be surprised 30
days from now when I do a 'stash list' and find the stash is still there.
Something along the lines of:

   $ git stash save my work
   # wait 30 days
   $ git stash list
   stash@{0}: WIP on master: my work

   # and if my reaction were something like:
   # hmm, that's strange, what is that stash still doing there? It's been 30 days,
   # it should be gone.

btw, that _is_ the current behavior if 'reflog expire' hasn't been run yet for
some reason. Someone who only allows the auto gc to clean their repository would'nt
know any difference.

-brandon

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux