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

Re: [PATCH 1/4] stash: convert apply to builtin

From
Joel Teichroeb <joel@teichroeb.net>
Date
Mar 28, 2018, 03:30 UTC
Message-ID
<CA+CzEk_vRc2AQ+Cxn66TmqbYjDcMsgy0-QXLsJwKRLE70nip_A@mail.gmail.com>
In-Reply-To
<20180325164300.GA10909@hank>
On Sun, Mar 25, 2018 at 9:43 AM, Thomas Gummerer <t.gummerer@gmail.com> wrote:
Show 5 quoted lines
> On 03/24, Joel Teichroeb wrote:
>> ---
>
> Missing sign-off?  I saw it's missing in the other patches as well.
>
Thanks! I always forget to add a sign-off.
Show 29 quoted lines
>> [...]
>> +
>> +     if (info->has_u) {
>> +             struct child_process cp = CHILD_PROCESS_INIT;
>> +             struct child_process cp2 = CHILD_PROCESS_INIT;
>> +             int res;
>> +
>> +             cp.git_cmd = 1;
>> +             argv_array_push(&cp.args, "read-tree");
>> +             argv_array_push(&cp.args, sha1_to_hex(info->u_tree.hash));
>> +             argv_array_pushf(&cp.env_array, "GIT_INDEX_FILE=%s", stash_index_path);
>> +
>> +             cp2.git_cmd = 1;
>> +             argv_array_pushl(&cp2.args, "checkout-index", "--all", NULL);
>> +             argv_array_pushf(&cp2.env_array, "GIT_INDEX_FILE=%s", stash_index_path);
>> +
>> +             res = run_command(&cp) || run_command(&cp2);
>> +             remove_path(stash_index_path);
>> +             if (res)
>> +                     return error(_("Could not restore untracked files from stash"));
>
> A minor change in behaviour here is that we are removing the temporary
> index file unconditionally here, while we would previously only remove
> it if both 'read-tree' and 'checkout-index' would succeed.
>
> I don't think that's a bad thing, we probably don't want users to try
> and use that index file in any way, and I doubt that's part of anyones
> workflow, so I think cleaning it up makes sense.
>

I'm not sure about that. The shell script has a trap near the start in order to clean up the temp index, unless I'm understanding the shell script incorrectly.

Previous: Thomas GummererNext: Thomas Gummerer
Message 10 of 25 in “Convert some stash functionality to a builtin”
  1. 0/4 Convert some stash functionality to a builtinJoel Teichroeb, Mar 24, 2018
  2. 1/4 stash: convert apply to builtinJoel Teichroeb, Mar 24, 2018
  3. Christian CouderMar 24, 2018
  4. Eric SunshineMar 25, 2018
  5. Christian CouderMar 25, 2018
  6. Christian CouderMar 25, 2018
  7. Joel TeichroebMar 25, 2018
  8. Christian CouderMar 25, 2018
  9. Thomas GummererMar 25, 2018
  10. Joel TeichroebMar 28, 2018
  11. Thomas GummererMar 25, 2018
  12. 2/4 stash: convert branch to builtinJoel Teichroeb, Mar 24, 2018
  13. Eric SunshineMar 25, 2018
  14. Christian CouderMar 25, 2018
  15. Thomas GummererMar 25, 2018
  16. 3/4 stash: convert drop and clear to builtinJoel Teichroeb, Mar 24, 2018
  17. Christian CouderMar 24, 2018
  18. Eric SunshineMar 25, 2018
  19. 4/4 stash: convert pop to builtinJoel Teichroeb, Mar 24, 2018
  20. Eric SunshineMar 25, 2018
  21. Thomas GummererMar 25, 2018
  22. Thomas GummererMar 25, 2018
  23. Remove contrib/examples/*Ævar Arnfjörð Bjarmason, Mar 25, 2018
  24. Jeff KingMar 26, 2018
  25. Junio C HamanoMar 26, 2018

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.