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

Re: [PATCH v3 1/2] stash show: teach --include-untracked and --only-untracked

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 17, 2021, 17:50 UTC
Message-ID
<xmqq4kiamvmg.fsf@gitster.g>
In-Reply-To
<YCz7gOlXDTTd5urZ@generichostname>
Denton Liu <liu.denton@gmail.com> writes:
Show 24 quoted lines
> Hi Junio,
>
> On Tue, Feb 16, 2021 at 12:22:52PM -0800, Junio C Hamano wrote:
>>  builtin/stash.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git c/builtin/stash.c w/builtin/stash.c
>> index c788a3e236..7e0204bd8a 100644
>> --- c/builtin/stash.c
>> +++ w/builtin/stash.c
>> @@ -807,10 +807,11 @@ static void diff_include_untracked(const struct stash_info *info, struct diff_op
>>  		init_tree_desc(&tree_desc[i], tree[i]->buffer, tree[i]->size);
>>  	}
>>  
>> +	/* mimic "git read-tree W U" without "-m" */
>>  	unpack_tree_opt.head_idx = -1;
>>  	unpack_tree_opt.src_index = &the_index;
>>  	unpack_tree_opt.dst_index = &the_index;
>> -	unpack_tree_opt.fn = twoway_merge;
>> +	unpack_tree_opt.fn = NULL;
>
> Perhaps it would be even more clear if we just removed this line
> entirely, otherwise it may give future readers a false impression that
> .fn is significant in any way.

Assignment of something concrete like "twoway_merge" to .fn when it is a no-op was misleading, but between NULL or uninitialized, both state clear that it is not used, so I am OK with either.

> Aside from that, both of your SQUASH??? commits look good to me. Thanks
> for tying up the loose ends.

We may want to write a custom unpack_trees() callback for this, and use it here to catch "this third tree claims to be untracked, but why does it have an entry that overlaps and/or D/F-conflicts with the entry from the working tree side?" that you talked about in the log message, but I think it is better to leave it for future [*], as the feature should already be usable in its current shape.

Thanks.
[Footnote]
 * Yes, I didn't say "we can leave it", but said "it is better to
   leave it"; as long as we do not declare victory too early and end
   up shipping a half-baked unusable mess, I think it is better to
   wrap a topic early and plan to make it nicer in a future
   follow-up.
   To encourage such future refinements, however, you may add a
   NEEDSWORK comment in the code as a reminder for our future
   selves.
Previous: Denton LiuNext: Junio C Hamano
Message 37 of 45 in “stash show: learn --include-untracked and --only-untracked”
  1. 0/9 stash show: learn --include-untracked and --only-untrackedDenton Liu, Feb 2, 2021
  2. 1/9 git-stash.txt: be explicit about subcommand optionsDenton Liu, Feb 2, 2021
  3. Eric SunshineFeb 2, 2021
  4. 4/9 t3905: remove nested git in command substitutionDenton Liu, Feb 2, 2021
  5. 2/9 t3905: remove spaces after redirect operatorsDenton Liu, Feb 2, 2021
  6. 3/9 t3905: move all commands into test casesDenton Liu, Feb 2, 2021
  7. Junio C HamanoFeb 2, 2021
  8. 5/9 t3905: replace test -s with test_file_not_emptyDenton Liu, Feb 2, 2021
  9. 8/9 stash show: teach --include-tracked and --only-untrackedDenton Liu, Feb 2, 2021
  10. Junio C HamanoFeb 2, 2021
  11. 9/9 stash show: learn stash.showIncludeUntrackedDenton Liu, Feb 2, 2021
  12. 7/9 stash: declare ref_stash as an arrayDenton Liu, Feb 2, 2021
  13. Junio C HamanoFeb 2, 2021
  14. 6/9 t3905: use test_cmp() to check file contentsDenton Liu, Feb 2, 2021
  15. 0/9 stash show: learn --include-untracked and --only-untrackedDenton Liu, Feb 9, 2021
  16. 1/9 git-stash.txt: be explicit about subcommand optionsDenton Liu, Feb 9, 2021
  17. Junio C HamanoFeb 10, 2021
  18. fixup! git-stash.txt: be explicit about subcommand optionsDenton Liu, Feb 11, 2021
  19. 2/9 t3905: remove spaces after redirect operatorsDenton Liu, Feb 9, 2021
  20. Junio C HamanoFeb 10, 2021
  21. 3/9 t3905: move all commands into test casesDenton Liu, Feb 9, 2021
  22. 4/9 t3905: remove nested git in command substitutionDenton Liu, Feb 9, 2021
  23. Junio C HamanoFeb 10, 2021
  24. 5/9 t3905: replace test -s with test_file_not_emptyDenton Liu, Feb 9, 2021
  25. 6/9 t3905: use test_cmp() to check file contentsDenton Liu, Feb 9, 2021
  26. 8/9 stash show: teach --include-untracked and --only-untrackedDenton Liu, Feb 9, 2021
  27. Junio C HamanoFeb 10, 2021
  28. Denton LiuFeb 16, 2021
  29. Junio C HamanoFeb 16, 2021
  30. 7/9 stash: declare ref_stash as an arrayDenton Liu, Feb 9, 2021
  31. Junio C HamanoFeb 10, 2021
  32. 9/9 stash show: learn stash.showIncludeUntrackedDenton Liu, Feb 9, 2021
  33. 0/2 stash show: learn --include-untracked and --only-untrackedDenton Liu, Feb 16, 2021
  34. 1/2 stash show: teach --include-untracked and --only-untrackedDenton Liu, Feb 16, 2021
  35. Junio C HamanoFeb 16, 2021
  36. Denton LiuFeb 17, 2021
  37. Junio C HamanoFeb 17, 2021
  38. Junio C HamanoFeb 17, 2021
  39. 2/2 stash show: learn stash.showIncludeUntrackedDenton Liu, Feb 16, 2021
  40. 0/2 stash show: learn --include-untracked and --only-untrackedDenton Liu, Mar 3, 2021
  41. 2/2 stash show: learn stash.showIncludeUntrackedDenton Liu, Mar 3, 2021
  42. 1/2 stash show: teach --include-untracked and --only-untrackedDenton Liu, Mar 3, 2021
  43. Junio C HamanoMar 4, 2021
  44. Denton LiuMar 4, 2021
  45. Denton LiuMar 4, 2021

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.