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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:41:57

quoted
quoted
quoted
quoted
"PB" == Petr Baudis [off-list ref] writes:
quoted
+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.
quoted
+/****************************************************************/
+
+/* 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.

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

From: Petr Baudis <hidden>
Date: 2016-06-15 22:41:57

Dear diary, on Tue, May 17, 2005 at 09:27:03PM CEST, I got a letter
where Junio C Hamano [off-list ref] told me that...
quoted
quoted
quoted
quoted
quoted
"PB" == Petr Baudis [off-list ref] writes:
quoted
quoted
+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.  
Ok, so this just bad comment. :-) No problem then.


Regarding having the code in the library, well, I'm thinking about why
not to just put this logic into all the git commands. Unfortunately I
can't find the email with Linus' argumentation against that right now.
:-(
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:
Actually, my doubts about general usefulness of this wrapper are
growing. Cogito is unlikely to ever make use of it since it has to
figure out the .git location anyway for own use (it keeps plenty of own
files there). But that's likely what any other porcelain layer would
have to do as well, isn't it? The wrapper could still be useful for the
standalone users, though.

Another thing is, I don't think git-run-with-user-path is the right name.
I think it doesn't make much sense on its own, and the wrapper is
actually doing more anyway, applying the ignore rules. What about
calling it just git-run-wrapper?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help