git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/3] stash: Allow git stash branch to process commits that look like stashes but are not stash references.

From
Jon Seymour <jon.seymour@gmail.com>
Date
Aug 5, 2010, 05:23 UTC
Message-ID
<AANLkTikA0_Og4bzB8AHo3s2cLCvf6pc9=wC4w_8emuxU@mail.gmail.com>
In-Reply-To
<7vwrs6djie.fsf@alter.siamese.dyndns.org>
Junio,

Thanks for the feedback. I'll rework along the lines you suggest. If it makes sense to make the other stash commands tolerant of non-stash entry references I'll add tests, support and documentation for that.

jon.
On Thu, August 2010 at 9:51 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 46 quoted lines
> Jon  Seymour <jon.seymour@gmail.com> writes:
>
>> This patch allows git stash branch to work with stash-like commits created by git stash create.
>>
>> Two changes were required:
>>
>> * relax the pre-condition so that a stash stack is required if and only if a stash argument is not specified
>> * don't attempt to drop a stash argument that doesn't look like a stash reference.
>>
>>
>> Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
>
> Please wrap very long lines.
>
>> diff --git a/git-stash.sh b/git-stash.sh
>> index 1d95447..432ddae 100755
>> --- a/git-stash.sh
>> +++ b/git-stash.sh
>> @@ -225,6 +225,12 @@ show_stash () {
>>       git diff $flags $b_commit $w_commit
>>  }
>>
>> +if_stash_ref() {
>> +     ref="$1"
>> +     shift
>> +     test "${ref#stash}" = "${ref}" -a "${ref#$ref_stash}" = "${ref}" || "$@"
>> +}
>
> The interface to this function looks a rather bad taste to me; wouldn't it
> look more natural if the callers can say:
>
>        if stash_ref $it
>        then
>                do this
>        fi
>
> Your criteria used here is that the given parameter does not begin with
> "stash" nor "refs/stash".  If it begins with either of these two strings,
> the "test" fails and "$@" is run.  Wouldn't this produce a false hit if
> you kept a handcrafted stash-looking commit with a tag "stash-42" or
> something?
>
> It may make more sense to give "stash drop" an option to be silent if
> the given parameter is not on the list to begin with, perhaps?
>
>
Previous: Junio C HamanoNext: Jon Seymour
Message 6 of 9 in “*** SUBJECT HERE ***”
  1. 0/3 *** SUBJECT HERE ***Jon Seymour, Aug 3, 2010
  2. 1/3 stash: It looks like a stash, but doesn't quack like a stash...Jon Seymour, Aug 3, 2010
  3. Junio C HamanoAug 4, 2010
  4. 2/3 stash: Allow git stash branch to process commits that look like stashes but are not stash references.Jon Seymour, Aug 3, 2010
  5. Junio C HamanoAug 4, 2010
  6. Jon SeymourAug 5, 2010
  7. Jon SeymourAug 5, 2010
  8. Junio C HamanoAug 5, 2010
  9. 3/3 stash: modify tests to reflect stash branch fixes.Jon Seymour, Aug 3, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.