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

Re: [PATCH 1/2] Introduce git-run-with-user-path helper program.

From
Junio C Hamano <junkio@cox.net>
Date
May 17, 2005, 19:27 UTC
Message-ID
<7vk6lxfybc.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20050517190355.GA7136@pasky.ji.cz>
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
Show 10 quoted lines
>> +int path_ignored(const char *path)
>> +{
>> +	if (!verify_path(path))
>> +		return 1;
>> +
>> +	/* Put the Porcelain layer ignore logic here.
>> +	 * Return non-zero if path is to be ignored.
>> +	 */
>> +	return 0;
>> +}

PB> I actually think you shouldn't. All the Porcelain layers should PB> hopefully use the same git toolkit layer, not each one shipping own due PB> to differences in things like this.

What you said above _is_ exactly my intention. I phrased that comment very badly. It should have said:

    /* We _will_ put the "ignore logic Porcelain layers agree upon"
     * here, once we have a concensus.
     *
     * The code should return non-zero if path is to be ignored.
     */

I did not put any implementation there because I do not think we have agreed upon anything yet. This patch is to establish the framework.

The second patch is separate, because it is _my_ version of the ignore logic proposal, to serve as a sample. Whatever ignore logic is agreed upon, that _will_ be in the place you pointed out and there will be no choice. Everybody _will_ use the ignore logic.

>> +/****************************************************************/
>> +
>> +/* Path canonicalization part */
PB> And why is this in the library?

Why not? It is something other programs would eventually find useful.

Also the second patch, a sample implementation of ignore logic I proposed, wants to know GIT_PROJECT_TOP to figure out the file pointed at by GIT_DIR/.git/info/ignore-file.

Also it would not hurt if you are always running from the project top and give only verify_path() approved paths. Then canon_path would become identity function.

git-run-with-user-path is useful both in implementing porcelain-add if the porcelain's policy is to take filesystem paths not GIT paths, like this:

    #!/bin/sh
    # porcelain-add
    exec git-run-with-user-path git-update-cache --add -- -- "$@"

Also if the porcelain's policy is to take GIT paths not filesystem paths, then users can say:

    $ find . ! -type d -print0 |
      xargs -0 git-run-with-user-path cg-add --
You cannot use both for obvious reasons.
Previous: Petr BaudisNext: Petr Baudis
Message 3 of 15 in “Introduce git-run-with-user-path helper program.”
  1. 1/2 Introduce git-run-with-user-path helper program.Junio C Hamano, May 16, 2005
  2. Petr BaudisMay 17, 2005
  3. Junio C HamanoMay 17, 2005
  4. Petr BaudisMay 17, 2005
  5. Junio C HamanoMay 17, 2005
  6. Petr BaudisMay 17, 2005
  7. Junio C HamanoMay 17, 2005
  8. Petr BaudisMay 18, 2005
  9. Junio C HamanoMay 18, 2005
  10. Petr BaudisMay 18, 2005
  11. Junio C HamanoMay 18, 2005
  12. Linus TorvaldsMay 19, 2005
  13. Junio C HamanoMay 19, 2005
  14. Thomas GlanzmannMay 19, 2005
  15. Junio C HamanoMay 19, 2005

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.