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

Re: [PATCH] sub-process: print the cmd when a capability is unsupported

From
Christian Couder <christian.couder@gmail.com>
Date
Aug 15, 2017, 20:30 UTC
Message-ID
<CAP8UFD0OUKUu0bqf6BxHBf+51CgFjjmtOk06J_D-=8maa41G7w@mail.gmail.com>
In-Reply-To
<FC865401-2FE6-45ED-BBA5-524C3E29477E@gmail.com>

On Tue, Aug 15, 2017 at 9:35 PM, Lars Schneider <larsxschneider@gmail.com> wrote:

Show 25 quoted lines
>
>> On 15 Aug 2017, at 21:29, Christian Couder <christian.couder@gmail.com> wrote:
>>
>> On Tue, Aug 15, 2017 at 9:00 PM, Lars Schneider
>> <larsxschneider@gmail.com> wrote:
>>>
>>> Wouldn't it be possible to use "process->argv[0]"?
>>> Shouldn't that be the same as "cmd"?
>>
>> Well in sub-process.h there is:
>>
>> /* Members should not be accessed directly. */
>> struct subprocess_entry {
>>    struct hashmap_entry ent; /* must be the first member! */
>>    const char *cmd;
>>    struct child_process process;
>> };
>>
>> so if cmd is always the same as process->argv[0], maybe there is no
>> need for the cmd member in the first place?
>
> The struct is a hash map entry. `cmd` is the key for a `process`.
> Therefore, I think this is still necessary.
>
> Does this make sense?

Not sure it makes sense. A quick try to remove the cmd member, failed t0021 with:

Initialized empty Git repository in /home/christian/git/git/t/trash
directory.t0021-conversion/repo/.git/
[master (root-commit) 56d459b] test commit 1
 Author: A U Thor <author@example.com>
 1 file changed, 1 insertion(+)
 create mode 100644 .gitattributes
--- expected.log.tmp    2017-08-15 20:27:51.658818467 +0000
+++ debug.log.tmp       2017-08-15 20:27:51.662818526 +0000
@@ -2,6 +2,6 @@
 x IN: clean test2.r 14 [OK] -- OUT: 14 . [OK]
 x IN: clean test4-empty.r 0 [OK] -- OUT: 0  [OK]
 x IN: clean testsubdir/test3 'sq',$x=.r 49 [OK] -- OUT: 49 . [OK]
-      1 START
-      1 STOP
-      1 init handshake complete
+      4 START
+      4 STOP
+      4 init handshake complete
not ok 15 - required process filter should filter data

and it is not clear to me why, so I guess you are right and I will
just use process->argv[0].
Previous: Lars SchneiderNext: Ben Peart
Message 15 of 16 in “sub-process: print the cmd when a capability is unsupported”
  1. sub-process: print the cmd when a capability is unsupportedChristian Couder, Aug 15, 2017
  2. Jonathan TanAug 15, 2017
  3. Jonathan NiederAug 16, 2017
  4. Christian CouderAug 16, 2017
  5. Junio C HamanoAug 16, 2017
  6. Christian CouderAug 17, 2017
  7. Junio C HamanoAug 17, 2017
  8. Lars SchneiderAug 17, 2017
  9. Jonathan TanAug 17, 2017
  10. Lars SchneiderAug 15, 2017
  11. Junio C HamanoAug 15, 2017
  12. Christian CouderAug 15, 2017
  13. Christian CouderAug 15, 2017
  14. Lars SchneiderAug 15, 2017
  15. Christian CouderAug 15, 2017
  16. Ben PeartAug 15, 2017

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.